POV-Ray : Newsgroups : povray.newusers : Single lens show side view : Re: Single lens show side view Server Time
30 Jun 2024 03:42:51 EDT (-0400)
  Re: Single lens show side view  
From: Thomas de Groot
Date: 7 Oct 2011 03:31:46
Message: <4e8eaae2$1@news.povray.org>
On 7-10-2011 8:19, Arun Kumar wrote:
> Thanks for the clarification...
>
> I have some more doubts. I created a checker board with stick and a lens. I need
> to view the stick through the lens. But the lens which i created is in
> horizontal position. I need to rotate it vertically so that the stick can be
> viewed through the lens. I tried changing the attributes of ROTATE and TRANSLATE
> but i couldn't get the exact image which am looking for. Please help me with
> this issue.
>
> Here is my code..
>
>
> #include "colors.inc"
> #include "glass.inc"
> #declare Photons=on;
>
>    global_settings {
>    assumed_gamma 1.0
>
>    max_trace_level 5
>    #if (Photons)
>      photons {
>        spacing 0.02
>      }
>
>    #end
> }
>
> camera {
>    //perspective
>    location<1, 2, -10>
>    look_at<0, 2,  0>
>    right     x*1.33
>    }
>
>     light_source
>          {<0,15,0>
>             color rgb<1,1,1>
>          }
>
> #declare Glass_material =    // Glass material
> material {
>    texture {
>      pigment {rgbt 1}
>      finish {
>        ambient 0.0
>        diffuse 0.05
>        specular 0.6
>        roughness 0.005
>      }
>    }
>    interior {
>      ior 1.5
>      fade_power 1001
>      fade_distance 0.9
>      fade_color<0.5,0.8,0.6>
>    }
> }
>
>
>
> // CSG union, add all of shapes 1...N
>
> union
>       {
>       box      {<-4,0,-4>,<4,0,4>     pigment { checker color Black, color White}
> rotate -y*35}
>       cylinder {<0,0,0>,<0,3.5,0>, 0.1   pigment { color MediumSpringGreen } }
>
>       intersection
>          {
>       sphere {
>        <0, 5.5, 0>, 6
>        scale 1
>        rotate<0, 0, 0>
>        translate<0, 0, 0>
>
>     }
>
>     sphere {
>        <0, -5.5, 0>, 6
>        scale 1
>        rotate<0, 0, 0>
>        translate<0, 0, 0>
>     }
>     translate y*3
>
>     pigment {
>        color rgbt<0.2, 0.41176, 0.43922, 0.8>
>     }
>
>     interior {
>        ior 1.5
>     }
>     material { Glass_material }
>
>     photons {
>        target
>        collect off
>     }
>       }
>
>        }
>
>
> Thanks,
> Arun
>
>
>
Change your code for the intersection like this:

intersection {
   sphere {
     <0, 0, 5.5>, 6
     scale 1
     rotate <0, 0, 0>
     translate <0, 0, 0>
   }

   sphere {
     <0, 0, -5.5>, 6
     scale 1
     rotate <0, 0, 0>
     translate <0, 0, 0>
   }
   translate <0, 2, -5>

   pigment {
     color rgbt <0.2, 0.41176, 0.43922, 0.8>
   }

   interior {
     ior 1.5
   }
   material { Glass_material }

   photons {
     target
     collect off
   }
}

Explanation: The intersection (the lens) is now defined in a vertical 
manner by using the z-axis instead of the y-axis. Then, the lens is 
translated 2 units along the y-axis and -5 units along the z-axis, in 
order to see your cylinder at the origin.

NB It does not matter here, but your checkered box has no thickness. Use 
a plane instead or give the box a little thickness like:

<-4, -0.1, -4>,<4, 0, 4>

in order to avoid coincident surfaces.

Thomas


Post a reply to this message

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