# How to control in the vertex shader where pixel ends up in the renderTarget?

What if I have an arbitrary renderTarget, that is smaller than the screen (say it is 1x1 pixel) and I want to make sure in the VertexShaderFunction that all my pixels end up exactly in that 1 pixel region? No matter what I do, they all seem to get culled at some point, though GraphicDevise.Clear() works OK.

Where is the top left corner of the renderTarget Vertex-shader-vise? I tried output.Position = (0,0,0,0)/(0,0,0,1)/(1,1,1,1)/(-0.5,0.5,0,1) NOTHING works!

Fullscreen quad is not an option 'cause I actually need to process geometry in the shaders to get the results I need.

• This won't work. A vertex shader doesn't have a concept of "pixels" or even "triangles". If you move all the vertices into one place you will get no output. If you spread the vertices out (somehow - it would be very convoluted) - then you've just ended up with a full-screen quad. Jul 28 '13 at 13:27
• ok that's what I need - I need to save original vertex info to compute screen position, but I need to "spread" the vertices to get the fullscreen quad. Jul 28 '13 at 13:29
• The simplest way to do that is to probably create a second version of your mesh. Duplicate vertices - 3 per triangle - no index buffer. For each vertex, also store an appropriate vector so that each triangle has both its original coordinates, and coordinates to cover the screen (full-screen-triangle: so its vertices extend beyond the screen edges). Like I said: convoluted. You almost certainly do not want to do this. Like I said on your previous question on SO - you're asking detailed implementation questions for an approach that is fundamentally flawed. Ask a higher-level question. Jul 28 '13 at 13:43
• maybe u r right, it's just very attractive an idea u know). Will be sure to try this thing. BTW How would I pass those extra vertices to the shader? Jul 28 '13 at 14:01
• Probably in POSITION1 (MSDN). On the XNA side you need a custom vertex format; set VertexElement.UsageIndex to 1. Jul 28 '13 at 14:19