From: Mario Veraart (Veraart++at++fel.tno.nl)
Date: 01/22/2001 04:49:42
Simon C Mills wrote:
>
> Brian Furtaw wrote:
> >
> > Could you give some more information about what you are trying to do. If
> > you have doorways or windows in buildings that are modeled transparently
> > it will require a different solution then trying to shoot through trees.
> > What are you intersecting with and why? In Performer each pfNode carries
> > an isect mask so you can have classes of objects that behave differently
> > in isect queries. You are most likely going to need to add some extra
> > information to the scenegraph to solve your problem.
>
> OK. I have a model of the International Space Station which is had lots
> of thin truss structures. To model these we use transparency in textures
> a lot to represent geometry. This is the model I'm intersecting with.
> I'm drawing a nice sun and lens flare effect (to make the sun look
> really bright and for camera simulation) and to test if the sun is
> occluded I'm using an intersection test. The test uses a vector from the
> eye point in the sun direction and the effect is drawn depending on the
> intersection result. Now, because intersections don't take the purely
> transparent areas into account, I get anomalies where the sun is in view
> but the intersection returns true and turns off the effects.
>
> So, I'm looking for a way around this problem without having to model
> the whole ISS in solid geometry (_lots_ of polygons required for this!).
>
> One thought I also had was to use stencil tests since the areas causing
> the anomalies are purely transparent (alpha = 0). By setting alpha draw
> function to alpha > 0 these pixels are not draw. At the same time I
> could update the stencil buffer and use this then as an additional test
> after by intersection test. This relies on the fact that the
> intersection uses the eye point and would allow me to combine the 3D and
> 2D (pixel space) techniques. In fact any 2D technique that indicates if
> any part of the sun's disk is not occluded would be sufficient.
>
> Thanks for your interest,
> Simon
Can't you use the depth buffer.
To test if a single ray from the eye point is hitting some opaque part of the
geometry you can calculate the screen coordinate of this ray and fetch the
depth buffer value of this location. If it is large (~0.99) you hit deep space.
You can also calculate the exact depth value at this location if you use the
invers Z-buffer calculation that contains the near and far values.
Somewhere in the history of this list somebody from SGI posted the equation.
I remember that the iR uses some log function instead of some lineair one.
To test witch part of the sun is occluded you can draw the sun as the last part.
(Maybe in a separate bin, and put a draw callback at the pfNode)
The sun image can be a transparent textured quad with a circle picture.
Set the stencil update to set if the depth-test passes. You now have a mask of the
visible/occluded part of the sun image in the stencil buffer. To narrow the search where
the sun is in the image transform the sun quadrilateral from world space to screenspace.
Mario
This archive was generated by hypermail 2b29 : Mon Jan 22 2001 - 04:51:35 PST