|
|
hi,
=?UTF-8?Q?J=c3=b6rg_=22Yadgar=22_Bleimann?= <yaz### [at] gmxde> wrote:
> On 13.08.20 21:03, jr wrote:
> > "jr" <cre### [at] gmailcom> wrote:
> >> ...
> > the increments where you make the vector for 'eval_pigment', pretty sure you'll
> > want '<(.5+b)*(1/xdim), (.5+a)*(1/ydim),0>'.
>
> As the data tile is square, xdim = ydim! Of course you're right, if I
> ever wanted to render a non-square data set, it's better to have the two
> variables assigned to the proper dimensions.
re square vs non-square -- if you use the method suggested by BE, ie using
'max_extent' to obtain '[xy]dim', you never need to know, nor care.
re code -- I think that you will see improved performance if you, again, follow
the advice given by BE regarding pre-calculating what you can. so '[xy]dim' are
constant, for that bit of code, and not calculating both in the inner loop
removes two (relatively) expensive (division) operations; furthermore, file
system operations too are expensive, so consolidating the '#write's should make
a noticeable difference. suggest bracket yr existing code with '#declare before
= now;' and '#declare after = now;' and run two or three times to get the number
of seconds, then replace yr code with the below, and compare. I'd be v
interested to find out what savings that makes for the large kind of image
you're playing with.
#declare i=0;
#write (ES, " texture_list")
#write (ES, " {\n")
#write (ES, concat(" ",str(NumTextures, 1, 0),"\n"))
#declare xincr = 1 / xdim;
#declare yincr = 1 / ydim;
#declare before = now;
#for (a, 0, ydim-1)
#for (b, 0, xdim-1)
#declare C_Texture = eval_pigment(P_Texture,
<(.5+b)*xincr,(0.5+a)*yincr,0>);
#write (ES, concat(" texture\n",
" {\n",
" pigment\n",
" {\n",
" color rgb <",
vstr(3, C_Texture, ",", 1, 7),
">\n",
" }\n",
" }\n"))
#end
#end
#write (ES, " }\n")
#declare after = now;
regards, jr.
Post a reply to this message
|
|