PDA

View Full Version : Unexpected rasterization behavior



fred_em
07-02-2015, 06:19 AM
Hi,

We are experiencing a very odd behavior with hardware rasterization, at least on my nVidia card (GTX Titan Black, latest drivers, Windows).

In the attached capture (rasterizationissue.zip, which contains 1 PNG file), a scene with a single cube has been rendered. This watertight cube has 8 vertices, shared by 12 triangles.

At the pixel location highlighted in red, and only at that location, the fragment belonging to the back-facing triangle has a fragment depth (see below) coordinate *lower* than the corresponding fragment on the front facing triangle at that same pixel location.

My question is: is this situation supposed to ever happen? I haven't tried really hard yet, but I have not reproduced the issue with Intel or AMD hardware.

Fred


nb: forget about the shading effect on the sides on the cube, you can ignore this.

--------------------------------------

(*) Vertex shader code:


in vec4 mvf_vertex;
out vec4 v_Pos;

void main()
{
v_Pos = u_Projection * u_View * u_Model * mvf_vertex;
}

Fragment shader:


in vec4 v_Pos;


-> v_Pos.z here is the fragment depth.

I guess the same thing would happen with the depth found in gl_FragCoord.