0
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\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, 2014 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .