Simulating a focusing light beam in POV-ray

Simulating a focusing light beam in POV-ray

Post by Kave » Wed, 25 Sep 2002 21:37:21



As part of an optics drawing package, I want to simulate a point object
being focused by a lens onto an image point, i.e. the 3D equivalent of a
ray diagram. So what I need is a cone of light. Please note that I am
not using photons (that might come later).

My problem is to choose the correct lighting, texture, interior, etc,
for the light cone. Here are some of the specifications that I can think
of for the cone:

1. Must not cast shadow
2. Must not show shadow of other objects.
3. Should allow different coloring, e.g. blue light, red light, etc.

I have uploaded my trial pov file, and the result, as follows:

http://homepage.mac.com/kaveh1000/.cv/kaveh1000/Public/lens.jpg-binhex.h
qx

http://homepage.mac.com/kaveh1000/.cv/kaveh1000/Public/lens.pov-binhex.h
qx

I would appreciate any comments or hints.

(By the way, feel free to download the povray documentation in pdf form,
in the same directory.)
--
Kaveh

 
 
 

Simulating a focusing light beam in POV-ray

Post by Micha Rise » Wed, 25 Sep 2002 22:25:21



> As part of an optics drawing package, I want to simulate a point object
> being focused by a lens onto an image point, i.e. the 3D equivalent of a
> ray diagram. So what I need is a cone of light. Please note that I am
> not using photons (that might come later).

for photons see optics.pov

Quote:

> My problem is to choose the correct lighting, texture, interior, etc,
> for the light cone. Here are some of the specifications that I can think
> of for the cone:

> 1. Must not cast shadow
> 2. Must not show shadow of other objects.
> 3. Should allow different coloring, e.g. blue light, red light, etc.

either:
pigment{rgbt <1,.3,.4,.5> finish{ambient 1 diffuse 0}}

or more realistic with media:
material{
  pigment{rgbt 1}
  interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}

Quote:}

(and don't forget to make the cone hollow)

- Micha

 
 
 

Simulating a focusing light beam in POV-ray

Post by Kave » Wed, 25 Sep 2002 23:05:49


[...]

Quote:> either:
> pigment{rgbt <1,.3,.4,.5> finish{ambient 1 diffuse 0}}

> or more realistic with media:
> material{
>   pigment{rgbt 1}
>   interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}
> }
> (and don't forget to make the cone hollow)

Oh, the second one is beautiful. Thank you. I need to do some homework
on all these parameters, but this is a great tutorial.

Only thing is that at the points, the cone fades away. How would I give
the surface just a little visibility so there is always something
visible?

Kaveh

 
 
 

Simulating a focusing light beam in POV-ray

Post by Kave » Wed, 25 Sep 2002 23:44:33


[...]

Quote:> either:
> pigment{rgbt <1,.3,.4,.5> finish{ambient 1 diffuse 0}}

> or more realistic with media:
> material{
>   pigment{rgbt 1}
>   interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}
> }
> (and don't forget to make the cone hollow)

When I put a plane behind the scene, e.g.

plane {z,2
       pigment{color Brown}
       }

the cones disappear altogether. This does not happen when I put a box
behind. Why is this?

--
Kaveh

 
 
 

Simulating a focusing light beam in POV-ray

Post by Micha Rise » Wed, 25 Sep 2002 23:47:58



> Only thing is that at the points, the cone fades away. How would I give
> the surface just a little visibility so there is always something
> visible?

You can combine the two methods I showed:

material{
  pigment{rgbt <1,1,0,0.9>} finish{ambient 3 diffuse 0}
  interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}

Quote:}

This will make it at least <0.3,0.3,0> everywhere.

- Micha

--
http://www.povworld.org - The POV-Ray Object Collection

 
 
 

Simulating a focusing light beam in POV-ray

Post by Micha Rise » Wed, 25 Sep 2002 23:52:42



> plane {z,2
>        pigment{color Brown}
>        }

> the cones disappear altogether. This does not happen when I put a box
> behind. Why is this?

You probably got following warning:
"Warning: Camera is inside a non-hollow object. Fog and participating media
may not work as expected."

Note that the plane has an inside as well (Everything on one of the sides
of the plane). So you need to make it either hollow or inverse it.

 
 
 

Simulating a focusing light beam in POV-ray

Post by Kave » Thu, 26 Sep 2002 01:24:19


[...]

Quote:> You probably got following warning:
> "Warning: Camera is inside a non-hollow object. Fog and participating media
> may not work as expected."

> Note that the plane has an inside as well (Everything on one of the sides
> of the plane). So you need to make it either hollow or inverse it.

You're right again. I'm learning a lot here. :-)

--
Kaveh

 
 
 

Simulating a focusing light beam in POV-ray

Post by Kave » Thu, 26 Sep 2002 01:24:19


[...]

Quote:> You can combine the two methods I showed:

> material{
>   pigment{rgbt <1,1,0,0.9>} finish{ambient 3 diffuse 0}
>   interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}
> }

> This will make it at least <0.3,0.3,0> everywhere.

I get an error, which disappears when I put the pigment and finish
outside material, like this:

   pigment{rgbt <1,1,0,0.9>} finish{ambient 3 diffuse 0}
   material{
   interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}
           }

Is this right?

Actually, one of the things I have a lot of trouble with is what belongs
where in these attributes. I think it is partly because povray is
forgiving and allows some shortcuts. Are you aware of a definitive
tutorial that explains this, i.e. the logic of the nesting of pigment,
interior, texture, material, etc?

--
Kaveh

 
 
 

Simulating a focusing light beam in POV-ray

Post by Micha Rise » Thu, 26 Sep 2002 01:49:42



> I get an error, which disappears when I put the pigment and finish
> outside material, like this:

>    pigment{rgbt <1,1,0,0.9>} finish{ambient 3 diffuse 0}
>    material{
>    interior{media{emission <1,1,0> method 3 intervals 1 samples 1,10}}
>            }

> Is this right?

My fault, I wanted it to put it into a material{} environement. Put POV
does not allow pigment and finish directly in material, you need a
texture{} wrapper around.

The complete syntax is

material{
  texture{
    pigment{ ... }
    finish{ ... }
    normal{ ... }
  }
  interior{
    ior ...
    media{ ... }
  }

Quote:}

Now POV allows to specify pigment, finish, normal, texture, interior
directly in the object without the encapsulating. Texture holds everything
that describes the *surface* (well, they are 3d in fact but only evaluated
at the object's surface). Interior describes the *interior* of the object.

Quote:

> Actually, one of the things I have a lot of trouble with is what belongs
> where in these attributes. I think it is partly because povray is
> forgiving and allows some shortcuts. Are you aware of a definitive
> tutorial that explains this, i.e. the logic of the nesting of pigment,
> interior, texture, material, etc?

I hope the overview above gives you an idea. The 'Quick reference' in the
documentation gives more details about the syntax. It is not too clear
(don't know if this is the english word for what I mean) for me though.

- Micha

 
 
 

Simulating a focusing light beam in POV-ray

Post by Kave » Thu, 26 Sep 2002 05:47:50


[...]

Quote:> I hope the overview above gives you an idea. The 'Quick reference' in the
> documentation gives more details about the syntax. It is not too clear
> (don't know if this is the english word for what I mean) for me though.

The quick overview is in fact useful. Thanks again.

--
Kaveh