POV-Ray : Newsgroups : povray.binaries.images : Bathtub - take 2 : Re: Bathtub - take 2 Server Time
1 Aug 2024 14:32:37 EDT (-0400)
  Re: Bathtub - take 2  
From: Trevor G Quayle
Date: 19 Dec 2008 16:25:00
Message: <web.494c10106655db1881c811d20@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "alphaQuad" <alp### [at] earthlinknet> wrote:
> >
> > Today I tried to find a suitable replacement for my Lego water:
> >  <web.49472c24399f7e1d778c150@news.povray.org>
> >
> > I could not. I was able to make some watery chrome.
> >
> > I'd love to see someone find something better than f_ridge for the Lego pool.
>
> The water probably doesn't look that bad.  The issue with water that makes it
> interesting looking it what is available to reflect.  Your sky and background
> is rather simple which ends up making the reflection very simple and chromey
> looking.
>
> I always point out that reflective surfaces only look as good as what is
> available for them to reflect.
> (see :
>
http://news.povray.org/povray.binaries.images/message/%3Cweb.464c611a4ef76416c150d4c10%40news.povray.org%3E/#%3Cweb.4
64
> c611a4ef76416c150d4c10%40news.povray.org%3E
>  for an example)
>
> -tgq

The actual water (as a heightfield as in the renders):

//start
#declare ASiz=250;

#declare RHIT=0.25;
#declare FREQ=15;

#declare WDep=75;
#declare WHit=0.45;

#declare TDep=WDep+WHit+RHIT+1;

#declare TFunk1=function{max(min(abs(x),1)-0.5,0)/(1-0.5)}

#declare PPIG3= //Pool Side Ripples
  pigment {
    function{TFunk1(x,y,z)}
    pigment_map{
      [0.0 rgb 0]
      [1.0 function{TFunk1(x,y,z)} frequency ASiz/FREQ sine_wave]
    }
    scale 1/2
    poly_wave 3
    translate x*1/2
    scale 5
    warp{turbulence 0.05*x}
    scale 1/5
    warp{turbulence 0.05*x}
  }

#declare WCol=rgb <0.51373, 0.70588, 0.70588>; //Water colour
#local FD=-60/ln(0.58);                        //Fade distance

#declare RScal=1/10;
#declare RFreq=50;

#declare SRip =
function{
  pigment {
    marble
    frequency ASiz/RFreq*RScal
    scale 1/5
    warp{turbulence 1.5}
    scale 5
    warp{turbulence 0.5}
    sine_wave
    scale RScal
  }
}

#local FTILEA = function {SRip(x,y,z).gray*0.5+SRip(y,x,z).gray*0.5}
#local FTILEB = function {pigment{PPIG3 }}
#local FTILEC = function {pigment{PPIG3 rotate z*90}}

#declare aaa=WHit/TDep;
#declare bbb=RHIT/TDep;

#local FTILE = function
{FTILEA(x,y,z)*aaa+FTILEB(x,y,z).gray*bbb+FTILEC(x,y,z).gray*bbb+(1-aaa-bbb*2)}

#declare WW2=
height_field{
  function 600,600 {pattern{function{FTILE(x,y,z)}}}
  smooth
  hollow
  scale <ASiz,TDep,ASiz>
}

#declare MWater=
  material{
    texture{
      pigment{rgbt 1}
      finish{conserve_energy  diffuse 0.0  ambient 0  reflection{0 1 fresnel on
metallic 0}}
    }
    interior{
      ior 1.33
      media{
        absorption rgb 1-WCol
        density{rgb 1/FD}
      }
    }
  }

// water
intersection{
  box { <-8, -77, -8> <216, 1, 216>}
  object{WW2 translate <-10,-76,-10>}
  hollow
  material { MWater translate <-10,0,-10>}
}

//END

it can also be expressed as a normal by using modifying and using the function:

//START

#declare ASiz=250;

#declare RHIT=0.25;
#declare FREQ=15;

#declare WDep=75;
#declare WHit=0.45;

#declare TDep=WDep+WHit+RHIT+1;

#declare TFunk1=function{max(min(abs(x),1)-0.5,0)/(1-0.5)}

#declare PPIG3= //Pool Side Ripples
  pigment {
    function{TFunk1(x,y,z)}
    pigment_map{
      [0.0 rgb 0]
      [1.0 function{TFunk1(x,y,z)} frequency ASiz/FREQ sine_wave]
    }
    scale 1/2
    poly_wave 3
    translate x*1/2
    scale 5
    warp{turbulence 0.05*x}
    scale 1/5
    warp{turbulence 0.05*x}
  }

#declare WCol=rgb <0.51373, 0.70588, 0.70588>; //Water colour
#local FD=-60/ln(0.58);                        //Fade distance


#declare RScal=1/10;
#declare RFreq=50;

#declare SRip =
function{
  pigment {
    marble
    frequency ASiz/RFreq*RScal
    scale 1/5
    warp{turbulence 1.5}
    scale 5
    warp{turbulence 0.5}
    sine_wave
    scale RScal
  }
}

#local FTILEA = function {SRip(x,y,z).gray*0.5+SRip(y,x,z).gray*0.5}
#local FTILEB = function {pigment{PPIG3 }}
#local FTILEC = function {pigment{PPIG3 rotate z*90}}

#declare aaa=WHit/TDep;
#declare bbb=RHIT/TDep;

#local FTILE = function
{FTILEA(x,y,z)*aaa+FTILEB(x,y,z).gray*bbb+FTILEC(x,y,z).gray*bbb+(1-aaa-bbb*2)}


#declare THit=WHit+RHIT*2;
#local FTILE2 = function
{FTILEA(x,y,z)*WHit/THit+FTILEB(x,y,z).gray*RHIT/THit+FTILEC(x,y,z).gray*RHIT/THit}


//#declare WW2=
//height_field{
//  function 600,600 {pattern{function{FTILE(x,y,z)}}}
//  smooth
//  hollow
//  scale <ASiz,TDep,ASiz>
//}

#declare MWater=
  material{
    texture{
      pigment{rgbt 1}
      finish{conserve_energy  diffuse 0.0  ambient 0  reflection{0 1 fresnel on
metallic 0}}
      normal{function{FTILE2(x,z,y)} scale <ASiz,TDep,ASiz> bump_size 0.1}
    }
    interior{
      ior 1.33
      media{
        absorption rgb 1-WCol
        density{rgb 1/FD}
      }
    }
  }

// water
intersection{
  box { <-8, -77, -8> <216, 1, 216>}
  //object{WW2 translate <-10,-76,-10>}
  hollow
  material { MWater translate <-10,0,-10>}
}

//END

-tgq


Post a reply to this message

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