Jump to content

Moving to full HDR?


klepto2
 Share

Recommended Posts

As posted on discord I have tried to improve the existing Bloom shader to go more to the current industry standard. While the bloom shader is good and solid, its technique is a bit outdated and normally not used anymore.  Also a lot of posteprocessing effects, overall lighting in PBR reflections, etc might look better when switching to a full HDR pipeline.

Current state (from my investigations):

  • The framebuffer uses RGBA8 format
  • This framebuffer is passed to the posteffect pipeline as an "entry" texture
    • So no posteffect can use real HDR operation

Proposed state:

  • The framebuffer should use GL_R11F_G11F_B10F or GL_RGBA16F
  • With this colors can be  stored in their HDR form 
  • Before displaying a tonemapping should be applied 

Why:

Lets take a closer look to Bloom (I have just focused on it, but can provide more samples if wanted)

Lets say you have a very green object with a Color RGB = 80,255,74 or in Vec4 it would be (0.31,1.0, 0.29).
SDR: 

  • When adding lighting etc. to it or change the brightness to something above lets say 400
    • The resulting color in the rendering will always be 1.0,1.0,1.0 
    • It is clamped by the RGBA8 format 
    • Adding thinks like tonemapping, reflections etc will look washed out :
      image.thumb.png.08a7c4c16e9d89fe594a07fc3c8b9bb2.png

HDR:

  • Same as for LDR 
    • Without any lighting the stored color will now be vec3: 1.24, 4.0, 1.16
    • this can properly be used for bloom to define where bloom will occur
      • with the current approach white areas (1.0,1.0,1.0) are considered blooming even if they shouldn't
      • with hdr those pure white areas stay uneffected and only real emitting surfaces are providing bloom.
      • not only that, the bloom will be more physically correct: like in this sample:all_lightsaber_colors_by_darthvader86755
      • you can see that in the middle: the emmision accumulates up in the middle and the emission fades out with the distance.

Some more resources: 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

If you are rendering to a texture, as you are when any post-processing or MSAA is in use, the color format is RGBA16F. So as you are performing rendering, all the intermediate steps will use high=precision color, and the results don't get clamped to 0-1 until the final output.

I don't have an HDR monitor, so I don't currently have any way of testing HDR color output.

I am sending some code for the framebuffer setup you can experiment with if you would like.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...