Hello everyone,

I followed the Chapter "2.3: Simplified High-Quality Anti-Aliased Lines" from the ShaderX7 book. I copy-pasted the shader file from the CD and carefully ported the managing class to XNA. I cannot guarantee that the buffers are correctly filled but I am pretty sure.

Have a look at the first screenshot. The perspective is not correct. I chose my Line texture to be a square to enhance the effect. Looking at the wireframe (second screenshot), you can see that the vertex positions are in fact correct. The error is in the texture lookup.

I assume I cannot upload the whole shader since it's from the CD, but here are the lines that set the texture coordinates:

VS_OUTPUT VS(...) { [...] // Calculate Vertex Positions (works) VS_OUTPUT output; output.textureUV.x = weights.z; output.textureUV.y = weights.w; output.textureUV.z = 0.0f; output.textureUV.w = 1.0f; return output; } PS_OUTPUT PS(VS_OUTPUT input) { return g_Color * tex2Dproj( FilterTextureSampler, input.textureUV ); }

where weights contains the texture coordinates in z and w. g_Color is the Line's Color and FilterTextureSampler contains the square texture.

I understand that tex2Dproj divides the coordinates by the w-component. But w = 1.0f everywhere! Can somebody explain what this is supposed to do? Changing "tex2Dproj" to "tex2D" makes no difference. Why can't I just take the usual texture coordinates?