POV-Ray : Newsgroups : povray.newusers : Reflection, Refraction & Scattering : Reflection, Refraction & Scattering Server Time
28 Jun 2024 21:34:25 EDT (-0400)
  Reflection, Refraction & Scattering  
From: Crippso
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

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