POV-Ray : Newsgroups : povray.general : Putting light sources inside hollow objects Server Time
10 Aug 2024 15:24:02 EDT (-0400)
  Putting light sources inside hollow objects (Message 1 to 8 of 8)  
From: ranger5
Subject: Putting light sources inside hollow objects
Date: 11 Nov 1999 16:28:34
Message: <382b3502@news.povray.org>
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...

global_settings { ambient_light 4 }
#include "colors.inc"

  difference {
    intersection {
      sphere { <0, 0, 0>, 1 hollow
      }
      pigment { Red }

    }
    cylinder { <0, 0, -1> <0, 0, 0>, .35 hollow
    }
  }

background {color Black}
light_source { <-1,2,-3> White shadowless}
light_source { <0,0,0> White }
camera{ location <1,0,-5> look_at <0,0,0> orthographic}

Please help, i'm new to POV-Ray and i'm struggling a little with this
problem.

Thanks
Paul


Post a reply to this message

From: Andrew Clinton
Subject: Re: Putting light sources inside hollow objects
Date: 11 Nov 1999 16:38:12
Message: <382B3736.3B2FCAFF@ibm.net>
Paul,

I don't think it will work with the hollow command on the cylinder because pov
needs solid objects to perform a csg.  Try removing this and it should work.

Andrew C


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...
>
> global_settings { ambient_light 4 }
> #include "colors.inc"
>
>   difference {
>     intersection {
>       sphere { <0, 0, 0>, 1 hollow
>       }
>       pigment { Red }
>
>     }
>     cylinder { <0, 0, -1> <0, 0, 0>, .35 hollow
>     }
>   }
>
> background {color Black}
> light_source { <-1,2,-3> White shadowless}
> light_source { <0,0,0> White }
> camera{ location <1,0,-5> look_at <0,0,0> orthographic}
>
> Please help, i'm new to POV-Ray and i'm struggling a little with this
> problem.
>
> Thanks
> Paul


Post a reply to this message

From: Chris Huff
Subject: Re: Putting light sources inside hollow objects
Date: 11 Nov 1999 16:41:04
Message: <382B3898.E0D7F5F0@compuserve.com>
Ok, first, the holes in the sphere: You are on the right track, but the
difference keyword cuts a piece out of the object, and closes the
opening with a surface corresponding with the difference object. You
also have an unnecessary intersection, there isn't any reason for that
to be there.
What you are doing is making a cylinderical indentation in the sphere
where you want a hole. To get a hole give the cylinder a transparent
texture so you can see through the indentation, or also difference a
sphere from the inside of the sphere:
difference {
    sphere { <0, 0, 0>, 1 hollow pigment { Red }}
    cylinder { <0, 0, -1.01> <0, 0, 0>, .35 pigment {color White filter
1}}
}

or:
difference {
    sphere { <0, 0, 0>, 1}
    sphere { <0, 0, 0>, 0.9}//remove a sphere from the inside, making a
hollow shell
    cylinder { <0, 0, -1.01> <0, 0, 0>, .35}
    pigment { Red }
}

Some other things: "hollow" doesn't affect how the object is rendered,
it only allows it to be filled with media or fog. It still acts as a
surface surrounding a solid object. This is a very common
misunderstanding.
Also, you had the cylinders the same length as the radius of the sphere.
This can cause problems with coincident surfaces, where POV can't decide
which surface is hit first. You should use slightly longer cylinders, as
above.


Post a reply to this message

From: Chris Huff
Subject: Re: Putting light sources inside hollow objects
Date: 11 Nov 1999 16:42:36
Message: <382B38F5.CD1D1C1C@compuserve.com>
As I mentioned in my other message, POV only cares about the hollow
keyword if it is calculating media or fog. It doesn't make any
difference in CSG or the appearance of the object.


Post a reply to this message

From: Andrew Clinton
Subject: Re: Putting light sources inside hollow objects
Date: 11 Nov 1999 17:11:01
Message: <382B3EE8.7E51DA00@ibm.net>
Oops! I didn't realize this.  Sorry about the mis-information above and
thank you for pointing this out, Chris.  It does seem unnatural for the
hollow keyword to have no effect on the csg.

Andrew C


Chris Huff wrote:

> As I mentioned in my other message, POV only cares about the hollow
> keyword if it is calculating media or fog. It doesn't make any
> difference in CSG or the appearance of the object.


Post a reply to this message

From: Charles
Subject: Re: Putting light sources inside hollow objects
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

From: Robert Dawson
Subject: Re: Putting light sources inside hollow objects
Date: 12 Nov 1999 08:56:31
Message: <382c1c8f@news.povray.org>
----- Original Message -----
From: Andrew Clinton <cli### [at] ibmnet>
Newsgroups: povray.general
Sent: Thursday, November 11, 1999 6:10 PM
Subject: Re: Putting light sources inside hollow objects


> Oops! I didn't realize this.  Sorry about the mis-information above and
> thank you for pointing this out, Chris.  It does seem unnatural for the
> hollow keyword to have no effect on the csg.

    I think the point is that there is no obvious *use* for omitting hollow
objects from csg. If you don't want the object to cut anything out, don't
cut it...  While one could write a macro in which a hollow-in-that-sense
object would act differently than any single thing now available, it would
be bad code in that semantic units would cross syntactic boundaries (like C
preprocessor macros without enough parentheses.)

    My own $2E-2: "hollow" is very noninintuitive.  When media is attached
to an object, I want to think of it as being the middle of the object, so
that an object with media inside is one which is *not* hollow.   I guess I
would have preferred media-containment to be the default, with "empty" or
"no_media" for an object that excludes media.  There are probably god
arguments for the way it was done, though; and I cannot say that the choice
made is in any way hard to work with.

    -Robert Dawson


Post a reply to this message

From: Nieminen Juha
Subject: Re: Putting light sources inside hollow objects
Date: 12 Nov 1999 10:00:03
Message: <382c2b73@news.povray.org>
Robert Dawson <Rob### [at] stmarysca> wrote:
:     My own $2E-2: "hollow" is very noninintuitive.  When media is attached
: to an object, I want to think of it as being the middle of the object, so
: that an object with media inside is one which is *not* hollow.   I guess I
: would have preferred media-containment to be the default, with "empty" or
: "no_media" for an object that excludes media.  There are probably god
: arguments for the way it was done, though; and I cannot say that the choice
: made is in any way hard to work with.

  Note that "hollow" existed long before "media" existed (or even "halo",
I think). I think that the reason is more historical than any other.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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