POV-Ray : Newsgroups : povray.newusers : Trying to figure out media... Server Time
1 Nov 2024 23:13:35 EDT (-0400)
  Trying to figure out media... (Message 1 to 3 of 3)  
From: Soace Munky
Subject: Trying to figure out media...
Date: 2 Nov 2004 00:34:55
Message: <41871c7f@news.povray.org>
...through some confusing methods...

Im trying to model a bubble full of semi-transparant, absorbing and 
filtering/transmitting media; inside a (as of yet invisible) container 
full of maybe murky water.
What I think I cant figure out, is how to properly create and light the 
boudary between the air of the bubbles, and the water. Or maybe the film 
of the water on top of air? I know its similar to looking up through the 
surface of the water, but I havnt been able to achieve the full effect. 
I've spent a lot of time in the water, and its hard to apply the 
technique in POVray, to what I think is actually happening (having 
briefly looked into the effect, and its properties).
heres the source, im trying to find a place to put them on the web, 
since i havnt fully mastered news groups yet, this might take a few mins...
thanks for any help.
Drey.


#version 3.6;
//#version unofficial megapov 1.1;

global_settings {  assumed_gamma 1.0
                    noise_generator 2
                    max_trace_level 5
}

#include "colors.inc"
#include "functions.inc"
#include "bubble.inc"

camera {
   //location  <-1,1.8,-3.5>
   location <0,2.5,7>
   look_at   <1,0,0>
   rotate 35*y
}
// sun ---------------------------------------------------------------------
light_source{< -3000, 3000, -3000> color White}
// sky ---------------------------------------------------------------------
sky_sphere { pigment { gradient <0,1,0>
                        color_map { [0.00 rgb <0.6,0.7,1.0>]
                                    [0.35 rgb <0.0,0.1,0.8>]
                                    [0.65 rgb <0.0,0.1,0.8>]
                                    [1.00 rgb <0.6,0.7,1.0>]
                                  }
                        scale 2
                      }
            }

/*#macro Axis_( AxisLen, RedTexture,WhiteTexture)
union{
     cylinder {<0,-AxisLen,0>,<0,AxisLen,0>,0.05
               texture{checker texture{RedTexture}
                               texture{WhiteTexture}
                       translate<0.1,0,0.1>}}
     cone{<0,AxisLen,0>,0.2,<0,AxisLen+0.7,0>,0
          texture{RedTexture}}
      } // end of union
#end // of macro "Axis( )"
//--------------------------------------------------------------------------
#macro AxisXYZ( AxisLenX, AxisLenY, AxisLenZ, TexRed, TexWhite)
//-------------------------- drawing 3 axes --------------------------------
union{
    object{Axis_(AxisLenX, TexRed, TexWhite)   rotate< 0,0,-90>}   // x axis
    object{Axis_(AxisLenY, TexRed, TexWhite)   rotate< 0,0,  0>}   // y 
axis
    object{Axis_(AxisLenZ, TexRed, TexWhite)   rotate<90,0,  0>}   // z axis
//---------------------- names of the axes ---------------------------------
    text{ ttf"arial.ttf",  "x",  0.15,  0  texture{TexRed}
          scale 0.5 translate <AxisLenX+0.05,0.4,-0.10>}
    text{ ttf"arial.ttf",  "y",  0.15,  0  texture{TexRed}
          scale 0.5 translate <-0.75,AxisLenY+0.50,-0.00>}
    text{ ttf"arial.ttf",  "z",  0.15,  0  texture{TexRed}
          scale 0.5 translate <-0.75,0.2,AxisLenZ+0.50>}
} // end of union
#end// of macro
//-------------------------------------------------------------------------- 

object{AxisXYZ (3,3,3,
                 texture{ pigment{rgb<1,0,0>} finish{diffuse 0.8 phong 1}},
                 texture{ pigment{rgb<1,1,1>} finish{diffuse 0.8 phong 1}})
        } // end of axes
*/
// ground ------------------------------------------------------------------
//


