POV-Ray : Newsgroups : povray.general : Putting light sources inside hollow objects : Re: Putting light sources inside hollow objects Server Time
10 Aug 2024 17:32:26 EDT (-0400)
  Re: Putting light sources inside hollow objects  
From: Charles
Date: 11 Nov 1999 18:50:40
Message: <382B553C.F4F2F332@enter.net>
ranger5 wrote:
> 
> Could someone tell me the best way to do the following in POV-Ray...
> 
> I want to create a sphere with a light source inside and then put small
> holes in the sphere to allow the light to shine out through the holes.
> 
> I've tried using CSG difference to create a sphere pierced by a cylinder and
> put a light source inside...
> 

difference{} will cut pieces out, but it will fill the CSG in to create
the illusion of a solid object (and the confusingly named "hollow"
keyword, as has been noted, won't help). You could difference out
transparent pieces, in which case the "fake walls" will be see-thru,
but if you need *lots* of clipped holes, having all those transparent
objects clustered in one spot may cause rendering speed and maybe
max_trace_level related complications. What you really need is 
clipped_by statements instead. Clipping shapes trim the shape to the 
a given boundary, but if you combine it with the "inverse" keyword, 
they can be used to slice pieces of the base shape away, WITHOUT adding 
any "fake walls" to create the illusion of solidity. For example, 
try this out:

// --- START SAMPLE CODE 

camera { //camLHCCamera
     location<0,5,-20> look_at<0,0,0> angle 15
}

light_source { //pltExteriorLight
     <1000,1000,-1000> color rgb<1,1,1> 
}

plane { //plnFloor
     y, 0 
     pigment { checker color rgb<.75,.75,.75> color rgb<.5,.5,.5> }
}

sphere { // sphBaseShape 
         // your base shape, positioned just above the floor...

     <0,1,0>,1  pigment { rgb<0,0,1> } 

     ///// These chop cylinders out of the sphere by clipping it to the 
     ///// inverse of the cylinder (ie. turn it inside-out)
     clipped_by { 
          cylinder { <0,1,0>,<0,1,-2>,.2 inverse } 
     }
     clipped_by { 
          cylinder { <0,1,0>,<0,1,-2>,.2 rotate<0,30,0> inverse } 
     }
     ///// Add as many as you clipping shapes as you need, then...
}

light_source { //pltInteriorLight
               //and this one shines from within...

     <0,1.5,0> color rgb<1,1,1> 
}

//--------END SAMPLE CODE


Post a reply to this message

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