   Deferred renderer image wiggles
  At first, my deferred renderer was half-assed and simply used a full-screen quad (with proper pixel -> texel offsets) for each light (bad idea [grin]).  Therefore, I decided to fix it up and make it use convex geometry for the lights.  So far so good, except now the final light colour seems to wiggle around on the screen when the camera is rotating or moving.  Once the camera settles, the wiggling stops.  It's very subtle, with with subtle camera movements it's like a double-negative and it becomes very annoyingly obvious.Any ideas what could cause this small wiggle?  I'm pretty sure it's not my scene graph lagging, because my OpenGL version of the renderer does not have this same little wiggle.  I believe it might be pixel -> texel offsets once again, as I do not do this on the convex geometry.  How would I do it?  Here is what my current UV calculation for the convex geometry looks like:// vertex shader (I'm using CG)OUT.p = mul(wvpMat, p); // final screen-space posOUT.uv = OUT.p;// fragment shader (again, CG)float2 fragPos = IN.uv.xy / IN.uv.w;// -1 is because generally +Y is down for textures but up for the screenfloat2 uv = float2(fragPos.x, fragPos.y * -1) * 0.5 + 0.5;(just to clarify, this wiggle looks like the screen is broken up into several pieces which move a pixel or two in some random direction when the camera rotates or moves, sort of like a mini earthquake)[Edited by - nullsquared on June 14, 2009 12:42:51 PM]
  Moved to DirectX.   ;  IIRC, there are certain subtleties to performing this kind of texture lookup. I remember encountering similar issues, and eventually solving them by using Tex2DProj for the sampling (projective sampling).I don't think I ever got down to exactly what it was that was different about how the sampling performed the projection, but that certainly solved my issues.   ;Quote:Original post by sirobIIRC, there are certain subtleties to performing this kind of texture lookup. I remember encountering similar issues, and eventually solving them by using Tex2DProj for the sampling (projective sampling).I don't think I ever got down to exactly what it was that was different about how the sampling performed the projection, but that certainly solved my issues.Thanks for the reply.  Changed to tex2Dproj (I used to do tex2Dlod with a manual divide by w), same issue.  Any other ideas?@ Promit: thanks.   ;  Indeed it was the pixel -> texel offset issue once more.Except, with a vengeance.  See, normally, I would offset things in the vertex shader by 1.0 / float2(width, height).  Since the results were in screen space [-1..1], this had the effect of half a pixel offset.However!  Doing this is a bad idea when rendering convex light geometry.  Why?  Perspective [wink].  You need to do it in the fragment shader, after you do the divide-by-W.  So, the end result looks like:float2 uv = fragmentPos.xy / fragmentPos.w;// normally we offset the screen-space geometry 0.5 pixels to the left and up// but now we must offset the UVs 0.5 pixels to the right and down, insteaduv += 1.0 / float2(width, height);// then, fix the UV to be [0..1] (and flip Y because +Y is up for// the screen, but down for textures)uv = float2(uv.x, -uv.y) * 0.5 + 0.5;[smile]   