 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 04/11/2016 12:13 PM, Jaime Vives Piqueres wrote:
> El 11/04/16 a las 08:50, Thomas de Groot escribió:
>> What lame excuses! :-)
>
> No, really... my back hurts now, as I had to be laying on the groun
d
> almost 2 hours to remove the obstruction on the drain pump. And my brai
n
> hurts too, after some more hours fiddling with the derivatives result t
o
> convert them into an usable pattern.
>
>> I am curious about the foam pattern. I have tried some ideas of my own
>> yesterday but to no conclusive results.
>
> I will publish the code soon, but here it is an extract:
>
>
> // the derivatives
> #declare EPSILON = 1e-4;
> #declare
> f1x=function{(f_water(x+EPSILON,y,0)-f_water(x-EPSILON,y,0))/2*EPSILO
N}
> #declare
> f1y=function{(f_water(x,y+EPSILON,0)-f_water(x,y-EPSILON,0))/2*EPSILO
N}
> #declare f2x=function{(f1x(x+EPSILON,y,0)-f1x(x-EPSILON,y,0))/2*EPSIL
ON}
> #declare f2y=function{(f1y(x,y+EPSILON,0)-f1y(x,y-EPSILON,0))/2*EPSIL
ON}
>
Well strictly speaking, you're missing a pair of parentheses around the
2*EPSILON. They should make it easier to tweak your parameters (for one
thing you can probably replace the 1000000000 with 10 which makes for
less unwieldy values).
That being said, the result you got here is pretty good. Keep up the
good work!
Jerome
--
mailto:jeb### [at] free fr
http://jeberger.free.fr
Jabber: jeb### [at] jabber fr
Post a reply to this message
Attachments:
Download 'us-ascii' (1 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
El 11/04/16 a las 23:05, Jérôme M. Berger escribió:
> Well strictly speaking, you're missing a pair of parentheses around the
> 2*EPSILON. They should make it easier to tweak your parameters (for one
> thing you can probably replace the 1000000000 with 10 which makes for
> less unwieldy values).
Ouch! Corrected... but now the multiplier has to be around 0.0000005.
>
> That being said, the result you got here is pretty good. Keep up the
> good work!
Thanks!
--
jaime
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 04/11/2016 11:31 PM, Jaime Vives Piqueres wrote:
> El 11/04/16 a las 23:05, Jérôme M. Berger escribió:
>> Well strictly speaking, you're missing a pair of parentheses around t
he
>> 2*EPSILON. They should make it easier to tweak your parameters (for on
e
>> thing you can probably replace the 1000000000 with 10 which makes for
>> less unwieldy values).
>
> Ouch! Corrected... but now the multiplier has to be around 0.0000005.
>
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...
Jerome
--
mailto:jeb### [at] free fr
http://jeberger.free.fr
Jabber: jeb### [at] jabber fr
Post a reply to this message
Attachments:
Download 'us-ascii' (1 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |