POV-Ray : Newsgroups : povray.binaries.images : Ocean Server Time
3 May 2024 04:00:02 EDT (-0400)
  Ocean (Message 62 to 71 of 71)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Jaime Vives Piqueres
Subject: Re: Ocean
Date: 7 Apr 2016 11:13:32
Message: <5706791c$1@news.povray.org>
El 07/04/16 a las 16:54, clipka escribió:
> Then again, I must concede that this idea crumbles if the peaks
> aren't perfectly sharp after all.

   Well, the function heighfield I'm using is surely having flat
triangles there. For perfectly sharp crests I guess I would have to use
crazy resolutions.

> Let's take a step backward:
>
> What you want is foam at the crests, i.e. near local maxima.
>
> Local maxima can be identified by a zero 1st derivative (aka slope)
> and negative 2nd derivative (aka curvature).
>
> It should be possible to analyze the f_ridged_mf() function in order
> to construct the 1st and 2nd derivative functions, and use the
> resulting functions as a basis for a foam pattern. (If you want to
> avoid function analysis, you could still design functions for the
> slope and curvature that effectively take samples from the original
> function.)
>

   :O ...that's a too advanced approach for me: I barely passed maths at
school.

--
jaime


Post a reply to this message

From: Cousin Ricky
Subject: Re: Ocean
Date: 8 Apr 2016 00:50:01
Message: <web.5707376e42d9a4ace5b326b50@news.povray.org>
Jaime Vives Piqueres <jai### [at] ignoranciaorg> wrote:
> El 07/04/16 a las 16:54, clipka escribió:
> > Then again, I must concede that this idea crumbles if the peaks
> > aren't perfectly sharp after all.
>
>    Well, the function heighfield I'm using is surely having flat
> triangles there. For perfectly sharp crests I guess I would have to use
> crazy resolutions.

If you test the function instead of the height field, that won't be a problem.

> > Let's take a step backward:
> >
> > What you want is foam at the crests, i.e. near local maxima.
> >
> > Local maxima can be identified by a zero 1st derivative (aka slope)
> > and negative 2nd derivative (aka curvature).
> >
> > It should be possible to analyze the f_ridged_mf() function in order
> > to construct the 1st and 2nd derivative functions, and use the
> > resulting functions as a basis for a foam pattern. (If you want to
> > avoid function analysis, you could still design functions for the
> > slope and curvature that effectively take samples from the original
> > function.)
> >
>
>    :O ...that's a too advanced approach for me: I barely passed maths at
> school.

My instinct would be to avoid the analysis approach, and do sampling on the
original function.  That doesn't take a lot of sophisticated math.  I can't even
remember the chain rule without looking it up (and the last time I did so was,
like, 2005), but I have used sampling to estimate normals on a form based on
parametric functions.  I did this for the smooth triangles of the elliptical
toroids in RoundEdge.  Normals, of course, can be easily converted to slopes.

Sampling won't get you the 2nd derivative, but it will tell you whether it's
positive or negative, which is enough for clipka's plan.


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Ocean
Date: 8 Apr 2016 03:49:10
Message: <57076276$1@news.povray.org>

> My instinct would be to avoid the analysis approach, and do sampling
> on the original function.  That doesn't take a lot of sophisticated
> math.  I can't even remember the chain rule without looking it up
> (and the last time I did so was, like, 2005), but I have used
> sampling to estimate normals on a form based on parametric functions.
> I did this for the smooth triangles of the elliptical toroids in
> RoundEdge.  Normals, of course, can be easily converted to slopes.
>

   I'm still trying to grasp the concept of "sampling a function"... how
I would do that? With another function? If someone can please post a
simple example...

--
jaime


Post a reply to this message

From: clipka
Subject: Re: Ocean
Date: 8 Apr 2016 08:24:32
Message: <5707a300$1@news.povray.org>
Am 08.04.2016 um 09:49 schrieb Jaime Vives Piqueres:

