Depth Of Field and Transparency

It seems to me that Depth of Field does not handle semi-transparent objects correctly. In my scene, very distant objects that should be quite blurry look sharp when you are looking at them through a semi-transparent object. Is that how the DOF filter is supposed to work? Is there a way around this problem?

The semi-transparent object must be close, then. It uses the Z-value to do the blurring and when you have a semi-transparent object close to you then the Z is close. No way around it.

Well, you could not write Z for your transparent objects but that can cause other problems.

@pspeed said: Well, you could not write Z for your transparent objects but that can cause other problems.

Sorry, newbie here - how do I “not write Z” for my transparent objects? What other problems could that cause?

http://hub.jmonkeyengine.org/javadoc/com/jme3/material/Material.html#getAdditionalRenderState()
http://hub.jmonkeyengine.org/javadoc/com/jme3/material/RenderState.html#setDepthWrite(boolean)

The down sides are that if you have semi-solid stuff in the transparent bucket then they may look like they are in front of your semi-transparent object depending on when they are drawn. For example, if you have tree leaves behind a stained glass window… normally the trees will sort behind the stained glass and everything will still look ok but if for some reason they sort in front (big bounding shape, whatever) then they will be drawn after the stained glass window and then look like they are in front of it instead of behind it.

Ah, ok - I’ll try that. Thanks!