   get Pixel position
  Hi there,I'm having trouble with an image space shader I'm working on. Basically the idea is for the pixel shader to look at an incoming texture and check the points in the texture where a value is equal to a specified value. Just a boolean true/false. But I then want the UV coordinates of the point where the value = 1. Which I then want to use to transform the TexCoords of a second texture so the centre of this texture is at the said point.Currently I have the incoming texture. An if statement checks where the pixel is which is needed. Then, I have been thinking that if the if statement returns true, I should be able to take the TexCoords directly from the moment a 1 is returned and use that to offset my second texture's coords. Does this sound correct in theory? I'm fairly new to shader writing and still feel a bit misty round the whole dependent lookup thing...I'd post some sample code but it needs tidying up and I thought this is probably something I could explain and expect it's a bit of a noob question too...I guess what I'm asking is how you get the uv coords of the current pixel being calculated-or is this not possible because of the parallel nature of GPUs?There's a second point on this too. If the incoming texture has a number of points which test true then to have a number of the second texture aligned to each point, I reckon using a render target to accumulate the previous output textures is the way to go.  But, how would I make the shader only pick, say the first pixel which tested true and then ignore that pixel on subsequent passes?Thanks in advance,Jon   
  Well...in Cg shaders you can get the window position of a pixel in the pixel shader by using the WPOS semantic. To convert it to a full screen texcoord just divide by the width and height of the screen (or texture you are using).would look something like.....in float3 wp : WPOSuniform float2 size //make sure you pass width as x and height as ywp.xy = wp.xy / size;;  FYI the HLSL equivalent of WPOS is VPOS.  No idea if GLSL has an equivalent.An alternative is to pass the clip-space position of your vertices to your pixel shader (don't divide by W until you get to the pixel shader) and then you'll have screen-space X and Y coordinates in the range [-1, 1].   ;  GLSL has gl_FragCoord in the pixel shader.   