Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture data storage

Started by outlawhacker May 30, 2006 at 3:44 AM 1 replies 600+ views
Original Post
outlawhacker
outlawhacker
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 :)
XiotexStudios
XiotexStudios
In what way are they wrong?

Could it be something to do with the filter mode?
Byron Atkinson-JonesXiotex Studioswww.xiotex.com
outlawhacker
outlawhacker
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 :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.