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

Add energy compensation #198

Open
dmnsgn opened this issue Apr 26, 2019 · 7 comments
Open

Add energy compensation #198

dmnsgn opened this issue Apr 26, 2019 · 7 comments

Comments

@dmnsgn
Copy link
Member

dmnsgn commented Apr 26, 2019

No description provided.

@vorg
Copy link
Member

vorg commented Apr 26, 2019

To be precise i mean multiscatter ggx preventing loosing energy from IBL for metallic materials

This is tested using Furnace Test with pure white environment map. As you can see rough material on the right is darker than glossy on the left.

Screenshot 2019-04-25 at 16 47 41

@vorg
Copy link
Member

vorg commented May 1, 2019

@vorg
Copy link
Member

vorg commented Aug 6, 2019

@dmnsgn dmnsgn added type/feat A new feature and removed enhancement labels Jul 5, 2022
@dmnsgn dmnsgn added this to the 4.0.0 milestone May 5, 2023
@vorg
Copy link
Member

vorg commented Sep 5, 2023

There is some work done here #331

@dmnsgn
Copy link
Member Author

dmnsgn commented May 30, 2024

A Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting

// GLSL code for dielectrics
// Common code for single and multiple scattering
// Roughness dependent fresnel
vec3 Fr = max(vec3(1.0 - roughness), F0) - F0; vec3 kS = F0 + Fr * pow(1.0-ndv, 5.0);
vec2 f_ab = textureLod(uEnvBRDF, vec2(ndv, roughness), 0).xy;
vec3 FssEss = kS * f_ab.x + f_ab.y;
float lodLevel = roughness * numEnvLevels;
vec3 reflDir = reflect(-eye, normal);
// Prefiltered radiance
vec3 radiance = getRadiance(reflDir, lodLevel);
// Cosine-weighted irradiance
vec3 irradiance = getIrradiance(normal);
// Multiple scattering
float Ess = f_ab.x + f_ab.y;
float Ems = 1-Ess;
vec3 Favg = F0 + (1-F0)/21;
vec3 Fms = FssEss*Favg/(1-(1-Ess)*Favg);
// Dielectrics
vec3 Edss = 1 - (FssEss + Fms * Ems); vec3 kD = albedo * Edss;
// Composition
return FssEss * radiance + (Fms*Ems+kD) * irradiance;

@vorg
Copy link
Member

vorg commented May 30, 2024

Hasn't that been implemented already? Or is it only in some experiment?

@dmnsgn
Copy link
Member Author

dmnsgn commented May 31, 2024

Hasn't that been implemented already? Or is it only in some experiment?

We are not doing multi-scattering in IBL no, as far as I am aware, and we're not computing the energyCompensation factor.

It has improved over the past years but still not energy conserving for metals (metallic: 1 and increasing roughness):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants