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

Fix for Inverted Normal Y Component in Gltf Import #2119

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ public void simpleInitApp() {
// rootNode.addLight(pl);
// PointLight pl1 = new PointLight(new Vector3f(-5.0f, -5.0f, -5.0f), ColorRGBA.White.mult(0.5f), 50);
// rootNode.addLight(pl1);


assetManager.registerLocator("/home/codex/Downloads", FileLocator.class);

loadModel("NormalTangentTest.gltf", new Vector3f(), 1);
//loadModel("Models/gltf/polly/project_polly.gltf", new Vector3f(0, 0, 0), 0.5f);
//loadModel("Models/gltf/zophrac/scene.gltf", new Vector3f(0, 0, 0), 0.01f);
// loadModel("Models/gltf/scifigirl/scene.gltf", new Vector3f(0, -1, 0), 0.1f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ protected MatParam adaptMatParam(MatParam param) {
return null;
}
if (param.getName().equals("NormalMap")) {
//Set the normal map type to OpenGl
getMaterial().setFloat("NormalType", 1.0f);
// This is intended to set the normal type to OpenGL (1.0),
// however, gltf seems to want the normal type for DirectX (-1.0),
// even though gltf follows the OpenGL convention.
getMaterial().setFloat("NormalType", -1.0f);
}
if (param.getName().equals("LightMap")) {
//Gltf only supports AO maps (gray scales and only the r channel must be read)
Expand Down