PDA

View Full Version : rendering acne...



craouette
11-01-2013, 03:12 AM
My current rendering engine is using the following algorithm:
*First, render the scene from the point of view of the camera, with a pure black shader and writing to the depth buffer
*Then, for each light:
- render the shadow buffer to a frame buffer linked only of a depth texture
- for each layer of material
+ render the scene, with blend set, no write to the depth buffer, and depth comparison set to less or equal


But I got rendering a.c.n.e (sorry, seems the word is refused in post) !!

So, my main question is:
Is it possible to render to a fame Buffer in order to fill a texture while rendering in the default/static back buffer (not at the same time, but rendering something in the back buffer, then switch the rendering buffer, render a shadow map or a reflection map, and back to render the scene to the back buffer)?
Or do I need to use a render buffer for the main rendering too (which is not that bad, I will be able to switch to a linear workflow)?

Thanks for any helps,

Craouette

Dan Bartlett
11-01-2013, 04:19 AM
There's an easy-to-follow shadow mapping tutorial here: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/ that discusses shadow acne.

craouette
11-01-2013, 04:55 AM
No, the problem I have is not shadow a.c.n.e... this one, I know what to do.
It is rendering a.c.n.e: I render the Z buffer first in order to avoid to use costly shader on pixel that will be written over by near object, then disable the write to z buffer.
Then, I render my scene again many times, with the same projection and modelview matrices, but disabling the write to z-buffer and setting the depth func to GL_LEQUAL.
The many times account for the lights... I render the scene one time for each light. So that i can create the shadow map before.

The a.c.n.e I have is not in the shadow but in the rendering itself, like if the equal test to the z buffer is failing from time to time... but may be I am wrong! will check further!
But my question is still: is possible to render at same time to more than one rendering buffer (so to render buffer 1, then switch to render buffer 2, go back to render buffer 1 using the result of render buffer 2 without interferences)?

Dark Photon
11-01-2013, 07:26 PM
Then, I render my scene again many times, with the same projection and modelview matrices, but disabling the write to z-buffer and setting the depth func to GL_LEQUAL.

Use GL_EQUAL.


But my question is still: is possible to render at same time to more than one rendering buffer (so to render buffer 1, then switch to render buffer 2, go back to render buffer 1 using the result of render buffer 2 without interferences)?
Yes, you can do this kind of ping-pong rendering if you want. You can also render/write to multiple rendering buffers simultanously if/when needed.

Dan Bartlett
11-01-2013, 07:44 PM
Maybe you need to use the "invariant" qualifier to ensure your passes produce the same output?

craouette
11-02-2013, 05:16 AM
ok, so the problem is in my code... I will track it down. Thanks a lot for your help.
I also will look for the invariant qualifier, I never heard of it!!

mapo125
11-02-2013, 10:18 AM
77777777777uuuuuuuuuuupppppppppppppppppppppppppppp pppppppppp

craouette
11-03-2013, 05:40 AM
mapo125: ????


I found the problem... first shader, I used gl_Position = ftransform(); second shader, I used:
vec4 vVertex = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * vVertex;