Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cook-Torrance] Investigate UE4's Fresnel Shlick optimization #16

Open
Razakhel opened this issue Aug 18, 2020 · 0 comments
Open

[Cook-Torrance] Investigate UE4's Fresnel Shlick optimization #16

Razakhel opened this issue Aug 18, 2020 · 0 comments
Labels
Enhancement New feature or improvement Rendering Issues related to rendering

Comments

@Razakhel
Copy link
Owner

Razakhel commented Aug 18, 2020

Instead of the common Fresnel calculation, Brian Karis suggests using a spherical gaussian approximation, which he deems more efficient with unnoticeable differences.

As such, the current Fresnel calculation:

Standard formula

vec3 fresnel = baseReflectivity + (1.0 - baseReflectivity) * pow(1.0 - cosTheta, 5.0);

would become:

Optimization formula

vec3 fresnel = baseReflectivity + (1.0 - baseReflectivity) * pow(2.0, (-5.55473 * cosTheta - 6.98316) * cosTheta);

In RaZ's case, this actually fixes black artifacts when the light's position is strictly equivalent to the camera's (which should not happen in real life cases):

Fresnel artifacts
Fresnel optimization

This optimization should probably be investigated, as the artifacts may come from a small blunder in the implementation.

@Razakhel Razakhel added Enhancement New feature or improvement Rendering Issues related to rendering labels Aug 18, 2020
Razakhel added a commit that referenced this issue Sep 29, 2020
- In regards to the removed artifacts, it has been deemed better than the current calculation
  - This may still need further investigation as to why the artifacts appeared

- Related to issue #16
Razakhel added a commit that referenced this issue Nov 17, 2020
- In regards to the removed artifacts, it has been deemed better than the current calculation
  - This may still need further investigation as to why the artifacts appeared

- Related to issue #16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or improvement Rendering Issues related to rendering
Projects
None yet
Development

No branches or pull requests

1 participant