POV-Ray : Newsgroups : povray.newusers : Reflection, Refraction & Scattering Server Time
22 Dec 2024 11:06:37 EST (-0500)
  Reflection, Refraction & Scattering (Message 1 to 6 of 6)  
From: Crippso
Subject: Reflection, Refraction & Scattering
Date: 24 Jan 2012 19:55:01
Message: <web.4f1f520db2f21fb2130037650@news.povray.org>
Hi, I'm still pretty new to povray and I need some help please - I am trying to
model reflection and refraction of a cylinder beam that is incident on a glass
slab. My goal is to get accurate reflection and transmission based on ior values
- with the multiple reflections from the front and back surfaces of the glass
slab being included (exluding inteference effects). Therefore I will eventually
turn off scattering but at the moment I'd like to use it to check that the
reflected and refracted beams are going where I think they should be in both the
air and the glass layer. Then I will look at their brightness once scattering is
turned off to check that the reflected/transmitted intensities are correct.

I have copied my code below which doesnt quite work correctly. The first problem
is that I cant see the glass layer (I wasn't sure how best to make this visible
without affecting the accuracy of the simulation too much). The next issue is
that I only see the first refracted ray inside the glass. I dont see the first
reflection from the front surface, or the second reflection and so on. I put the
rgb level of the light to 100,0,0 because the reflectance will only be a few
percent - I hoped setting the rgb so high would enable me to see the
reflectance. I copied the photon settings from another example on this site...
it may be overkill because it seems to be very slow to render. Also the
scattering at the exit of the glass slab looks a bit strange.

Some guidance on how to improve things would be really appreciated! Also any
tips on ensuring accurate results in this kind of simulation would be great too.
Thanks.

global_settings {
  assumed_gamma 1
  max_trace_level 50
  }

 global_settings
 { photons {
      spacing 0.05
      media 200
      }
 }



#include "colors.inc"
#include "shapes.inc"
#include "textures.inc"
#include "glass.inc"
#include "consts.inc"              // Index of refraction constants




camera {
   location <0, 0, -150>
   direction z
   angle 57
   up  <0.0, 1.0, 0.0>
   right <4/3, 0.0, 0.0>
   look_at <0, 0, 1>
}


#declare Light_Distance = 20;


light_source{ <Light_Distance,Light_Distance,0> color rgb <100,0,0>
              cylinder
              point_at<0, 0, 0>
              radius 0.1
              falloff 0.5
              tightness 0.25
              photons {refraction on reflection on}
            }


#declare glasslayer =
   union {
      object {
            box { <-100, -10, -10>, <100,0,10> }
                //translate 0*x
                //rotate <0,0,0>
                hollow
            texture {pigment {color rgbt<1.0, 1.0, 1.0,1.0>}} //Not sure what
rgbt values should be. I want to add some absorption later, but for now no
absorption needed
            finish {reflection {fresnel on} conserve_energy }   //I want
reflection and transmission amounts to be based on Fresnel Equations
            photons { target reflection on refraction on }

            interior {media {scattering {1}} ior 1.55}        //I'd like to see
the refracted beam inside the glass layer. There should be an internal
reflection too.
            }

}

object{glasslayer}


// generic settings for a scattering medium

#declare Scatter_M =
  material {
    texture {
      pigment { rgbt 1 }
      finish {
        ambient 0
        diffuse 0
      }
    }
    interior {
      media {
        method 3
        intervals 1
        samples 70, 1000
        scattering {
          1, rgb 0.1
          extinction 0.00001
        }
      }
    }
  }

//A large sphere intended to show scatter of light beam outside the glass layer
(ie incident and exit beam)

sphere {
  0, 400
  hollow
  material { Scatter_M }
  photons {
    //pass_through
  }
}


Post a reply to this message

From: Alain
Subject: Re: Reflection, Refraction & Scattering
Date: 24 Jan 2012 23:05:17
Message: <4f1f7f7d@news.povray.org>

> Hi, I'm still pretty new to povray and I need some help please - I am trying to
> model reflection and refraction of a cylinder beam that is incident on a glass
> slab. My goal is to get accurate reflection and transmission based on ior values
> - with the multiple reflections from the front and back surfaces of the glass
> slab being included (exluding inteference effects). Therefore I will eventually
> turn off scattering but at the moment I'd like to use it to check that the
> reflected and refracted beams are going where I think they should be in both the
> air and the glass layer. Then I will look at their brightness once scattering is
> turned off to check that the reflected/transmitted intensities are correct.
>
> I have copied my code below which doesnt quite work correctly. The first problem
> is that I cant see the glass layer (I wasn't sure how best to make this visible
> without affecting the accuracy of the simulation too much). The next issue is
> that I only see the first refracted ray inside the glass. I dont see the first
> reflection from the front surface, or the second reflection and so on. I put the
> rgb level of the light to 100,0,0 because the reflectance will only be a few
> percent - I hoped setting the rgb so high would enable me to see the
> reflectance. I copied the photon settings from another example on this site...
> it may be overkill because it seems to be very slow to render. Also the
> scattering at the exit of the glass slab looks a bit strange.
>
> Some guidance on how to improve things would be really appreciated! Also any
> tips on ensuring accurate results in this kind of simulation would be great too.
> Thanks.
>