plane {
         y,-1
         material {checkerz}
}

#declare X=rand(R1)/3;
#declare Y=rand(R1)/3;
#declare Z=rand(R1)/5;
#declare X1=rand(R2)/3;
#declare Y1=rand(R2)/3;
#declare Z1=rand(R2)/5;
#declare X2=rand(R3)/3;
#declare Y2=rand(R3)/3;
#declare Z2=rand(R3)/5;

#declare Media =
media
      {
      emission 1
      density
        { spherical density_map
          { [0.0 rgb 0]
            [0.25 rgb <1,0,0>]
            [0.5 rgb <1,1,0>]
            [0.75 rgb <0,1,0>]
            [1.0 rgb <0,1,1>]
            [1.25 rgb <0,0,1>]
          }
        }
      }
#declare Media1 =
media
      {
         scattering {1}
         //aa_level     : 4
         //aa_threshold : 0.1
         //absorption   : <0,0,0>
         //confidence   : 0.9
         //emission     : <0,0,0>
         //intervals    : 10
         //method       : 3
         //ratio        : 0.9
         //samples      : Min 1, Max 1
         //variance     : 1/128
         //SCATTERING
         //        COLOR        : <0,0,0>
         //        eccentricity : 0.0
         //        extinction   : 1.0
      }

#declare water =
material
    {texture{pigment{color rgbf <0.9, 0.9, 1.0, 0.9>}
          /*finish
                 {
                 ambient 0.1
                 phong 1.0
                 phong_size 100.0
                 reflection 0.4
                 }*/
         }
       interior
                 {
                 ior 1.33
                 }
    }

//box{<-2,-1,-1><2,1,-1.5> scale 2 }

difference {
box {<-2,-1,-1><2,1,1>
      material {water}
      }

isosurface
         {                    //Experiment
         function {f_sphere(x, y, z, .9)+f_noise3d(x+X, y+Y, z+Z)}
         contained_by {sphere {< 0, 0, 0>, 1}}
         max_trace 4
         max_gradient 1.6
         material
                 {
                 texture
                         {
                         pigment {color rgbf <0,0,0,0,1>}
                         //finish { diffuse 0.2 specular 0.6 }
                         }
                 }
         interior
                 {
                 media
                         {
                         absorption rgb<1,1,0>
                         //emission rgb <1,0,0>
                         }
                 }
         hollow
         translate 1*x

         }

isosurface
         {                    //control
         function {f_sphere(x, y, z, .9)+f_noise3d(x+X, y+Y, z+Z)}
         contained_by {sphere {< 0, 0, 0>, 1}}
         material
                 {
                 texture
                         {
                         pigment {color rgbf <0,0,0,0,1>}
                         //finish { diffuse 0.2 specular 0.6 }
                         }
                 }
         interior
                 {
                 media
                         {
                         scattering {2}
                         density
                                 {
                                 turbulence
                                 10
                                 }
                         }
                 ior -1
                 caustics 1
                 }
         hollow
         translate -1*x
         }

hollow
scale 2
}


Post a reply to this message

From: Soace Munky
Subject: Re: Trying to figure out media...
Date: 2 Nov 2004 01:20:39
Message: <41872737@news.povray.org>
I've tried changing ior to an inverse vaule, that resulted in a wierd, 
inverted reflection in, i guess, the bubble of air.
im still looking for places to upload...any tips?


Post a reply to this message

From: Bob Hughes
Subject: Re: Trying to figure out media...
Date: 4 Dec 2004 18:57:28
Message: <41b24ee8@news.povray.org>
"Soace Munky" <alu### [at] gmailcom> wrote in message 
news:41872737@news.povray.org...
> I've tried changing ior to an inverse vaule, that resulted in a wierd, 
> inverted reflection in, i guess, the bubble of air.
> im still looking for places to upload...any tips?

