POV-Ray : Newsgroups : povray.newusers : Single lens show side view : Re: Single lens show side view Server Time
30 Jun 2024 03:52:53 EDT (-0400)
  Re: Single lens show side view  
From: Alain
Date: 7 Oct 2011 16:52:32
Message: <4e8f6690@news.povray.org>

> 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
>
>
>

As Thomas pointed out, by changing your working axis, you can create the 
lens verticaly.

Next, if you want to rotate it in any way, you *must* rotate it before 
you do any translate. Otherwise, it will also orbit arount the origin as 
it rotates.
If you want, or need, to scale it, it should also be done before the 
translation, or you'll also scale the previous translation making it 
move further.

I find the lens visible enough as it is, no real need to change it's 
colouration. It may be advisable to use a slightly coloured or textured 
background.


Post a reply to this message

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