POV-Ray : Newsgroups : povray.binaries.images : Inversion : Re: Inversion Server Time
19 May 2024 01:59:38 EDT (-0400)
  Re: Inversion  
From: Jaime Vives Piqueres
Date: 11 Apr 2016 06:13:36
Message: <570b78d0@news.povray.org>
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'
ocean-16.jpg


 

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