Rendering one quad for every pixel
I'm trying to render one quad over every pixel in the screen, and my code: http://pastebin.com/AwY0yfyq Doesn't seem to be working. It works when I render one point with point size 1 at the center of every pixel, but not with quads. Any idea what I'm doing wrong?
Uh, maybe what you're doing wrong is trying to rasterize a one pixel quad? That doesn't make sense -- what are you trying to accomplish here? (That said I'm not exactly sure why this doesn't work as written...)
Nah, I'm quite certain that *IS* what I want to do. It's a learning exercise. It's just that I don't know how to do it as you can see..
Can you post the missing bits of relevant code, like HalfPixelNDCDimensions, PixelDimensions, etc...
I would guess that either your quads are backfacing (with backface culling enabled), or they're not covering the pixel sample locations.
I would guess that either your quads are backfacing (with backface culling enabled), or they're not covering the pixel sample locations.
You know what, I actually did that before you mentioned it and they seem to occupy a grid pattern with gaps. However when I change the quad coordinates calculation code to this it works perfectly:
Any idea why that is though?
const float2 PixelLowerLeft = (CurrentPixelNormalized + float2(-HalfPixelDimensions.x, -HalfPixelDimensions.y)) * float2(2.0, 2.0) - float2(1.0, 1.0);
const float2 PixelLowerRight = (CurrentPixelNormalized + float2(HalfPixelDimensions.x, -HalfPixelDimensions.y)) * float2(2.0, 2.0) - float2(1.0, 1.0);
const float2 PixelUpperRight = (CurrentPixelNormalized + float2(HalfPixelDimensions.x, HalfPixelDimensions.y)) * float2(2.0, 2.0) - float2(1.0, 1.0);
const float2 PixelUpperLeft = (CurrentPixelNormalized + float2(-HalfPixelDimensions.x, HalfPixelDimensions.y)) * float2(2.0, 2.0) - float2(1.0, 1.0);
Any idea why that is though?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement