Hmmm

Published May 21, 2009
Advertisement
Was messing around with pixel shaders last night and I'm not sure my original strategy for rendering destruction is correct.

The way it's currently set up is that the destroyed elements of visible screen are built into a Texture2D by hand (eg: by directly modifying the Color[] array). This is then used to remove pixels from the render of the background by passing it as a texture sampler when I'm rendering out the tilemap. The first thing I noticed is that it didn't work, seemed to mainly corrupt the output - I think this is probably just my idiocy with pixel shaders.

I then realised that as I was just building up the destruction texture each frame anyway, I could (and maybe should) be just using this data to remove data from the visible background that's been rendered to a texture anyway. The problem is that it's CPU bound and doesn't seem as 'clean' as using the pixel shader (if I can get the shader to work). The main problem is that I'm building at least ONE of the textures outside the shader anyway... it doesn't seem 'nice'. The other option is that I could effectively render this destruction texture as a series of decals on the GPU by storing all the positions of past explosions - this might be faster and actually cleaner than messing about with manual texture creation.

I'm pretty new at GFX coding so opinions are very welcome.
Previous Entry yay
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement