|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <c_b### [at] btconnectcomnospam> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> 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
>
Hi Sean,
In fact it should work with a union of a whole bunch of objects too. You may
need to increase the number of slices and put up with potentially large
render times.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|