|
![](/i/fill.gif) |
"Sean Fulton" <ful### [at] cmu edu> wrote in message
news:447369f8@news.povray.org...
> Is it possible to have an object be trasparent depending on the
> relationship of another object?
> Here's what I want to happen:
>
> Object A is surround by Object B -- such as a sphere inside another
> sphere. I want Object B to be transparent only in the areas that obscure
> Object A from the camera's position. So, you would see Object A through
> Object B but to the left/right/top/bottom of Object A, Object B would have
> no transparency (or it the transparency would trail off).
>
> Does that make sense? Is there a way to do it in POV-Ray?
>
> Thanks,
>
> Sean
>
Hi Sean,
Technically, yes it is possible, though I'm not sure I'd cite it as a
particularly 'newuser' thing to do.
I can't think of a simple way to do it automatically and the technique that
springs to mind wouldn't necessarily work with all shapes, but would work
with the example of a sphere that you gave.
You can use objects to define patterns (see 'object pattern' in the
documentation), so, if you can define a shape that follows the profile of
your internal shape and 'prisms' it back to a point at the camera location,
then you can use that object to define a transparent section in an otherwise
opaque surface. In your example, this is easy as you can use a cone whose
base is centred at the centre of your internal sphere (and whose base is the
same radius as your internal sphere) and whose tip is at your camera
location as the object pattern for your outer object (which can be any shape
you like).
If you want to do the same with another internal shape it becomes more
difficult, but one way is to create a union of hundreds of them, scaling
down proportionaly as you approach the camera, then use this union in the
object pattern. This could be done with a #while loop of course and you'd
need to declare your camera position and the inner object position using
variables to enable the solution to work in a user friendly way.
Probably not something I'd recommend you start on if you're learning, but it
may give you some ideas.
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |