• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
davepl1968

HDR Bloom Question

3 posts in this topic

I'm doing the good old "HDR Bloom like an old Atari vector monitor" effect, and have a couple of questions:

 

1) For my initial draw surface, I am using D3DFMT_A16B16G16R16 and want to make sure that's an appropriate choice.

 

2) I'd like to confirm that my intermediate textures (where you step down to half size and gaussian blur) do not need extra bits; or do they?  For the set of 4 or 5 bloom textures, what pixel format should I use for them?

 

3) And perhaps most important, how do you actually -draw- at "higher than 1.0" intensities?  Do you really return RGB color components > 1.0, or do the extra HDR bits only get used from combined blending and so forth?

 

Thanks!

Dave

0

Share this post


Link to post
Share on other sites

1) For my initial draw surface, I am using D3DFMT_A16B16G16R16 and want to make sure that's an appropriate choice.
3) And perhaps most important, how do you actually -draw- at "higher than 1.0" intensities?  Do you really return RGB color components > 1.0, or do the extra HDR bits only get used from combined blending and so forth?

D3DFMT_A16B16G16R16 only stores values from 0-1, but it does so in increments of 1/65535th, instead of increments of 1/255th for a regular 8-bit texture.

When renering in HDR with this format, 1.0 is your maximum intensity, so if you want to use some other maximum, you have to divide by it at the end of your pixel shader.

e.g. if you want to store RGB intensity values from 0-10, you'd use something like:
return result * float4(0.1, 0.1, 0.1, 1)

Alternatively, you can use the D3DFMT_A16B16G16R16F format, which stores values from ~-65k to ~+65k, with floating point precision (small numbers are very precise, large numbers are less precise).
 
If you know what your maximum intensity value is, and it's a fairly small range, then the first method works very well.
If you don't know what your maximum intensity is, or it's a very large range, then the second method may be easier.
 

2) I'd like to confirm that my intermediate textures (where you step down to half size and gaussian blur) do not need extra bits; or do they?  For the set of 4 or 5 bloom textures, what pixel format should I use for them?

That depends. In my renderer, I use the floating-point texture format, because I'm representing a variety of scenes with no upper limit on intensity values (besides the format's limitation of ~65k as a max value). I then assume that "bloom" occurs due to unwanted reflections in the camera lens, and arbitrarily say that this consists of 3% of the light hitting the lens.
So when I copy the main rendering to my small "bloom" texture, I multiply it by 0.03 (this is often called the "threshold" step), which gives me a max range of 0 to ~1950.
At the moment I'm also using 16F textures for these small bloom targets our of simplicity, but as an optimisation, I could use 8-bit textures instead.
What I'd do here is the same as above; I'd divide by the maximum value to remap them to the range of 0-1.

e.g. assuming the maximum bloom value is 1950:
instead of bloom = original * 0.03, I'd use bloom = original * 0.03 / 1950.

 

This should produce a number from 0-1. When the GPU tries to save that number into an 8-bit texture, it will round it to the nearest 1/255th.

 

 

If I was using the non-floating point HDR method (so my original values were in the range of 0-1), with a max range of 10 as above:

decoded = original * 10;// unpack stored 0-1 value to our actual intensity range

bloom = original * 0.03 / 0.3;//maximum bloom value is 10*0.03 == 0.3. Remap 0.3 to 1.0 for storage in 8 bit texture.

 

Then later when applying the bloom to the screen:

decodedBloom = texture * 0.3;//the texture stored 0.3 as 1.0. Remap 1.0 back to 0.3

2

Share this post


Link to post
Share on other sites

Thanks!  On some systems the are "resolve" steps wherein you can apply the threshold bias in that resolve step; since I'm on DX9 my closest is StretchRect, but it cannot apply any biasing or adjustment during the copy.  Would it make sense to have my pixel shader apply the threshold division, since I cannot do it in a resolve step?

0

Share this post


Link to post
Share on other sites

Yeah it's quite normal to do this in a pixel shader. You can do it at the same time as downsampling -- and note that some people write custom downsampling shaders, e.g. in this thread, Telanor found that writing a 4-tap shader that goes from 100% res -> 25% res in one pass, was faster than a 1-tap shader going from 100% -> 50% -> 25% in two passes.

http://www.gamedev.net/topic/647107-question-about-downsampling/

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0