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

PBR Lighting issue #2330

Open
zzuegg opened this issue Nov 18, 2024 · 2 comments
Open

PBR Lighting issue #2330

zzuegg opened this issue Nov 18, 2024 · 2 comments
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug"

Comments

@zzuegg
Copy link
Member

zzuegg commented Nov 18, 2024

To continue the discussion from:
https://hub.jmonkeyengine.org/t/zombiegirl-gltfloader-vs-monkeywrench/48007/15

Summary:

According to gltf specs, and on the reference viewers, the default value for metallic factor is 1. Jme's importers are setting the metallic factor to 0 to pass the test cases. The problematic line in my opinion is:

//223 of PBRLighting
vec4 diffuseColor = albedo - albedo * Metallic;

I have checked, a few other repositories, and i have not yet found that piece of math again. Additionally, the whole block:

float specular = 0.5;
float nonMetalSpec = 0.08 * specular;
vec4 specularColor = (nonMetalSpec - nonMetalSpec * Metallic) + albedo * Metallic;
vec4 diffuseColor = albedo - albedo * Metallic;
vec3 fZero = vec3(specular);

is quite unique. F0 is in all other shaders defined as:

vec3 F0 = vec3(0.04);
F0 = mix(F0, albedo, metallic);
@zzuegg
Copy link
Member Author

zzuegg commented Nov 18, 2024

When testing the MetalRoughSpheres jme shows also different results than the khronos sample viewer.
Screenshot 2024-11-18 211130

The reflexivity is lost completely in the second column in jme while in the khronos renderer it slowly fades

@stephengold stephengold added the defect Something that is supposed to work, but doesn't. Less severe than a "bug" label Nov 19, 2024
@stephengold
Copy link
Member

Thanks for investigating.

When it comes time to solve this, instead of modifying the PBRLighting shaders (and potentially breaking many apps) I suggest defining a new PBR material with a new name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug"
Projects
None yet
Development

No branches or pull requests

2 participants