   vertex position to screenspace texture coordinates
  Im using directX vs/ps 1.1 I'm Doing two passes on my environment. The first renders the environment with special colors to a linear texture. The second pass needs to reference that texture. That is, In the second passes’ pixel shader I need to see the color that it wrote to the same pixel in the first pass. I do this by placing the texture in a texture stage, and setting up the texture coordinates in the vertex shader so that the first texture lines up nicely as an overlay.here is the relevant vertex shader code:;;first transform the vertex position by the view projectiondph R_TEMP0.x, V_POSITION, C_VIEWPROJ_Xdph R_TEMP0.y, V_POSITION, C_VIEWPROJ_Ydph R_TEMP0.zw,V_POSITION, C_VIEWPROJ_Wadd R_TEMP0, R_TEMP0.xyww, R_TEMP0.wwww ; range-compress texcoordsrcp R_TEMP0.w, R_TEMP0.wmul R_TEMP0.xy, R_TEMP0, R_TEMP0.w ; do the divide heresub R_TEMP0.y, V_ONE, R_TEMP0.y ;flip the texture over, this is just a fix to the units.mul oT3.x, R_TEMP0.x, C_TEXTURE_SCALE_Xmul oT3.y, R_TEMP0.y, C_TEXTURE_SCALE_YThis works great, the texture lines up properly, and everything looks fine.Except for one problem. With polygons that clip off the screen, the texture coordinates for that polygon are distorted and it doesn’t line up properly. Im really not sure where to even begin to fix this, and I dont fully understand the problem other than it must have something to do with clipping.[Edited by - lima on December 15, 2005 6:00:46 PM]
  Do you mean polygons that are referencing the first pass texture or polygons that are used to generate the first pass texture?  Maybe you could post a screen shot?   