I managed to render your script, minus the bubble.inc, plus seed() for the 
random numbers. Obviously you're trying to get air bubbles to render 
technically accurate or realistic. Fresnel reflection is most likely needed 
in the water 'finish'. By having a different refraction (ior of air) for the 
bubble (isosurface) it might be correct. As it stands now you only have 
water refraction throughout. And you put media inside the air bubbles 
instead of into the water, and it's the water you need to make murkier with 
clear air in the bubbles.

You can post the files to povray.binaries.scene-files, after joining or 
subscribing to that group like you did for this one. Just "attach" them to 
the message (never attach files to non-"binaries" groups). There's also the 
povray.text.scene-files group for text-only scene files put into the message 
body.

Sorry for replying a month later, I haven't been here much these past few 
months. Surprised to see no one else replied. Hope you had some success 
yourself in the meantime.

Check the changes to your script below. BTW, you had used only rgbf for 
rgbft color vectors.

Bob H.

/* water air bubbles */

global_settings {  assumed_gamma 1.0
                    noise_generator 2
                    max_trace_level 5
}

#include "colors.inc"
#include "functions.inc"

#declare Bubble=sphere {0,1}

camera {
   location <0,2.5,7>
   look_at   <1,0,0>
   rotate 35*y
}
// sun ---------------------------------------------------------------------
light_source{< -3000, 3000, -3000> color White}
// sky ---------------------------------------------------------------------
sky_sphere { pigment { gradient <0,1,0>
                        color_map { [0.00 rgb <0.6,0.7,1.0>]
                                    [0.35 rgb <0.0,0.1,0.8>]
                                    [0.65 rgb <0.0,0.1,0.8>]
                                    [1.00 rgb <0.6,0.7,1.0>]
                                  }
                        scale 2
                      }
            }

// ground ------------------------------------------------------------------
plane {
         y,-1
         material {texture {pigment {checker rgb 0 rgb 1}}}
}

#local R1=seed(123);
#local R2=seed(321);
#local R3=seed(231);

#declare X=rand(R1)/3;
#declare Y=rand(R1)/3;
#declare Z=rand(R1)/5;
#declare X1=rand(R2)/3;
#declare Y1=rand(R2)/3;
#declare Z1=rand(R2)/5;
#declare X2=rand(R3)/3;
#declare Y2=rand(R3)/3;
#declare Z2=rand(R3)/5;

#declare water =
material
    {texture{pigment{color rgbf <0.9, 0.9, 1.0, 0.9>}
          finish
                 {
                 ambient 0 diffuse 0
                 phong 1.0
                 phong_size 100.0
                 reflection {0,0.9 fresnel on}
                 conserve_energy
                 }
         }
       interior
                 {
                 ior 1.33
                 media
                         {
                         absorption rgb<0.9,0.6,0.3>/3
                         //emission rgb <1,0,0>
                         scattering {3,0.01}
                         }
                 }
    }

difference {
box {<-2,-1,-1><2,1,1>
      material {water}
      }

isosurface
         {                    //Experiment
         function {f_sphere(x, y, z, .9)+f_noise3d(x+X, y+Y, z+Z)}
         contained_by {sphere {< 0, 0, 0>, 1}}
         max_trace 4
         max_gradient 1.6
         material
                 {
                 texture
                         {
                         pigment {color rgbft <0,0,0,0,1>}
                         //finish { diffuse 0.2 specular 0.6 }
                         }
                 }
         interior
                 {
                    ior 1.002
                 }
         hollow
         translate 1*x

         }

isosurface
         {                    //control
         function {f_sphere(x, y, z, .9)+f_noise3d(x+X, y+Y, z+Z)}
         contained_by {sphere {< 0, 0, 0>, 1}}
         material
                 {
                 texture
                         {
                         pigment {color rgbft <0,0,0,0,1>}
                         //finish { diffuse 0.2 specular 0.6 }
                         }
                 }
         interior
                 {
                 media
                         {
                         scattering {2}
                         density
                                 {
                                 turbulence
                                 10
                                 }
                         }
                 ior 1
                 caustics 1
                 }
         hollow
         translate -1*x
         }

hollow
scale 2
}


Post a reply to this message

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