Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualchronozphere

Posted 08 January 2013 - 12:55 PM

Hey guys,

I've got the following weird issue.

I'm trying to implement multipass lighting and I encountered some sort of Z-fighting issue. I perform one ambient/diffuse pass with glDepthFunc(GL_LESS) and then a additive light pass with glDepthFunc(GL_EQUAL) with depth writes disabled. When I pan my camera around, I get huge flickering artifacts.

The vertex shader for the light pass contains:
uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection; void main() {aPosition = uView * uModel * vPosition;gl_Position = uProjection * aPosition;
I'd pass aPosition to the fragment shader to do the lighting with. When I change this to:

aPosition = uView * uModel * vPosition;gl_Position = uProjection * uView * uModel * vPosition;
it suddenly works without flickering. What's going on?
Does an assignment inbetween some math expressions create errors?

Thanks a bunch! smile.png

#2chronozphere

Posted 08 January 2013 - 12:55 PM

Hey guys,

I've got the following weird issue.

I'm trying to implement multipass lighting and I encountered some sort of Z-fighting issue. I perform one ambient/diffuse pass with glDepthFunc(GL_LESS) and then a additive light pass with glDepthFunc(GL_EQUAL) with depth writes disabled. When I pan my camera around, I get huge flickering artifacts.

The vertex shader for the light pass contains:
uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection; void main() {aPosition = uView * uModel * vPosition;gl_Position = uProjection * aPosition;
I'd pass aPosition to the fragment shader to do the lighting with. When I change this to:

aPosition = uView * uModel * vPosition;gl_Position = uProjection * uView * uModel * vPosition;
it suddenly works without flickering. What's going on?
Does an assignment inbetween some math expressions create errors?

Thanks a bunch! smile.png

#1chronozphere

Posted 07 January 2013 - 10:30 AM

Hey guys,

 

I've got the following weird issue.

 

I'm trying to implement multipass lighting and I encountered some sort of Z-fighting issue. I perform one ambient/diffuse pass with glDepthFunc(GL_LESS) and then a additive light pass with glDepthFunc(GL_EQUAL) with depth writes disabled. When I pan my camera around, I get huge flickering artifacts.

 

The vertex shader for the light pass contains:

uniform mat4 uModel;
uniform mat4 uView;
uniform mat4 uProjection;
 
void main() 
{
aPosition = uView * uModel * vPosition;
gl_Position = uProjection * aPosition;
 
I'd pass aPosition to the fragment shader to do the lighting with. When I change this to:
 

aPosition = uView * uModel * vPosition;
gl_Position = uProjection * uView * uModel * aPosition;
 
it suddenly works without flickering. What's going on?
Does an assignment inbetween some math expressions create errors?
 
Thanks a bunch! smile.png

PARTNERS