[Committed] twoPassTransparency wont work in RenderQueu if CullState missing

Removing the two if arguments will guarantee the twoPassTransparency will work for every Geometry and even if no CullState is set the code will work.



Index: src/com/jme/renderer/RenderQueue.java
===================================================================
--- src/com/jme/renderer/RenderQueue.java   (revision 4893)
+++ src/com/jme/renderer/RenderQueue.java   (working copy)
@@ -263,9 +263,7 @@
                 Spatial obj = transparentBucket.list[i];
 
                 if (twoPassTransparent
-                    && obj instanceof Geometry
-                    && (((Geometry) obj).states[RenderState.StateType.Cull.ordinal()] != null
-                          && !((Geometry) obj).states[RenderState.StateType.Cull.ordinal()].isEnabled())) {
+                    && obj instanceof Geometry) {
                     Geometry geom = (Geometry)obj;
                     RenderState oldCullState = geom.states[RenderState.StateType.Cull.ordinal()];
                     geom.states[RenderState.StateType.Cull.ordinal()] = tranCull;

dhdd said:

It doesn't matter if the objects are actually transparent, It matters if they are rendered in the TRANSPARENT_QUEUE.
If a geometry is in transparent queue (again, it doesn't actually have to be transparent), and if you have twoPassTransparency enabled the renderer sets its own CullStates to achieve the desired effect.

Yes, yes, they are rendered in trasparent queue. :)

dhdd said:

So just call it with false and everything should be back to normal.

That works great, thanks. Although I didn't call this anywhere in my code. I am using SimpleCanvasImpl class so its probably set by it (or some superclass). Didn't notice similar effect in StandardGame though.
Thanks again. :)
InShadow said:

Transparent objects are not rendered correctly anymore (some are not even transparent)...  :(

It doesn't matter if the objects are actually transparent, It matters if they are rendered in the TRANSPARENT_QUEUE.
If a geometry is in transparent queue (again, it doesn't actually have to be transparent), and if you have twoPassTransparency enabled the renderer sets its own CullStates to achieve the desired effect.

InShadow said:

Also I get some strange cull settings which I didn't define (practically some of my objects don't have their back faces culled anymore).

See explaination above.

InShadow said:

Its really strange so I hope you can check this out again.

I reviewed the changes and the effect is desired like that. If someone else could confirm that would be appreciated?

I suspect that somewhere in your code you call:

DisplaySystem.getDisplaySystem().getRenderer().getQueue().setTwoPassTransparency(true);


So just call it with false and everything should be back to normal.

If not, post back with a testcase that shows the false behaviour.

dhdd

I get errors in my program after this revision.

Transparent objects are not rendered correctly anymore (some are not even transparent)…  :frowning:

Also I get some strange cull settings which I didn't define (practically some of my objects don't have their back faces culled anymore).

Its really strange so I hope you can check this out again.