Jump to content
  • Advertisement
Sign in to follow this  
emdin

Clear/ColorFill and Floating-point textures

This topic is 5005 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've written a nice little effect that I would very much like to try out with float-point render-target textures. But I'm having a hard time finding information about how they differ from regular textures. I'm using D3DFMT_R32F to create a kind of heightmap. Now I'm wondering if anyone can help me out by answering these questions: 1) When I clear the texture, clearing it with color 0x00000000 seems to set the values in the texture to 0, but how would I do if I wanted to set it to say 100.0f? 2) How would I do the same thing if I used say D3DFMT_R16F or D3DFMT_A32B32G32R32F instead? 3) While we're at it, how would I do it with D3DFMT_A16B16G16R16. 4) Would a solution to 1), 2) and 3) work the same way with ColorFill? 5) If I would just "render" the texture to the backbuffer, would the output just be clamped to the [0..1] range? Or would large values/negative values behave different?

Share this post


Link to post
Share on other sites
Advertisement
There was a thread on the DIRECTXDEV mailing list some time ago about clearing a floating point render target. Bottom line is, you can't do it with Clear( ). Your only option is to do it by rendering a fullscreen quad that mimmicks a clear operation. Have a read of the mailing list archives for more discussion.

Original thread: Clearing a floating point color buffer to a value > 1
Reply 1, Reply 2, Reply 3.

hth
Jack

Share this post


Link to post
Share on other sites
JollyJoffers is right. Colorfil is not a good way to do it because it requires that the surface be lockable. Underneath, Colorfil will lock the surface and copy things in by hand. This is too slow in my opinion

About two years ago I ran into the same thing. I was using a floating point render target as a shadow map because I wanted to store real distances instead of projected distances. The only way I found to set the initial values of this target to something greater thatn 1.0 was to render a quad the size of my shadow map and have the pixel shader set the value stored at each pixel to whatever constant I wanted.

neneboricua

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!