Jump to content
  • Advertisement
Sign in to follow this  
MickeyMouse

Clear R32F render target to arbitrary value

This topic is 4889 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

Is there any trick to clear floating point render target to arbitrary value from outside 0..1 range? ID3DRenderDevice9::Clear [edit: I meant IDirect3DDevice9 of course] seems to be able to clear to values between 0..1 only Thanks. [Edited by - MickeyMouse on July 30, 2005 2:39:24 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hi there MickeyMouse,
How are you doing?

Well there is no such interface as the ID3DRenderDevice9, but there is the IDirect3DDevice9 Interface and I assume you are talking about the device, and the clear method of the device.
The only floating point value is the Z value.

"Z [in] Clear the depth buffer to this new z value which ranges from 0 to 1. See remarks."

and then

"Remarks

Use this method to clear a surface including: a render target, all render targets in an MRT, a stencil buffer, or a depth buffer. Flags determines how many surfaces are cleared. Use pRects to clear a subset of a surface defined by an array of rectangles.

IDirect3DDevice9::Clear will fail if you:

Try to clear either the depth buffer or the stencil buffer of a render target that does not have an attached depth buffer.
Try to clear the stencil buffer when the depth buffer does not contain stencil data. "

I hope this helps :)

Share this post


Link to post
Share on other sites
Yes, I meant IDirect3DDevice9 of course.
Well, I've read documentation on its Clear method before, but it clearly sais it can clear only within 0..1 range...

Share this post


Link to post
Share on other sites
I suppose you *could* just render a fullscreen quad to the buffer in an ortho projection, with the colour of your choosing.. though that would be ungodly slow.

just a thought.

Share this post


Link to post
Share on other sites
Quote:
Original post by sordid
I suppose you *could* just render a fullscreen quad to the buffer in an ortho projection, with the colour of your choosing.. though that would be ungodly slow.

just a thought.
I tried doing it this way using pixel shader to write appropriate values. It's not as slow as I expected, but it's far from the Clear method's performance.

Share this post


Link to post
Share on other sites
Quote:
Original post by MickeyMouse
Quote:
Original post by sordid
I suppose you *could* just render a fullscreen quad to the buffer in an ortho projection, with the colour of your choosing.. though that would be ungodly slow.

just a thought.
I tried doing it this way using pixel shader to write appropriate values. It's not as slow as I expected, but it's far from the Clear method's performance.


This was asked on DIRECTXDEV a while back IIRC, the bottom line was that you will have to use a pixel shader (or just a HDR texture with the correct value) to clear to an arbitrary value. The current implementation of IDirect3DDevice9::Clear() will not write outside of the 0..1 range [smile]

HDRI technology rocks, but there are still a few rough edges - texture blending being another one [smile]

hth
Jack

Share this post


Link to post
Share on other sites
Thanks everyone.

I'd expect rendering full screen floating point texture would be slower than outputting some constant value using pixel shader, but I'll try this as well, thanks.

Now that's obvious DirectX 10 will have to (well, it's actually already designed) add some enhanced Clear function for use with floating point values textures.

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!