|
|
El 12/04/16 a las 18:40, Jérôme M. Berger escribió:
> BTW, it would probably be faster to replace your code with:
>
> // Will probably need tweaking
> #declare M=0.0000005;
>
> #declare d2xpd2y=function{
> (f_water(x+EPSILON,y,0)+f_water(x-EPSILON,y,0)+
> f_water(x,y+EPSILON,0)+f_water(x,y-EPSILON,0)-
> 4*f_water(x,y,0))/
> (EPSILON*EPSILON)
> }
>
> #declare selected=function{select(x,abs(x))}
>
> #declare t_ocean=
> texture{
> pigment_pattern{
> function{selected(d2xpd2y(x,y,0))*M,0)}
> }
> texture_map{
> [0.0 t_water]
> [0.1 t_foam]
> }
> }
>
> This only calls f_water 5 times where your code called it 16 times...
>
Yes, it seems to render noticeably faster... but I had to correct
some things:
#declare M=0.0000005;
#declare d2xpd2y=function{
(f_water(x+EPSILON,y,0)+f_water(x-EPSILON,y,0)+
f_water(x,y+EPSILON,0)+f_water(x,y-EPSILON,0)-
4*f_water(x,y,0))/
(EPSILON*EPSILON)
}
#declare selected=function(x){select(x,abs(x),0)}
#declare t_ocean=
texture{
pigment_pattern{
function{selected(d2xpd2y(x,y,0))*M}
}
texture_map{
[0.0 t_water]
[0.1 t_foam]
}
}
That works! Thanks!
--
jaime
Post a reply to this message
|
|