POV-Ray : Newsgroups : povray.newusers : Trying to figure out media... : Trying to figure out media... Server Time
30 Jul 2024 02:26:05 EDT (-0400)
  Trying to figure out media...  
From: Soace Munky
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

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