POV-Ray : Newsgroups : povray.animations : Isosurface 'water' but it goes concave : Re: Isosurface 'water' but it goes concave Server Time
28 Jul 2024 10:18:52 EDT (-0400)
  Re: Isosurface 'water' but it goes concave  
From: Mike Williams
Date: 8 Jul 2001 02:22:02
Message: <uufgGCA8i8R7Ewb7@econym.demon.co.uk>
Wasn't it John D. Gwinner who wrote:
>Folks:
>
>  (modification of post in general)
>
>  I'm trying to figure out the best way to do an aquarium.  I want to show
>the 'ripple pattern' of light moving across the top surface of the water.  I
>want this to be in effect
>a clear block (with an IOR) with a 'wavy' top surface.
>
>  The closest I have so far is an Isosurface, which looks good but when I
>animate it I get something odd: 'phase' identifier in the wrinkles (or waves
>or ripples) causes the surface to move *down* not across, so it causes a
>concavity.  I tried different combinations of functions, rotations, etc. and
>it doesn't seem to work.   An example - I replaced 'clock' in the phase with
>a .5 so you can see what it looks like.
>
>  It's a neat effect but it's not what I'm looking for ;-)
>
>  Any suggestions?

First let me tell you what's happening. The main awkward effect seems to
be that the wrinkles pattern produces values that are centred around
(phase + 0.5). So, when phase is zero you get numbers close to 0.5 which
is in the middle of the colour_map, but when phase is 0.5 you get
numbers that are close to 1.0 which is at the edge of the colour_map
where there's a sharp colour transition.

To see this, forget about the isosurface for a moment, and just paint
the wrinkle pigment onto a sphere

sphere {0,1
    pigment {wrinkles phase 0.5 // clock
        color_map {[0 color rgb 0][1 color rgb 1]
        }

    turbulence .1
    }
}

When the phase is 0.0 you get gentle modulations of grey tones, but when
the phase is 0.5 you get black and white patches, as the numbers fall
off the end of the colour_map.

My rather inelegant fix for this would be to modify the colour_map with
the clock so that the output is centred in mid grey, like this

#declare my_clock = 0;

sphere {0,1
    pigment {ripples  phase my_clock// clock
        color_map {[my_clock-1 color rgb 1]
                   [my_clock   color rgb 0]
                   [my_clock+1 color rgb 1]
        }
    turbulence .1
    }
}


Once the pigment is behaving itself sensibly, we can bung that
colour_map back into the isosurface function

#declare WrinklesFunc =
function {
    pigment {wrinkles phase my_clock // clock
        color_map {[my_clock-1 color rgb 1]
                   [my_clock   color rgb 0]
                   [my_clock+1 color rgb 1]
        }

    turbulence .1
    }
}


A second effect that was happening was that the black/white transitions
caused very sharp gradients in the function, and this exceeded the
default max_gradient. This shouldn't happen any more, but if it does you
can add "method 2 eval" to the isosurface to fix it.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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