Sign in to follow this  

Texture data storage

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm doing rendering to texture in shaders to store positions of particles. I'm trying to create a DX version of Lutz Latta's "Building a million particle system". I've managed to to simple rendering of my billboards, but when I try to transfer my computed positions to my render target something goes wrong. I'm doing it like this (pseudo-code 'cause I don't have my project here): In cpp:
// Create a render target texture of same width and height as the texture I'm
// getting old values from
CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, FMT_A32R32G32B32,...)

// Store original render target (backbuffer)
// Get the surface of my texture
// Set surface as render target
// DrawPrimitive()...
// Set back buffer to render target

// Store position values in a another texture


In the shader:
// Get values in vertex shader


float4 pos = tex2Dlod(PositionMap, uvVertex);
float4 vel = tex2Dlod(VelocityMap, uvVertex);

pos += vel;

return pos;

// This position value should now be rendered to my render target texture


The values are correct in the first vertex shader pass, but they don't seem to be stored correctly when rendering them to the next texture. I'm drawing a quad to get the DrawPrimitive going. Is there anything I should think of when rendering to a texture? Size of texture? Format? Thanks in advance for help :)

Share this post


Link to post
Share on other sites
D'oh! Embarrasing!

I did not run my render pass, only the update pass. :/

That only cost me half a day...yawn...

Thanks for helping :)

Share this post


Link to post
Share on other sites

This topic is 4249 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this