|
![](/i/fill.gif) |
"Chris B" <c_b### [at] btconnect com nospam> wrote in message
news:447373ce$1@news.povray.org...
> Hi Sean,
>
> Technically, yes it is possible, though I'm not sure I'd cite it as a
> particularly 'newuser' thing to do.
>
Here's a short example, but be warned it uses some fairly complex notions so
it might be very difficult to follow.
I've tried to use some fairly explicit names, but if you don't understand
something, just ask and I'm sure someone will be happy to explain.
light_source { <0, 50, -50> color 1}
light_source { <20, 40, -10> color 1}
#declare InternalObject = cylinder {0,1,0.2}
#declare InternalObjectCentre = (min_extent(InternalObject) +
max_extent(InternalObject))/2;
#declare CameraLocation = <2,2,-4>;
camera {location CameraLocation look_at InternalObjectCentre}
// Build an object for the object pattern
#declare DistanceFromObjectToCamera =
vlength(InternalObjectCentre-CameraLocation);
#declare I = 0;
#declare Slices = 400;
#declare ShadowObject = merge {
#while (I<Slices)
#declare DistanceFromObject = DistanceFromObjectToCamera*I/Slices;
object {InternalObject
translate -InternalObjectCentre // Move to origin
scale 1.04*(Slices-I)/Slices // Scale
translate InternalObjectCentre // Move back
translate
DistanceFromObject*vnormalize(CameraLocation-InternalObjectCentre)
}
#declare I = I + 1;
#end
}
// The inner object
object {InternalObject pigment {color rgb <1,1,0>}}
// The outer object
object {box
{-1,2
pigment {
object {
ShadowObject
color rgbt <0,1,1,0.5>
color rgbt 1
}
}
}
}
Higher values for 'Slices' will give a smoother 'hole'.
The scale factor (1.04) gives a hole slightly bigger than the object. Use a
scale factor of 1 to get a snuggly fitting hole.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |