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

Explain the use of NormalType in materials #2143

Open
riccardobl opened this issue Nov 8, 2023 · 1 comment
Open

Explain the use of NormalType in materials #2143

riccardobl opened this issue Nov 8, 2023 · 1 comment
Labels
Contribution welcome Documentation Issues that affect the Wiki, Javadoc or any other form of documentation

Comments

@riccardobl
Copy link
Member

We need a small paragraph or page somewhere in the wiki explaining what is and how to use the NormalType param in PBRLighting and in Lighting (introduced by #2140 ) .

This is a poorly written draft, if anyone can pick it up, clean, improve an publish it, i think it might be pretty useful for newcomers:

Normal Types

there are two conventions for normal maps:

  • OpenGL-Type also known as OpenGL-Style or Y+
  • DirectX-Type also known as DirectX-Style or Y-

they differ in the sign of the green channel.

JME supports both using the param NormalType that can be set to either -1 for directx or 1 for opengl.
By default jme materials use -1 (directx).

When to set the NormalType

you should set the normal type everytime you create a new instance of the material PBRLighting or Lighting in jme.
Asset loaders such as GLTF Loader already set the normal type as part of the import process, so you should ensure that you are providing or otherwise setting the correct normal type to the tool used to create the models.
Eg. in the case of GLTF in blender, it is required to provide OpenGL type normal maps.

Is my normal map DirectX or OpenGL?

There is no easy way to determine that, other than sometimes the name of the texture itself that might contain some clues on its type, eg. Material0_NormalMapY+.png has Y+ in the name, so it is likely an opengl type normal map.
If the name doesn't give any clue, the next step is to research the tool used to generate the normal map or if the normal map is downloaded as part of a library, any useful text attached to the release.

@riccardobl riccardobl added Documentation Issues that affect the Wiki, Javadoc or any other form of documentation Contribution welcome labels Nov 8, 2023
@codex128
Copy link
Contributor

codex128 commented Nov 8, 2023

I've submitted PR 173 in the wiki repo that addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution welcome Documentation Issues that affect the Wiki, Javadoc or any other form of documentation
Projects
None yet
Development

No branches or pull requests

2 participants