[SOLVED] Second filter pass not rendered

Hi there,

was the test case useful for you? Are there any news?

Completely forgot to look into it sorry.

Ok… I know where the issue comes from. The HGaussianBlur shader does not resolve multi sampling…
It can be fixed, but not tonight :p…
An easy workaround though is to add a ColorOverlayFilter (which does resolve MS properly) before your blur filter, and it will work with nearly no overhead.

The nice side effect is that it made me found another issue with the FPP. So thanks :wink:

1 Like

Ok cool. I updated the jme blur shader to GLSL 1.5 and implemented multi sampling. But it still doesn’t work. So the only way is a kind of pre-pass to get a multi sampled image before applying the blur? It this really the right way or is there still a bug because the Pass doesn’t support multi sampling or so? Btw. is it more expensive (performance-wise) to update the blur shaders to support multi sampling or to add a “pre-pass”?

Edit: I’ve also tried to set the right number of samples to the pass init method. But it still doesn’t work

horizontalBlur.init(renderManager.getRenderer(), screenWidth, screenHeight, Format.RGBA8, Format.Depth, numSample, hBlurMat);

Would you give some details?

He mean the bug I have posted last year:

http://hub.jmonkeyengine.org/t/possible-bug-dof-glsl-1-5-msaa/32494/22

yep that one.

Can you confirm my assumption that there is a bug in the Pass?

No
There is no bug, just something not implemented, as it’s not needed in the engine. your custom blur filter would need it though.
The blur shaders needs to account for multi sampled textures. you can look how it’s handled in the ColorOverlayFilter’s shaders.

I can’t see any difference to what I’ve already done in my previous post
I’m not able to get multi sampled blur working.

This is my current modified version (horizontal and vertical) of the JME blur:

#import "Common/ShaderLib/MultiSample.glsllib"

in vec2 texCoord;
out vec4 fragColor;

uniform COLORTEXTURE m_Texture; // this should hold the texture rendered by the horizontal blur pass
uniform float m_Size;
uniform float m_Scale;

void main(){ 
   float blurSize = m_Scale/m_Size;
   vec4 sum = vec4(0.0);

   // blur in x (vertical)
   // take nine samples, with the distance blurSize between them
   sum += getColor(m_Texture, vec2(texCoord.x- 4.0*blurSize, texCoord.y )) * 0.06;
   sum += getColor(m_Texture, vec2(texCoord.x- 3.0*blurSize, texCoord.y )) * 0.09;
   sum += getColor(m_Texture, vec2(texCoord.x - 2.0*blurSize, texCoord.y)) * 0.12;
   sum += getColor(m_Texture, vec2(texCoord.x- blurSize, texCoord.y )) * 0.15;
   sum += getColor(m_Texture, vec2(texCoord.x, texCoord.y)) * 0.16;
   sum += getColor(m_Texture, vec2(texCoord.x+ blurSize, texCoord.y )) * 0.15;
   sum += getColor(m_Texture, vec2(texCoord.x+ 2.0*blurSize, texCoord.y )) * 0.12;
   sum += getColor(m_Texture, vec2(texCoord.x+ 3.0*blurSize, texCoord.y )) * 0.09;
   sum += getColor(m_Texture, vec2(texCoord.x+ 4.0*blurSize, texCoord.y )) * 0.06;

   fragColor = sum;
}

Thats what I get ingame with 6x MSAA:
http://alrik-online.de/alrik/screens/qb%202016-03-12%2000-00-51-954.png

The GUI-Viewport is visible but not the main viewport which has the blur attached. The haunch of meet is visibile without atrifacts, because it is attached to a separate viewport.

tried with that?

Ok thanks everything works like expected. I have localized the problem! I don’t need the ColorOverlayFilter. After I updated the BlurFilter with multi sampling, the shader already works. But I had artifacts which you can see in the screenshot I’ve posted.

The artifacts are coming from these two lines:

Display.setResizable(true);
Display.setLocation(0, 0);

Have you any idea why these two lines corrupting all post filters with MSAA > 1 enabled?
You can also test this problem with the posted test case. You only need to add the two lines at the end of simpleInitApp()

Edit: It also doesn’t work anymore when I resize the window.

Hi,

are there any news?

I was not under the impression I had something more to do on this issue.

I’ve asked you something and JME has still a bug in the post filters. As you can see in the screenshot above. It seems that the post processor has a problem with resizing the window.

EDIT: Problem solved by the fix: Fixed an issue when resizing the viewport, with a FPP and antialiasin… · jMonkeyEngine/jmonkeyengine@619a323 · GitHub