Picon

[Kinda OT] Perhaps novice question about painting 3D scenes with alpha blending

I know graphics architecture, and I know how to do all the math.  But,
oddly, I've never actually used a 3D API like OpenGL, Direct3D or
Java3D.  Well, I'm trying to write a demo for a paper I'm presenting
at HPCA, and I've run into something odd.  I was hoping some with
actual front-end experience might be able to help me.  I figured since
this is a graphics mailing list, this wouldn't be horribly off topic.

I'm using Java3D to render a scene with lots of translucent planes.
If I make everything opaque, it's fine, because it's doing Z culling.
But I'm finding that the rendering order isn't near-to-far, as I
expected, but something perhaps related to the order in which I
created the scene elements.  As a result, when I turn on alpha
blending, it looks horrible.

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?

Thanks!

--

-- 
(Continue reading)

Hugh Fisher | 18 Jan 04:21
Picon
Picon

Re: [Kinda OT] Perhaps novice question about painting 3D scenes with alpha blending

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
(Continue reading)

Matt | 18 Jan 08:51
Picon

Re: [Kinda OT] Perhaps novice question about painting 3D scenes with alpha blending

On 18/01/12 03:21, Hugh Fisher wrote:
> 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.
>
(Continue reading)

Picon

Re: [Kinda OT] Perhaps novice question about painting 3D scenes with alpha blending

I found a solution to my problem:

        universe.getViewer().getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);

Now everything looks right.

I'm starting to think that Java3D isn't half bad.  :)

Gmane