POV-Ray : Newsgroups : povray.general : location dependant refractive index Server Time
30 Jul 2024 20:19:45 EDT (-0400)
  location dependant refractive index (Message 15 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Florian Siegmund
Subject: Re: location dependant refractive index
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

From: Alain
Subject: Re: location dependant refractive index
Date: 4 Nov 2008 21:19:58
Message: <491102ce$1@news.povray.org>
feestje nous illumina en ce 2008-11-03 07:05 -->
> I made a version with loop. I believe it will work. only problem i heve is with
> the lighting. I want to use a plane that emits light. This is the codeI am
> using:
> 
> light_source
> { <0,0,0>, 1
>   looks_like {
>   plane {
>      z, 1000
>      pigment {
>          color White  }
>              finish {
>           ambient 1 }
> 
> }  }}
> 
> 
> it seems the only light production from this code is because of the ambient
> statement.
> 
> is it even possible to have a plane emit light?
> 
> Regards, Ruud
> 
> 
You can have any object emit light, but not with a plain scene.

For that, you need to use radiosity. In a scene with radiosity enabled, ANY 
object with a non-zero ambient value will act as a light source.
An object with a negative pigment or with a negative ambient will shed darkness.

The simplest radiosity setting is:

global_settings{radiosity{}}

In a radiosity scene, you should turn off the default ambient:

#default{finish{ambient 0 diffuse 0.9}}

Some will tell you to add "ambient_lights 0" to the global settings, but it will 
remove any ambient, and you won't be abble to use high ambient object as light 
sources.

Please consult the documentation and help files for more radiosity informations.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you see something in the real 
world and you think, "Hey! How did they get that effect?"


Post a reply to this message

From: feestje
Subject: Re: location dependant refractive index
Date: 5 Nov 2008 04:40:00
Message: <web.4911694ea1a15775934be4af0@news.povray.org>
hi all

thanks a lot Florian! I'm starting to understand the code (remember I'm a
newbie) and I like the rendering. It looks great. It isn't exactly what I'm
looking for.

Let me explain myself better. I'm trying to mimic the result of Cooper in 1984.
http://img513.imageshack.us/my.php?image=mirageeffectrg9.jpg

He submerges a bal in what I presume is water above a heater. As more water get
heated it rises up through convection. The boundary between hot and cold rises
up. When lit from behind as is often the case in bubble research he witnesses
the mirage effect. An effect I would like to make an animation of. The first
step is to see the effect in 1 frame. making an animation should be easy after
that.

I tried to use the radiosity setting but I to didn't generate the effect.
somewhere I am making a mistake. I'll keep trying to solve it.

Any help from you would be greatly appreciated!

regards, Ruud


Post a reply to this message

From: Florian Siegmund
Subject: Re: location dependant refractive index
Date: 9 Nov 2008 09:15:01
Message: <web.4916eea1a1a15775aacab8cf0@news.povray.org>
"feestje" <fee### [at] gmailcom> wrote:
> hi all
>
> thanks a lot Florian! I'm starting to understand the code (remember I'm a
> newbie) and I like the rendering. It looks great. It isn't exactly what I'm
> looking for.
>
> Let me explain myself better. I'm trying to mimic the result of Cooper in 1984.
> http://img513.imageshack.us/my.php?image=mirageeffectrg9.jpg
>
> He submerges a bal in what I presume is water above a heater. As more water get
> heated it rises up through convection. The boundary between hot and cold rises
> up. When lit from behind as is often the case in bubble research he witnesses
> the mirage effect. An effect I would like to make an animation of. The first
> step is to see the effect in 1 frame. making an animation should be easy after
> that.
>
> I tried to use the radiosity setting but I to didn't generate the effect.
> somewhere I am making a mistake. I'll keep trying to solve it.
>
> Any help from you would be greatly appreciated!
>
> regards, Ruud

