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.


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.

| improve this answer | |
  • \$\begingroup\$ 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. \$\endgroup\$ – jantobola Feb 3 '14 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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