jMonkeyEngine / jMonkeyEngine/jmonkeyengine

PBR Lighting issue

Open
#2,330 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defect
Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

Description

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);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting PBRLighting around the referenced line 223 and trace how the importers set the metallic factor. Compare the current behavior with the glTF specification, reference viewers, and the existing test cases; done means the expected metallic behavior is agreed upon and the relevant shader or importer tests reflect it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.