Timothy Normand Miller wrote:
I'm starting to worry that what I'm going to have to do is do all my
coordinate transforms up-front (rather than create a transform group
and transform the group), then sort by Z order, then add them to the
scene (and by trial and error determine whether it renders
first-to-last or last-to-first).
But I'm wondering if there isn't a better way.
Also, this makes me wonder... if you're a game designer, and you want
translucency, does the game engine have to order the scene from back
to front so that the alpha blending happens in the right order? Or is
Java3D stupid and Direct3D and OpenGL handle this more intelligently?
Alpha blending in complex scenes is just horrible. It's not the
fault of Java3D, Direct3D and OpenGL can't do any better.
Basic problem is that compositing ops aren't commutative. Added
problem is that there's no 'transparency' in the depth buffer.
For intra-object transparency, for instance the cockpit of a
plane / interior of a car, most scene graphs have an ordering
node which says 'draw this bit after that bit.' End result is
the solid interior always being drawn before the transparent
bits around it. Because of the depth buffer the exterior can
still block other objects it shouldn't, but the viewer is mostly
going to notice that they can see 'inside' the cockpit/car and
that's good enough.
For simple inter-object transparency, usual way is to draw all
the opaque objects/parts of objects first with depth writes
enabled. Then draw all the transparent parts, with depth tests
but not writes. If transparent polys overlap other transparent
polys, they have to be drawn back to front. (Which on modern
GPUs with fragment shaders and early Z testing is the worst
possible order.) Again, most scene graphs have some kind of bin
or pass scheme, but it's usually up to you the programmer to
make it work by putting nodes in the right bin/pass.
If you're a game designer, the steps are likely to be:
1. Weep in frustration
2. Search literature to see if ray tracing can be done in real
time yet. (No.)
3. Investigate order-independent exotic techniques such as depth
peeling, which work but add just as much complication as sorting
everything into order, if not more.
4. Order game artists to use as few transparent polys as possible.
cheers,
Hugh Fisher
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)