Hello Ruud,
here's something new for you to work with. and i think now i'm very close to
what you have in mind.
i wrote a new, carefully commented code so to make it easy for you to understand
what i did to create the desired effect. and to make it easy for you to change
things which are not exactly the way you want them to be.
and, of course, i will also post a rendered image again. (rendering time at
1024x768: about 40m)

the code starts here:

// select as many samples as you need for getting an acceptable image,
// but think of increasing rendering time!
#declare heat_samples = 50;

#declare mirage_effect = on;

// simply change this value over time to create an animation (ideally use
// values between 0 and 0.5)
#declare hot_layer_level = 0.45;

#declare camera_location = <0, 0.2, -30>;

global_settings {
    // radiosity for a more realistic image and a 'devilly glowing' heater...
    // if you'd like to use this feature, you have to do at least
    // two render passes for the image to render correctly.
    // this is beacause radiosity is also affected by the 'mirage effect', but
    // in an undesired way.
    // turn off the mirage_effect (above) and render.
    // then turn the mirage_effect on again and replace 'save_file'
    // with 'load_file' in the radiosity settings and render a second time.
    // for every other rendering with only the hot_layer_level changing, you
    // can leave it this way.
    // for a faster rendering without radiosity, comment the following line...
    radiosity {brightness 1.7  normal on  save_file "mirage effect.rad"}
    max_trace_level heat_samples*2+2
}

camera {
    location camera_location
    up y
    right 4/3*x
    look_at 2.2*y
    angle 17.5
}

// the heater
union {
    cylinder {-y, 0, 23}
    torus {23, 5  scale 0.5*y+x+z  translate -2.5*y}
    pigment {
        bozo
        color_map {
            [0     color rgb <1, 0.8, 0.15>]
            [0.5   color rgb <1, 0.06, 0.05>]
            [1     color rgb <1, 0.8, 0.15>]
        }
        scale 4
        turbulence 1.5
        omega 0.1
        lambda 3.6
    }
    finish {ambient 7  diffuse 0.1}
}

// a small ball
sphere {
    2.4*y, 2
    pigment {color rgb <0.3, 0.3, 0.7>}
    finish {
        ambient 0
        diffuse 0.08
        specular 0.975*1.75
        roughness 0.0018
        phong 0.3*1.75
        phong_size 35
        brilliance 7
        metallic
        reflection {0.75  fresnel  metallic}
    }
    interior {ior 2.6}
}

light_source {<-20, 40, -30>  color rgb 1}

// background and foreground planes
union {
    plane {-z, -10}
    plane {z, -31}
    pigment {
        granite
        scale 2
        pigment_map {
            [0  color rgb 0.5]
            [1  color rgb 0.75]
        }
        turbulence 1
    }
    normal {
        granite 0.3
    }
}



// hot air
#declare heat_ripples = normal {
    #if (hot_layer_level > 0)  // this is only for saving your pc from trying
        // to divide through zero

        // this function doesn't describe a physically correct heat layer,
        // but it's a good visual approximation
        function {
            select (y, 1, atan (y/hot_layer_level)/pi*2)*
            select (hot_layer_level-0.05,  // if hot_layer_level < 0.05
                    // then the air is still getting hotter
                    hot_layer_level/0.05,
                    1  // else the air is hot enough
            )
        }
    #else
        function {0}  // a function for pure nothing
    #end
    // smooth turbulence, hardly noticeable
    turbulence 0.01
    omega 0.125
}

// a heat-pattern-test-plane
// (turn off the mirage_effect up above and uncomment the following lines to
// see the pattern)
/* plane {
    -z, 0
    pigment {
        #if (hot_layer_level > 0)
            function {
                select (y, 1, atan (y/hot_layer_level)/pi*2)*
                select (hot_layer_level-0.05,
                        hot_layer_level/0.05,
                        1
                )
            }
        #else
            function {0}
        #end
        color_map {
            [0  color rgb 1]
            [1  color rgb 0]
        }
    }
    finish {ambient 1  diffuse 0}
} */

