 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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 ground
almost 2 hours to remove the obstruction on the drain pump. And my brain
hurts too, after some more hours fiddling with the derivatives result to
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*EPSILON}
#declare
f1y=function{(f_water(x,y+EPSILON,0)-f_water(x,y-EPSILON,0))/2*EPSILON}
#declare f2x=function{(f1x(x+EPSILON,y,0)-f1x(x-EPSILON,y,0))/2*EPSILON}
#declare f2y=function{(f1y(x,y+EPSILON,0)-f1y(x,y-EPSILON,0))/2*EPSILON}
// the texture from them
#declare t_ocean=
texture{
pigment_pattern{
function{select(f2x(x,y,0)+f2y(x,y,0),abs(f2x(x,y,0)+f2y(x,y,0))*1000000000*4,0)}
}
texture_map{
[0.0 t_water]
[0.1 t_foam]
}
}
As you can see, the final pattern using the derivatives is tricky...
I had to play with EPSILON to find a value suitable for the scale of my
height_field and the "precision" I wanted. Then used select find the
negative parts and convert them to positive, and scaling the values up
because they are extremely small. Don't ask me how the hell I worked
that out... attached is a first render showing the result. Still not
what I want, but seems this is the way to go.
--
jaime
Post a reply to this message
Attachments:
Download 'ocean-16.jpg' (147 KB)
Preview of image 'ocean-16.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 4/11/2016 11:13 AM, Jaime Vives Piqueres wrote:
> Still not what I want, but seems this is the way to go.
That looks just like before the foam starts streaming.
It is more than acceptable. Quite realistic, the horizon is not swamped
with small detail but my eye can see the longer frequency waves as you
would. It is only the foreground wave that needs a bit of breaking foam.
You could hang it on your wall. :)
I think that you are working in the right area. What sort of time did it
take? And what is the camera's FOV? I'm just curious.
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 11-4-2016 12:13, Jaime Vives Piqueres wrote:
...
> As you can see, the final pattern using the derivatives is tricky...
> I had to play with EPSILON to find a value suitable for the scale of my
> height_field and the "precision" I wanted. Then used select find the
> negative parts and convert them to positive, and scaling the values up
> because they are extremely small. Don't ask me how the hell I worked
> that out... attached is a first render showing the result. Still not
> what I want, but seems this is the way to go.
>
phew...! That is pretty good Jaime. Not yet there but very very close. I
wanted to explore further some ideas proposed by Marc Jacquier in his
sea code but I am not getting really anywhere. It probably is a dead
end, but worth looking into.
--
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
El 11/04/16 a las 12:54, Stephen escribió:
> I think that you are working in the right area. What sort of time
> did it take? And what is the camera's FOV? I'm just curious.
Thanks... this one took only 11 seconds to parse (because the sea HF
is only 2048x2048, versus the final one of 10240x10240), and 17 minutes
to render (yes, the derivatives pattern is not much faster than the
proximity pattern, after all).
About the camera, if you meant the angle... I don't know, I used
direction here:
up 9*y right 16*x
direction 16*z
--
jaime
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
El 11/04/16 a las 13:08, Thomas de Groot escribió:
> On 11-4-2016 12:13, Jaime Vives Piqueres wrote: phew...! That is
> pretty good Jaime. Not yet there but very very close. I wanted to
> explore further some ideas proposed by Marc Jacquier in his sea code
> but I am not getting really anywhere. It probably is a dead end, but
> worth looking into.
>
Thanks! I tried almost everything, and the only two approaches getting
some believable foam patterns are proximity and derivatives. I'm
suspecting a mix of the two would really do it...
--
jaime
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 4/11/2016 12:23 PM, Jaime Vives Piqueres wrote:
> El 11/04/16 a las 12:54, Stephen escribió:
>> I think that you are working in the right area. What sort of time
>> did it take? And what is the camera's FOV? I'm just curious.
>
> Thanks... this one took only 11 seconds to parse (because the sea HF
> is only 2048x2048, versus the final one of 10240x10240), and 17 minutes
> to render (yes, the derivatives pattern is not much faster than the
> proximity pattern, after all).
>
> About the camera, if you meant the angle... I don't know, I used
> direction here:
>
> up 9*y right 16*x
> direction 16*z
>
It looks really good full screen. I can actually see what looks like
waves that have been reflected off a shore. Amazing what the brain will
make of images. :-)
As it was a test you might have used a wide angle along the horizontal.
To get a wider view.
That's not too bad a time. I would not want to put it in an animation at
the larger resolution, though.
--
Regards
Stephen
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |