Jump to content

  • Log In with Google      Sign In   
  • Create Account


[SOLVED] HDR PBR, exceeded FP16 range


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 n00body   Members   -  Reputation: 274

Like
1Likes
Like

Posted 09 January 2014 - 10:00 PM

Background

I've been developing a physically-based shader framework for Unity3D. I am using the Normalized Blinn Phong NDF, and an approximation to the Schlick visibility function. I am using an effective specular power range of [4,8192] for direct illumination. I have also developed a translucent shader that uses premultiplied alpha to only make the diffuse translucent while preserving the specular intensity based on fresnel.

 

For all my testing, I am doing everything in Linear HDR mode which affords me an FP16 render target for my camera.

 

Situation

So this is a highly contrived scenario, but my team's artist managed to make it happen. Basically he has a scene with a directional light whose intensity is effectively 1.0 (0.5 input for Unity)  shining on a glass bottle surrounding a smooth metallic liquid. As a result, the two substances' highlights overlapped and their combined intensity seems to have exceeded the range of the FP16 render target. This resulted in weird artifacts where the the highest intensity color component went to black, while the other two just looked really bright. (see example image below).

 
ExceededPrescisionOfHDR.jpg

 

Upon further testing, I found I could remove the artifact by making the surface more rough, thus reducing the intensity of the highlight. However, I still found it having this visual error for even relatively rough overlapping materials.

 

Questions

1.) Is there any way to prevent this from happening programmatically without having to clamp the light values to an upper limit or otherwise harm the visual quality?

2.) Is it just something that falls to the artist to avoid doing?

3.) Even so, this means that I can't have multiple overlapping translucent objects or have to be careful about what objects pass behind them. Am I missing something here?

4.) Just for future reference, what is the actual upper limit value of FP16?

 

Thanks for any help you can provide.


Edited by n00body, 11 January 2014 - 11:16 AM.


[Hardware:] Windows 7, Nvidia Geforce GT 440, AMD Athlon II X4 620, 6GB RAM

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework | Free RNM Shaders


Sponsor:

#2 Hodgman   Moderators   -  Reputation: 29294

Like
2Likes
Like

Posted 09 January 2014 - 10:14 PM

1) I just use this method - clamping to the max half-float value. Anything that bright is surely going to be mapped to white by your tone-mapper anyway, so you shouldn't actually lose any quality by doing this.

 

2) It's also the fault of your light sources. Point lights don't actually make any physical sense -- you try and work out the math and you end up with infinity radiance all over the place... A perfectly smooth surface lit by a point light is always going to behave a bit weird. In a perfectly realistic renderer, the artist would also be able to tweak the size of their 'point' (sphere) lights.

 

3) When light is passing through, from behind a translucent surface toward the camera, you should also take the fresnel/BRDF into account there -- some percentage of that background light is going to be reflected away and not make it to the camera.



#3 MJP   Moderators   -  Reputation: 10799

Like
2Likes
Like

Posted 10 January 2014 - 12:49 AM

We actually used to hit that problem all of time. We fixed it by clamping the output in the pixel shader, although clamping to the max fp16 value doesn't work since that can still overflow when summed with the render target contents in the ROPS. We ended up clamping to a value that was suitably large in order to map to white after tone mapping for all reasonable exposure ranges used in the game.



#4 n00body   Members   -  Reputation: 274

Like
0Likes
Like

Posted 10 January 2014 - 05:38 AM

@MJP

Any chance you could tell me what that value was? Was it something relative to your tonemapping algorithm? 



[Hardware:] Windows 7, Nvidia Geforce GT 440, AMD Athlon II X4 620, 6GB RAM

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework | Free RNM Shaders


#5 n00body   Members   -  Reputation: 274

Like
0Likes
Like

Posted 10 January 2014 - 11:32 AM

Actually, let me be more specific about my situation. In Unity, my tech can potentially be used in multipass light accumulation, single-pass translucent, and Light PrePass deferred. So knowing that:

  1. What value would you recommend I clamp my illumination to to keep it from blowing out?
  2. Should I be clamping at each light's output, or the final combined output for a given surface with all lighting?
  3. If during the each light's output, then what should I do about LPP mode where the lights are accumulated without material colors?

Thanks.



[Hardware:] Windows 7, Nvidia Geforce GT 440, AMD Athlon II X4 620, 6GB RAM

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework | Free RNM Shaders


#6 n00body   Members   -  Reputation: 274

Like
0Likes
Like

Posted 11 January 2014 - 11:20 AM

Well I feel silly about this. It turns out that it was a bug unique to Unity3D because of code they want you to add when doing custom forward lighting. Basically, they have you put the luminance of the specular lighting in the alpha channel of the lighting function's color output. Apparently this breaks down if the specular lighting has a ridiculously high value. Once I removed this, it started working fine again. 



[Hardware:] Windows 7, Nvidia Geforce GT 440, AMD Athlon II X4 620, 6GB RAM

[Websites:] Development Blog | LinkedIn
[Unity3D :] Alloy Physical Shader Framework | Free RNM Shaders





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS