POV-Ray : Newsgroups : povray.general : location dependant refractive index Server Time
30 Jul 2024 20:17:41 EDT (-0400)
  location dependant refractive index (Message 11 to 20 of 24)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>
From: Chris B
Subject: Re: location dependant refractive index
Date: 3 Nov 2008 09:50:25
Message: <490f0fb1$1@news.povray.org>
"feestje" <fee### [at] gmailcom> wrote in message 
news:web.490ee8fda1a15775934be4af0@news.povray.org...
> 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?

The 'looks_like' keyword adds an object with no shadow that represents what 
the light_source (which is normally invisible) looks like from the outside. 
A plane has an inside and an outside, as determined by the surface normal 
specified, so, in this case, unless your camera is at a position where 
z>1000 then it's going to be inside the plane along with the light_source, 
which gives you your first problem. Secondly the object specified using the 
'looks_like' keyword doesn't change the way the light_source illuminates the 
rest of the scene, so you'll still get light of the color specified in the 
light_source definition eminating from the location specified (ie a point 
source).

If your camera is somewhere near the origin then I suspect you need to 
adjust your plane to -z,-1000, so that the front surface is in the same 
place but so that everything beyond z*1000 is inside it, then move your 
light_source inside it (e.g. to <0,0,1001>).
To get the light to come from a broader area than a single point source you 
might want to look at using an area_light. If you want the rays to come in 
parallel you may want to check out the 'parallel' keyword in the help.

Regards,
Chris B.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: location dependant refractive index
Date: 4 Nov 2008 04:29:55
Message: <49101613$1@news.povray.org>
feestje wrote:

> is it even possible to have a plane emit light?

you need to use radiosity if you wish the high ambient of
your plane to actually light other objects. However, that can
be quite painful to use, especially for your outdoor scene
which may have enough other issues with all those stacked
refracting planes. You could also try MCPov, which uses a
different (easier to use) technique for global illumination.


Post a reply to this message

From: Chris B
Subject: Re: location dependant refractive index
Date: 4 Nov 2008 05:15:30
Message: <491020c2$1@news.povray.org>
Hi Ruud,
I'm guessing that the newsgroup server went down yesterday and that you may 
not have seen my response to your posting. By the same measure, my newreader 
doesn't show your second posting (the full SDL listing). If I'm right you 
can see my response here:

http://news.povray.org/povray.general/thread/%3Cweb.490b1bcd2c217504934be4af0%40news.povray.org%3E/?mtop=288261&moff=10

Regards,
Chris B.


Post a reply to this message

From: Chris B
Subject: Re: location dependant refractive index
Date: 4 Nov 2008 05:28:12
Message: <491023bc$1@news.povray.org>
> I'm guessing that the newsgroup server went down yesterday
I take that back. I think it's just my mind playing tricks on me.


Post a reply to this message

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

<<< Previous 10 Messages Goto Latest 10 Messages Next 4 Messages >>>

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