POV-Ray : Newsgroups : povray.newusers : Dependent transparency? : Re: Dependent transparency? Server Time
29 Jul 2024 06:21:15 EDT (-0400)
  Re: Dependent transparency?  
From: Sean Fulton
Date: 24 May 2006 16:23:40
Message: <4474c0cc@news.povray.org>
On 2006-05-23 16:42:52 -0400, "Chris B" <c_b### [at] btconnectcomnospam> said:

> 
> "Sean Fulton" <ful### [at] cmuedu> 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.

Thanks, Chris. I'll take a look at the code you posted. Unfortunately, 
my situation is not as simple as the example I gave. I'm dealing with 
multiple small objects (representations of molecules). But, I'll give 
it a try.

Thanks again,

	Sean


Post a reply to this message

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