POV-Ray : Newsgroups : povray.newusers : Light diffusion through prism Server Time
30 Jun 2024 14:42:31 EDT (-0400)
  Light diffusion through prism (Message 1 to 7 of 7)  
From: awestover
Subject: Light diffusion through prism
Date: 18 Apr 2011 14:45:01
Message: <web.4dac859365674b1469fb356b0@news.povray.org>
I am trying to create a simple scene that has a semi-transparent triangular
prism with a white light entering on one side and a rainbow exiting on the
other, similar to
http://en.wikipedia.org/wiki/File:Dispersive_Prism_Illustration_by_Spigget.jpg

I was thinking about just using a gradient and a color map to build the rainbow
but every time I tried the gradient would be small and repeat, so it was like 5
or 6 repeating rainbows. I then tried the actual rainbow structure but couldn't
get it straight and triangular like the dispersion from a prism. Any idea on how
to go about this?


Post a reply to this message

From: Alain
Subject: Re: Light diffusion through prism
Date: 18 Apr 2011 19:45:58
Message: <4daccd36@news.povray.org>

> I am trying to create a simple scene that has a semi-transparent triangular
> prism with a white light entering on one side and a rainbow exiting on the
> other, similar to
> http://en.wikipedia.org/wiki/File:Dispersive_Prism_Illustration_by_Spigget.jpg
>
> I was thinking about just using a gradient and a color map to build the rainbow
> but every time I tried the gradient would be small and repeat, so it was like 5
> or 6 repeating rainbows. I then tried the actual rainbow structure but couldn't
> get it straight and triangular like the dispersion from a prism. Any idea on how
> to go about this?
>
>

You need to enable photons maping.

global_settings{photons{spacing 0.01 autostop 0}}
or
global_settings{photons{count 1000000 autostop 0}}

This turns on photons emission for all lights except for shadowless ones.

Then, you need to add the followings to your prism:

      "interior{ior 1.5 dispersion 1.03}"

"ior"1.5 make the prism actualy refract light, here, with a median value 
for glass.

dispersion 1.03 turn on the chromatic dispersion. The given value is 
relatively strong.
In the interior block, you can add dispersion_samples 12 (or more) to 
get smoother results.

      "photons{target refraction on reflection on}"

This enable shooting photons at the object.
"reflection on" is optional in this particular case.
"refraction on" is needed to enable the prism to bend light.

To get exactly the same result, you also need to add some reflection to 
your prism:

      "finish{reflection{0.01 1 fresnel}conserve_energy}"

With "reflection on" in the photons block of the prism.


If you look the documentations about photons, there is mention of a 
photons block for light_source. This block is optional and have the 
following default values:
photons{refraction on reflection on area_light off}




Alain


Post a reply to this message

From: awestover
Subject: Re: Light diffusion through prism
Date: 18 Apr 2011 22:05:00
Message: <web.4daced33dcf29308f9cdbc410@news.povray.org>
Maybe I'm not fully understanding photons and the light source, this is my first
pov ray program.

What I came up with after your post was

global_settings{
    photons{
        spacing 0.05 autostop 0
    }
}

light_source {
    <-5, -3, -8>
    color rgb <1, 1, 1>
    translate <-5, 5, -5>
    spotlight
    point_at <0,0,0>
    radius 10
    photons {
       refraction on
       reflection on
    }

}


camera {
    location <-15,10,-40>
    look_at <3,-2,0>
    angle 60
}

difference {
    box {
        <-4,-2,-8>,<4,2,8>
    }
    plane {
        <0,-1,0>,-1 rotate <0,0,60>
    }
    plane {
        <0,-1,0>,-1 rotate <0,0,-60>
    }
    hollow on
    pigment {
        color rgbt <.8,1,.9,.7>
    }
    finish{
        reflection{
            0.01 1 fresnel
        }
        conserve_energy
    }
    interior {
        ior 1.5 dispersion 1.03
        dispersion_samples 12
    }
    photons{
        target refraction on reflection on
    }
}

This makes a good triangular prism and the photons make it look good, but there
is still no visible light entering the prism/rainbow exiting. Am I doing
something wrong with the light source?


Post a reply to this message

From: Jim Holsenback
Subject: Re: Light diffusion through prism
Date: 19 Apr 2011 08:19:11
Message: <4dad7dbf$1@news.povray.org>
On 04/18/2011 11:02 PM, awestover wrote:
> Maybe I'm not fully understanding photons and the light source, this is my first
> pov ray program.
>
> What I came up with after your post was
>
> global_settings{
>      photons{
>          spacing 0.05 autostop 0
>      }
> }
>
> light_source {
>      <-5, -3, -8>
>      color rgb<1, 1, 1>
>      translate<-5, 5, -5>
>      spotlight
>      point_at<0,0,0>
>      radius 10
>      photons {
>         refraction on
>         reflection on
>      }
>
> }
>
>
> camera {
>      location<-15,10,-40>
>      look_at<3,-2,0>
>      angle 60
> }
>
> difference {
>      box {
>          <-4,-2,-8>,<4,2,8>
>      }
>      plane {
>          <0,-1,0>,-1 rotate<0,0,60>
>      }
>      plane {
>          <0,-1,0>,-1 rotate<0,0,-60>
>      }
>      hollow on
>      pigment {
>          color rgbt<.8,1,.9,.7>
>      }
>      finish{
>          reflection{
>              0.01 1 fresnel
>          }
>          conserve_energy
>      }
>      interior {
>          ior 1.5 dispersion 1.03
>          dispersion_samples 12
>      }
>      photons{
>          target refraction on reflection on
>      }
> }
>
> This makes a good triangular prism and the photons make it look good, but there
> is still no visible light entering the prism/rainbow exiting. Am I doing
> something wrong with the light source?
>
>
>
>
The simple media tutorial beginning here:
http://wiki.povray.org/content/Documentation:Tutorial_Section_3.6#Simple_Media_Tutorial

will get you going with the media that you need to make the light 
visible ;-)


Post a reply to this message

From: Alain
Subject: Re: Light diffusion through prism
Date: 19 Apr 2011 16:24:40
Message: <4dadef88@news.povray.org>


You don't anything wrong with the light. It only needs something more to 
interact with. It can be a media or some surface.

You may do as Jim said and use some media, but there are other way to 
make the light visible:

You can place a white plane just behind the prism, placing so that the 
back side of the prism intersect it. That way, you'll be able to see the 
path of the light inside the prism.

I added this:
plane{-z,-7.9 pigment{rgb 1}finish{ambient 0 diffuse 1}}

This plane acts like a projector's screen.


I changed your light to a light and a slit like this:
union{
	light_source {
	    <-50, 0, -3>
	    color rgb 100 // Much brighter
	    translate <-5, 5, -5>
	    parallel // instead of a spotlight
	    point_at <0,0,0>
	    photons { // Optional
	       refraction on
	       reflection on
	    } // OK even if not needed.
	
	}
// those 2 boxes make a nice slit
	box{<-40,  0.1, -1000><-41,  1000, 10>}
	box{<-40, -0.1, -1000><-41, -1000, 10>}
	rotate 49*z
	translate -6.3*x
	}

I reduced the photon's spacing down to 0.0045.
I increased the ior to get closer to the image you refered.
It needs something like 1.88.
In the original image, the dispersion seems exagerated. Increased 
dispersion to 1.06. You can try some larger values.
I bumped up the dispersion_samples to 50 and got very smooth results.
You will see more reflections in the prism. Those are correct.
You need a strong light as the incident angle to the plane is shallow 
and the dispersion spreads it's brightness over a much larger area.

Advantage compared to the use of media: Much faster.



Alain


Post a reply to this message

From: CAD-Andi
Subject: Re: Light diffusion through prism
Date: 25 Apr 2011 19:25:00
Message: <web.4db60273dcf29308b642fbb20@news.povray.org>
"awestover" <nomail@nomail> wrote:
> I am trying to create a simple scene that has a semi-transparent triangular
> prism with a white light entering on one side and a rainbow exiting on the
> other, similar to
> http://en.wikipedia.org/wiki/File:Dispersive_Prism_Illustration_by_Spigget.jpg
>
> I was thinking about just using a gradient and a color map to build the rainbow
> but every time I tried the gradient would be small and repeat, so it was like 5
> or 6 repeating rainbows. I then tried the actual rainbow structure but couldn't
> get it straight and triangular like the dispersion from a prism. Any idea on how
> to go about this?

To awestover:
Alain and Jim gave you really good advice. I really hope you accomplished your
goal writing your script. There is nothing more rewarding than to see the
physics of nature perfectly simulated by povray. I would go with Alain's
suggestion to project the light onto a screen rather than using media. Good
luck!


Post a reply to this message

From: Alain
Subject: Re: Light diffusion through prism
Date: 26 Apr 2011 13:19:01
Message: <4db6fe85@news.povray.org>

> "awestover"<nomail@nomail>  wrote:
>> I am trying to create a simple scene that has a semi-transparent triangular
>> prism with a white light entering on one side and a rainbow exiting on the
>> other, similar to
>> http://en.wikipedia.org/wiki/File:Dispersive_Prism_Illustration_by_Spigget.jpg
>>
>> I was thinking about just using a gradient and a color map to build the rainbow
>> but every time I tried the gradient would be small and repeat, so it was like 5
>> or 6 repeating rainbows. I then tried the actual rainbow structure but couldn't
>> get it straight and triangular like the dispersion from a prism. Any idea on how
>> to go about this?
>
> To awestover:
> Alain and Jim gave you really good advice. I really hope you accomplished your
> goal writing your script. There is nothing more rewarding than to see the
> physics of nature perfectly simulated by povray. I would go with Alain's
> suggestion to project the light onto a screen rather than using media. Good
> luck!
>
>
Yes, a screen can be over 100, to 1000 times faster.
With media, you need to deposit your photons in the media. That realy 
causes your photons count to shoot up dramaticaly.
More photons means heavier RAM useage, quite possibly exceding the 
amount of available RAM and forcing the use to the page file.
Disk access is extremely Slooooooooooooow comapred to RAM access.


Alain


Post a reply to this message

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