#if (mirage_effect)  // if mirage effect is turned on
    // refractive spheres centered at the camera location
    #declare I = 0;
    union {
        #while (I < heat_samples)
            sphere {
                camera_location, 5+50*I/heat_samples
                // it's funny, but the viewing ray does NOT refract when it's
                // coming from
                // the inside of an object and is hitting the object's surface
                // from 'inside to outside'.
                // i don't know why, but one has to inverse the object in
                // this case, although it is already declared as 'hollow' :)
                inverse
            }
            #declare I = I+1;
        #end
        pigment {color rgbt 1}
        normal {heat_ripples 1}
        interior {ior 1+0.75/heat_samples}
        no_reflection
        no_shadow
        hollow
    }

    // non-refractive spheres, slightly larger than the refractive ones
    #declare I = 0;
    union {
        #while (I < heat_samples)
            sphere {camera_location, 5.0001+50*I/heat_samples  inverse}
            #declare I = I+1;
        #end
        pigment {color rgbt 1}
        no_reflection
        no_shadow
        hollow
    }
#end


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: location dependant refractive index
Date: 9 Nov 2008 09:27:58
Message: <4916f36e@news.povray.org>
Florian Siegmund wrote:
>                 // this case, although it is already declared as 'hollow' 

'hollow' does absolutely nothing unless you're using media. I don't see any
media in your code.


Post a reply to this message

From: Alain
Subject: Re: location dependant refractive index
Date: 10 Nov 2008 22:21:47
Message: <4918fa4b$1@news.povray.org>
Nicolas Alvarez nous illumina en ce 2008-11-09 09:28 -->
> Florian Siegmund wrote:
>>                 // this case, although it is already declared as 'hollow' 
> 
> 'hollow' does absolutely nothing unless you're using media. I don't see any
> media in your code.
In some ceses, i use it for only onr reason: get rid of that anoying warning...
"camera is inside a non-hollow object...."

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you can draw things quicker in 
POV-Ray than you can using a pencil and paper.
     -- Dylan Beattie


Post a reply to this message

From: Warp
Subject: Re: location dependant refractive index
Date: 11 Nov 2008 11:01:35
Message: <4919ac5f@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> In some ceses, i use it for only onr reason: get rid of that anoying warning...
> "camera is inside a non-hollow object...."

  Why do you want to get rid of the warning?

  The warning is actually often a sign of dubious scene design. It's rare to
purposefully put the camera inside an object. And even if you do it
purposefully, at least the warning is giving you some useful information.

-- 
                                                          - Warp


Post a reply to this message

From: Kenneth
Subject: Re: location dependant refractive index
Date: 11 Nov 2008 17:20:01
Message: <web.491a03eaa1a1577578dcad930@news.povray.org>
Alain <ele### [at] netscapenet> wrote:


> In a radiosity scene, you should turn off the default ambient:
>
> #default{finish{ambient 0 diffuse 0.9}}
>

Yes, true, when no object in the scene has a user-supplied texture or finish.
But if an object does have a (non-default) finish of its own, then creating a
#default finish will not override that one.  That may be confusing to newbies;
it was to me.

Ken W.


Post a reply to this message

From: feestje
Subject: Re: location dependant refractive index
Date: 17 Nov 2008 06:15:01
Message: <web.49215161a1a1577518112fe00@news.povray.org>
WOW! thanks a lot! that looks great! exact;y what I want! now let's see if I can
understand! many many thanks!


Post a reply to this message

From: feestje
Subject: Re: location dependant refractive index
Date: 17 Nov 2008 07:35:01
Message: <web.492164dea1a1577518112fe00@news.povray.org>
so, I'm looking trough the code and I don't understand why you are building
circles around the camara position. The hot layer is not modeled as a layer,
but rather a set of points on the camara circles? Please enlighten me on the
general idea of the rendering.

Regards Ruud

ps is it possible to make a executable of the rendering process so I could send
it to a supercomputer here? Or does povray need to be installed?


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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