Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is it possible to render vertex data from a triangular grid into a texture with a same size (i.e. 3x3 vertices to 3x3 pixels - each pixel is representing one vertex)?

Consider following situation. I have a grid (3x3 to keep it simple) and in a vertex shader is a computation of Z coordinate (imagine it like some wave model of a water surface). So, each vertex has some Z value, and I need to store these values into a texture (for a comparison with a next frame). A texture is set as a render target and has a same size as the grid.

How to render a precise Z value (coordinate) of a vertex into appropriate pixel? I mean, my dilemma is a fact that rasterizer gets three vertices and interpolates their values by default, so values stored in pixels are not precise at all.

share|improve this question

1 Answer 1

If you are using DX11, you could use DirectCompute style and its buffers (RWStructuredBuffer and StructuredBuffer) instead of texture. They should be writable from shaders.

share|improve this answer
    
Thank you for your response, I'll give it a try. But I'm still curious how to do it in the "old" way by using Texture2D. –  Jan Tobola Feb 3 '14 at 12:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.