Jump to content
  • Advertisement
Sign in to follow this  
Corefanatic

DX11 DX11 deffered render, position saving question

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

Hi all,

I am trying to implement deferred renderer using the description in a book, "Practical Rendering & Computation with Direct3D 11".

The description saves the world space position of the fragments into gbuffer. The problem I have is that the description does not say what DXGI format to use for positions.

Currently I use [font="Arial"]DXGI_FORMAT_R8G8B8A8_UNORM for albdeo and specular, and DXGI_FORMAT_R8G8B8A8_SNORM for[/font]
[font="Arial"]normalized world space normals[/font]
[font="Arial"]
[/font]
[font="Arial"]If I use SNORM for position, it will get clamped to -1,1 and this is exactly waht I don'd want.[/font]
[font="Arial"]
[/font]
[font="Arial"]What should I use in order to save my position?[/font]
[font="Arial"]
[/font]
[font="Arial"]Thx for any help[/font]

Share this post


Link to post
Share on other sites
Advertisement
DXGI_FORMAT_R32G32B32_FLOAT or 16bit.

edit: there is no 16bit format for 3 components only DXGI_FORMAT_R16G16B16A16_FLOAT.[url=""][/url]


The alternative is that you reconstruct position from z-buffer (google).

Share this post


Link to post
Share on other sites
Hey, I was the author of that chapter.

For the unoptimized version of the deferred renderer, I used a DXGI_FORMAT_R32G32B32A32_FLOAT texture for storing position. Obviously that's inefficient, but the whole point of that section was to do things the simplest way possible without regards for performance. You could also use DXGI_FORMAT_R16G16B16A16_FLOAT for position, but you are likely to encounter precision issues. The best way to do it is to reconstruct position from your depth buffer, which is described in detail in the optimizations section. But I would recommend getting it working with a position buffer first, and worry about optimizing it later.

BTW there's a sample that demonstrates the techniques in that chapter available on the Hieroglyph 3 site, if you ever need a reference.

Share this post


Link to post
Share on other sites
Thx guys,

MJP I love the book, it is very well written and the diagrams really help since I am a more of a visual learner. Right now I am not too worried about performance until I get everything working.

I will take a look at Hieroglyph.

Btw I am using DX10 feature level, so I cannot have read-only depth buffer, does it mean I have to copy the buffer to read it even if I am using DX11 as API?

Share this post


Link to post
Share on other sites

Thx guys,

MJP I love the book, it is very well written and the diagrams really help since I am a more of a visual learner. Right now I am not too worried about performance until I get everything working.


I'm glad you find it useful! If you ever have any questions you can feel free to PM me or ask here. I can also put you in touch with the other 2 authors if necessary.



Btw I am using DX10 feature level, so I cannot have read-only depth buffer, does it mean I have to copy the buffer to read it even if I am using DX11 as API?


Yeah unfortunately you can't read from the buffer and use it for depth testing at the same time, so you would need to copy it. Another option is to write out depth to another render target, and use that instead.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!