>> My instinct would be to avoid the analysis approach, and do sampling
>> on the original function.  That doesn't take a lot of sophisticated
>> math.  I can't even remember the chain rule without looking it up
>> (and the last time I did so was, like, 2005), but I have used
>> sampling to estimate normals on a form based on parametric functions.
>> I did this for the smooth triangles of the elliptical toroids in
>> RoundEdge.  Normals, of course, can be easily converted to slopes.
>>
> 
>   I'm still trying to grasp the concept of "sampling a function"... how
> I would do that? With another function? If someone can please post a
> simple example...

// Base function
#declare Fn = function(x,y) { /* whatever */ }

#declare EPSILON = 1e-6;

// Approximate first derivatives along the x and y axes
#declare Fn1X = function(x,y)
  { (Fn(x+EPSILON,y)-Fn(x-EPSILON,y))/EPSILON }
#declare Fn1Y = function(x,y)
  { (Fn(x,y+EPSILON)-Fn(x,y-EPSILON))/EPSILON }

// Approximate second derivatives along the x and y axes
#declare Fn2X = function(x,y)
  { (Fn1X(x+EPSILON,y)-Fn1X(x-EPSILON,y))/EPSILON }
#declare Fn2Y = function(x,y)
  { (Fn1Y(x,y+EPSILON)-Fn1Y(x,y-EPSILON))/EPSILON }

Note how the first derivative functions effectively "sample" the base
function at two points, and the second derivative functions do the same
for the first derivative functions.

(Also note that this formulation of the second derivative is
inefficient, as it results in sampling the base function four times:
Once at an offset of -2*EPSILON, once at an offset of +2*EPSILON, and
twice at an offset of 0; computing the second derivative directly from
samples of the base function could reduce this to three samples.)

