WaterFilter and Transparency

Hi,



i’m using the WaterFilter and it looks really great. But my problem is that transparent objects always disappear if they are in front of the water. See the screens:



Thats what the shapes should look like:





That’s how they appear if they’re in front of the water:





Any solution?



Regards

Moe

oh god…another tricky issue… :stuck_out_tongue:



how are your translucent objects rendered? do you disable depth write on them by any chance?

Transparent objects will never work if water is rendered as a post-pass. It has to be rendered right after the sky.

@Remy: Is it possible to render water as a pre-pass?

mhhh must be yes…thought what would that change?

Transparency by principle requires objects to be rendered back to front. By rendering the water first you alleviate that issue.

Actually … If you do it this way, then you won’t see any objects under water. I guess we will need to render the scene in two passes and use that camera clip plane thing, first you render underwater objects, then you render water, then you render objects above water.

Hi,



thanks for the feedback and yes i had to disable the depth write because in each other case there was a strange behavior while rendering the translucent objects. Follow the link to see the discussion.



http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/transparency-problem-2/



Moe

PS.: Will it sometime be possible to use antialiasing while having a post filter attached?

yes anti-aliasing works with all filters now, but you need an opengl3 compatible card.

If i set the FilterPostProcessors numSamples to 8 and i’ll receive the following exception:



The opengl3 flag i set too:



[java]settings.setRenderer(AppSettings.LWJGL_OPENGL3);[/java]



[java]Exception in thread “LWJGL Renderer Thread” org.lwjgl.opengl.OpenGLException: Invalid enum (1280)

at org.lwjgl.opengl.Util.checkGLError(Util.java:59)

at org.lwjgl.opengl.GL11.glTexParameteri(GL11.java:3223)

at com.jme3.renderer.lwjgl.LwjglRenderer.setupTextureParams(LwjglRenderer.java:1515)

at com.jme3.renderer.lwjgl.LwjglRenderer.updateRenderTexture(LwjglRenderer.java:1204)

at com.jme3.renderer.lwjgl.LwjglRenderer.updateFrameBufferAttachment(LwjglRenderer.java:1222)

at com.jme3.renderer.lwjgl.LwjglRenderer.updateFrameBuffer(LwjglRenderer.java:1253)

at com.jme3.renderer.lwjgl.LwjglRenderer.setFrameBuffer(LwjglRenderer.java:1322)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:701)

at com.jme3.renderer.RenderManager.render(RenderManager.java:742)

at framework.jme3.CityApplication.update(CityApplication.java:429)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:158)

at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:225)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)

at java.lang.Thread.run(Thread.java:662)[/java]



My Graphics card: NVidia GeForce GT 425M



Supported Caps from the renderer:

[java]FrameBuffer

FrameBufferMRT

FrameBufferMultisample

TextureMultisample

OpenGL20

OpenGL21

OpenGL30

OpenGL31

OpenGL32

ARBprogram

GLSL100

GLSL110

GLSL120

GLSL130

GLSL140

GLSL150

VertexTextureFetch

TextureArray

TextureBuffer

FloatTexture

FloatColorBuffer

FloatDepthBuffer

PackedFloatTexture

SharedExponentTexture

PackedFloatColorBuffer

TextureCompressionLATC

MeshInstancing

VertexBufferArray[/java]



Edit: I saw that it was discussed here: http://hub.jmonkeyengine.org/groups/general-2/forum/topic/openglexception-invalid-enum-1280/

you don’t have to set the renderer to onpengl3.

Just set the numSample tto 8 and it should work since your card seems to be able to handle it

I thought that too, but unfortunately it doesn’t work. The exception is still thrown :frowning:

Well, setting the num samples works fine but setting the num samples at the FilterPostProcessor causes the problem.

Hi,

I have nearly the same problem. It seems that the water-filter can only decide between full- or non-transparency.

(the grey stuff is what I want)

With the old water effect the grey tiles are rendered correctly:



With the WaterFilter I have this as result. The little black fractals on the grey textures are my problem. There should be a smooth fade:



I enabled explicitly depth test and depth write on the tile-material but that didn’t work.

ah, sorry,



I think this issue is more like this one:

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/transparency-glitch-seeing-through-objects/

This issue can be fixed by rendering the water before the transparent white stuff … We are actually working on a similar thing for the shadow filter as well

Momoko_Fan said:
This issue can be fixed by rendering the water before the transparent white stuff ... We are actually working on a similar thing for the shadow filter as well

Hm, I can't find access to the water-geometry. How can I do that?

The water is rendered by the water filter, the point is to allow filters to render in between certain buckets in the RenderQueue

Some heads up about this issue.

I managed to make it work. here is a shot

http://i.imgur.com/hNU12.jpg





Before committing it needs some clean up and a debrief with Kirill, but should be in, in a couple of days.

2 Likes
nehon said:
Some heads up about this issue.
I managed to make it work. here is a shot

Before committing it needs some clean up and a debrief with Kirill, but should be in, in a couple of days.


Awesome :D

Again and again I'm impressed about the activity from the jme-team and -community.

ok this is in

Update to last svn.



to use this with filters, place your translucents objects in the translucent bucket (model.setQueueBucket(Bucket.Translucent))

then add a new TranslucentBucketFilter to your filter stack (after the water filter) and it should work.



The reason why there is a filter for it is just for the user to be able to render translucent objects in the middle of the filter stack.

For example, let’s say you want to apply a fog filter to your scene and obviously you want translucent objects to be fogged.

so your filter stack should look like this : WaterFilter/TranslucentBucketFilter/FogFilter.



hope that’s clear enough, please test it, and give me some feed back :wink:

2 Likes

Hi nehon,

the transparency issues are gone. Very good work. But now I have a new problem.

I’ve build the filter-stack in my postProcessor like you mentioned WaterFilter/TranslucentFilter. I had the issue that I can’t see the particles on the water, so I put them into the translucent-stack, too. Now the particles are not readjusting there facing properly when I move the camera. When I remove the WaterFilter the particle-facing is correctly adjusted



greetz



ceiphren



edit: The facing of the particles is correct, when I move the camera along the x and z-axis. If I lower or raise the camera then it’s making mistakes.

oh?

and this does not occur without the water filter?