To make the glass visible, you need to decrease the transmit value a little.
Try: rgbt<1,1,1,0.9>
This will also slightly dimish the transmited light intensity. You can 
slightly increase the light's intensity to compensate.
You may also add a faint fill light:
light_source{<0,0,-150> rgb<0, 0.01, 0.03> shadowless}
//slightly blueish to have some contrast with your red light. Red is 
your light, blue is fill light.

A shadowless light never cast photons and don't generate any highlight.

Your light_source don't need any photons block. The default is 
{reflection on refraction on}
You only need it if you want to disable reflection or refraction or 
enable an area_light for the photons.
If you want the photons to remain parallel and not spread, add 
"parallel" to your light_source.

In your glass finish, you have this:
finish {reflection {fresnel on} conserve_energy }

You need to add the minimal and maximal reflection values. As it is now, 
it's as if it was this:
finish {reflection 0,0 {fresnel on} conserve_energy }
Meaning NO reflection at all.

It should be
finish {reflection 0,1 fresnel conserve_energy }

fresnel works by it presence alone, you don't need any value after it. 
It don't need to be enclosed in braces.

Your Scatter_M media should be as follow:
#declare Scatter_M =
   material {
     texture {
       pigment { rgbt 1 }
       finish {
         ambient 0
         diffuse 0
       }
     }
     interior {
       media {
         method 3
// NO intervals entry needed, MUST stay at the default value of 1.
         samples 70
// ONLY the first value is ever used.
// The second value, if present, is silently ignored.
// Adjust that value up or down as needed.
         scattering {
           1, rgb 0.1
           extinction 0.00001
// That extinction value is not realistic but correct for this use.
// A beter value in THIS case would be: extinction 0
// Advantage: faster rendering.
         }
       }
     }
   }

If you want the beam to be visible inside the glass, you need to allow 
the media to exist inside the glass object. Add hollow to the glass object.
object{glasslayer hollow}



Anothe raproach is as follow:
Don't use any media.
Shine your light through a slit. Use 2 box placed in front of the light. 
Make the light broader. Be sure to use parallel.
Place a white plane across the view. It will replace the media.
Make the light go slightly toward that plane.
Your light_source can look like this:
#declare Light_Distance = 100;
// Place the light farther away.
light_source{ <Light_Distance,Light_Distance,10> color rgb <100,0,0>*30
               cylinder parallel
               point_at<0, 0, 0>
               radius 10
               falloff 0.5
               tightness 10
             }
The slit can look like this:
union{box{<Light_Distance-0.5,1000,20><Light_Distance-0.6,0.1,-20>}
box{<Light_Distance-0.5,-1000,20><Light_Distance-0.6,-0.1,-20>}}
It don't need any texture as it's not part of the visible scene.

You can make an union of the light_source and the boxes. It makes things 
easier if you want to change the direction of the light with a rotation 
or translation.

This make a light sheet shining on your glass object.
The plane will make the light's path visible.
It's *much* faster than using media.





Alain


Post a reply to this message

From: Thomas de Groot
Subject: Re: Reflection, Refraction & Scattering
Date: 25 Jan 2012 03:52:10
Message: <4f1fc2ba$1@news.povray.org>
On 25-1-2012 5:04, Alain wrote:
> It should be
> finish {reflection 0,1 fresnel conserve_energy }
>
According to the docs, I think it should be
finish {reflection {0,1 fresnel} conserve_energy}

;-)

Thomas


Post a reply to this message

From: Crippso
Subject: Re: Reflection, Refraction & Scattering
Date: 25 Jan 2012 13:40:01
Message: <web.4f204bf33f723dc3130037650@news.povray.org>
Alain, thanks for the helpful hints. I updated my code and ran it to see what I
got (using media rather than your idea of passing the beam through a slit for
now). I still do not see any reflection from the front surface of the glass, or
the rear surface... any thoughts on why these might be missing?

thank you
stuart


Post a reply to this message

From: Alain
Subject: Re: Reflection, Refraction & Scattering
Date: 27 Jan 2012 22:37:38
Message: <4f236d82@news.povray.org>

> On 25-1-2012 5:04, Alain wrote:
>> It should be
>> finish {reflection 0,1 fresnel conserve_energy }
>>
> According to the docs, I think it should be
> finish {reflection {0,1 fresnel} conserve_energy}
>
> ;-)
>
> Thomas
Oups, effectively.
My bad.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Reflection, Refraction & Scattering
Date: 30 Jan 2012 22:12:01
Message: <4f275c01$1@news.povray.org>
Crippso wrote:

> Alain, thanks for the helpful hints. I updated my code and ran it to see what I
> got (using media rather than your idea of passing the beam through a slit for
> now). I still do not see any reflection from the front surface of the glass, or
> the rear surface... any thoughts on why these might be missing?

If you change the fresnel reflection to reflection 0.5 the
reflected beam shows up so it works in principle. The very
low reflectivity beam might be optimized away since it is not
expected to be visible (disregarding the extreme rgb).

For reflection 0.01 it begins to show up with
adc_bailout 0.000001 in the photons block. I couldn't
really get it to show for fresnel on.

The strange looking exiting beam is likely
related to photon / media quality settings.


Post a reply to this message

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