The slope can then be computed from the first derivatives, and the
curvature from the second derivatives, both of which I leave as an
exercise to the reader (academic parlance for "I don't have the patience
to figure it out" ;))


Post a reply to this message

From: Jérôme M. Berger
Subject: Re: Ocean
Date: 8 Apr 2016 13:21:49
Message: <5707e8ad$1@news.povray.org>
On 04/08/2016 02:24 PM, clipka wrote:
> Am 08.04.2016 um 09:49 schrieb Jaime Vives Piqueres:
>> El 08/04/16 a las 06:45, Cousin Ricky escribió:
>>> My instinct would be to avoid the analysis approach, and do sampling
>>> on the original function.  That doesn't take a lot of sophisticated
>>> math.  I can't even remember the chain rule without looking it up
>>> (and the last time I did so was, like, 2005), but I have used
>>> sampling to estimate normals on a form based on parametric functions.

>>> I did this for the smooth triangles of the elliptical toroids in
>>> RoundEdge.  Normals, of course, can be easily converted to slopes.
>>>
>>
>>   I'm still trying to grasp the concept of "sampling a function"... ho
w
>> I would do that? With another function? If someone can please post a
>> simple example...
> 
> // Base function
> #declare Fn = function(x,y) { /* whatever */ }
> 
> #declare EPSILON = 1e-6;
> 
> // Approximate first derivatives along the x and y axes
> #declare Fn1X = function(x,y)
>   { (Fn(x+EPSILON,y)-Fn(x-EPSILON,y))/EPSILON }
> #declare Fn1Y = function(x,y)
>   { (Fn(x,y+EPSILON)-Fn(x,y-EPSILON))/EPSILON }
> 
> // Approximate second derivatives along the x and y axes
> #declare Fn2X = function(x,y)
>   { (Fn1X(x+EPSILON,y)-Fn1X(x-EPSILON,y))/EPSILON }
> #declare Fn2Y = function(x,y)
>   { (Fn1Y(x,y+EPSILON)-Fn1Y(x,y-EPSILON))/EPSILON }
> 
	There's a missing (2*..) in all formulas. It should be:

#declare Fn1X = function(x,y)
  { (Fn(x+EPSILON,y)-Fn(x-EPSILON,y))/(2*EPSILON) }

	and the same for the others. OTOH if all you want is to know whether it
is positive or negative then you can drop the whole "/EPSILON".

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: clipka
Subject: Re: Ocean
Date: 8 Apr 2016 13:37:47
Message: <5707ec6b$1@news.povray.org>
Am 08.04.2016 um 19:21 schrieb Jérôme M. Berger:

> 	There's a missing (2*..) in all formulas. It should be:
> 
> #declare Fn1X = function(x,y)
>   { (Fn(x+EPSILON,y)-Fn(x-EPSILON,y))/(2*EPSILON) }

Indeed. My bad.


Post a reply to this message

From: Sven Littkowski
Subject: Re: Ocean
Date: 23 Feb 2017 10:42:27
Message: <58af02e3$1@news.povray.org>
Hi Jaime,

just following up: how far are you with this amazing scene? Still
interested in the scene code as I want to use your way to create a
realistic ocean surface in some maritime scenes.

Sven





On 02.04.2016 02:36, Jaime Vives Piqueres wrote:
> El 01/04/16 a las 22:45, Sven Littkowski escribió:
>> This is the most realistic ocean I have seen so far! Will you
>> publish the scene source code?
> 
>   Thanks... of course, sources will be published once I finish fiddling
> with it.
> 
>> Just the sky is pink and some dust does not allow to see very far, so
>> it seems.
> 
>   Well, the sky is from CIE_Skylight.inc, and yes, I've never been very
> satisfied with the pinkish coloring at horizon. On the first image is
> less noticeable as I lowered the white point to 4000K.
> 
>   The dust/haze is on purpose, to hide the fact that the sea is a mesh
> with a finite resolution.
> 
> -- 
> jaime
>


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Ocean
Date: 23 Feb 2017 16:51:56
Message: <58af597c$1@news.povray.org>
El 23/02/17 a las 16:42, Sven Littkowski escribió:
> Hi Jaime,
>
> just following up: how far are you with this amazing scene? Still
> interested in the scene code as I want to use your way to create a
> realistic ocean surface in some maritime scenes.

   I'm sorry but I've not worked on it since then... it's been on my
"pending to clean and publish" folder for months. Let's see if I can do
that this weekend...

--
Jaime


Post a reply to this message

From: Sven Littkowski
Subject: Re: Ocean
Date: 25 Feb 2017 18:52:12
Message: <58b218ac$1@news.povray.org>
That would be wonderful. I am looking forward, and I am sure, many
others do, too.   :-)






On 23.02.2017 16:51, Jaime Vives Piqueres wrote:
> El 23/02/17 a las 16:42, Sven Littkowski escribió:
>> Hi Jaime,
>>
>> just following up: how far are you with this amazing scene? Still
>> interested in the scene code as I want to use your way to create a
>> realistic ocean surface in some maritime scenes.
> 
>   I'm sorry but I've not worked on it since then... it's been on my
> "pending to clean and publish" folder for months. Let's see if I can do
> that this weekend...
> 
> -- 
> Jaime
> 
>


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Ocean
Date: 27 Feb 2017 12:10:28
Message: <58b45d84@news.povray.org>
El 23/02/17 a las 22:51, Jaime Vives Piqueres escribió:
> El 23/02/17 a las 16:42, Sven Littkowski escribió:
>> Hi Jaime,
>>
>> just following up: how far are you with this amazing scene? Still
>> interested in the scene code as I want to use your way to create a
>> realistic ocean surface in some maritime scenes.
>
> I'm sorry but I've not worked on it since then... it's been on my
> "pending to clean and publish" folder for months. Let's see if I can
>  do that this weekend...
>

   Hmmm... not much luck this weekend: seems I made a mess of the code
with later tests, and I'm still trying to get something as good as the
images I posted here. :( ...will keep working on it this week if I can
find some free time.

--
jaime


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.