POV-Ray : Newsgroups : povray.general : location dependant refractive index : Re: location dependant refractive index Server Time
30 Jul 2024 22:25:47 EDT (-0400)
  Re: location dependant refractive index  
From: Florian Siegmund
Date: 4 Nov 2008 13:05:00
Message: <web.49108d57a1a157757293413c0@news.povray.org>
i played around with your code a bit and changed it into the following...
.....maybe this is some sort of what you are looking for.

i will post a rendered image, too. (it took my intel celeron dual core 3.2GHz 9m
18s to render it at 1024x768). look at this one if you can't wait for
discovering the scene by yourself. pixel by pixel.

so here's the code:

#include  "colors.inc"

global_settings {max_trace_level 200}


sphere {
    <0,0.25,0> ,1.5
    pigment {
        color rgb <0, 0, 0.5>
    }
    finish {ambient 0.2  diffuse 1  phong 0.9}
}

plane{
     < 0, 1, 0>, -2
     pigment {
          color White
     }
     finish {
          ambient 0.3
          diffuse 0.7
     }
}


#declare ripples_scale = 13.5;
#declare hot_air_altitude = 0.175;

#declare hot_air_ripples = normal {
    average
    normal_map {
        [bumps 3  scale <1, 0.05, 1>*ripples_scale]
        [function {atan (y/hot_air_altitude)/pi*2}]
    }
}

#declare air_square = // didn't find a better name for it :)
mesh {  // meshes render faster than planes
    triangle {(-x+y)*1000, (x-y)*1000, (-x-y)*1000}
    triangle {(-x+y)*1000, (x+y)*1000, (x-y)*1000}
}

#declare hot_air_samples = 33; // higher values = more accuracy (maybe you have
to adjust max_trace_level)

object {
    union {
        #declare I = 0;
        #while (I < hot_air_samples)
            object {
                air_square
                translate (-20+20*I/hot_air_samples)*z
            }
            #declare I = I+1;
        #end
        pigment {color rgbt 1}
        normal {
            function {atan (y/hot_air_altitude)/pi*2}
            normal_map {
                [0    hot_air_ripples 1]
                [1    function {0}]
            }
            translate -2.1*y
        }
        interior {ior 1+15/hot_air_samples}
            // 15 seems to be a very high value. but in this case it isn't. you
can try other numbers or change the bump depth in 'hot_air_ripples' instead
        no_shadow
    }
}

object {
    union {
        #declare I = 0;
        #while (I < hot_air_samples)
            object {
                air_square
                translate (-19.999+20*I/hot_air_samples)*z
            }
            #declare I = I+1;
        #end
        pigment {color rgbt 1}
        no_shadow
            // these are just additional surfaces between the refractive ones to
prevent the viewing ray from changing its bending direction
    }
}



camera {
     location  1.25*y-20*z
     direction 1.3*z
     up y
     right 4/3*x
     look_at 0
}


light_source {20*z+20*y-20*x  color White}

light_source {-20*z-20*y+20*x  color rgb 0.2  shadowless}

light_source {-100*y+50*z  color rgb 0.45  shadowless}


plane {
    -z, -10
    pigment {
        function {atan (y/hot_air_altitude)/pi*2}
        pigment_map {
            [0  color rgb 1]
            [1  color rgb SkyBlue]
        }
        scale 7.5
    }
    finish {ambient 1  diffuse 0}
    no_shadow
    translate -2*y
}


Post a reply to this message

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