Godot-proposals: Add an import option to make Godot read a normal map with inverted Y axis

Created on 2 May 2020  路  3Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:

2d isometric game with normal maps for 3d looking lighting effects.

Describe the problem or limitation you are having in your project:

Godot can't read standart normal map. I need to flip Green channel in order for it to work. Without editing the Y axis is flipped when lights are applied.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Have godot read the normal maps the default way so we don't have to flip green channels in a different software. Possibly have an option where you can flip it manually. But I don't see the use.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

I have no idea, still a beginner.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

Not to my knowledge. I had to flip green channel in image editor.

Is there a reason why this should be core and not an add-on in the asset library?:

I 2 figuring out why doesn't it work before I found out Godot can't read normal maps as it should.

Here I linked how the normal map looks when rendered in blender. Godot reads it upside down.

Normal

import rendering

Most helpful comment

I think it makes sense to add an import option to flip the normal map's Y axis. As explained here, there's no universal orientation for normal maps: some engines like Blender and Unity use Y+, others like Godot and Unreal use Y-.

This is especially important if you've acquired a normal map compressed with a lossy algorithm, such as those found on CC0Textures (the only format publicly available there is JPEG). Flipping its Y axis in an image editor would require compressing it again, resulting in further loss of quality.

All 3 comments

In the interest of making high-quality proposals, please read the rules and fill in the issue template. This proposal will be reopened once this is done :slightly_smiling_face:

Also, please note the current normal map format is intended. Many other game engines and 3D applications use it. We can document it better, though. (Please point to places where it's insufficiently documented so we can improve the documentation.)

Edit: I opened a pull request to document the normal map direction expected by Godot. It's now merged :slightly_smiling_face:

In the interest of making high-quality proposals, please read the rules and fill in the issue template. This proposal will be reopened once this is done 馃檪

The issue template is properly filled in, just badly formatted. I have reformatted it below

Describe the project you are working on:
2d isometric game with normal maps for 3d looking lighting effects.

Describe the problem or limitation you are having in your project:
Godot can't read standard normal map. I need to flip Green channel in order for it to work. Without editing the Y axis is flipped when lights are applied.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Have godot read the normal maps the default way so we don't have to flip green channels in a different software. Possibly have an option where you can flip it manually. But I don't see the use.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
I have no idea, still a beginner.

If this enhancement will not be used often, can it be worked around with a few lines of script?: Not to my knowledge. I had to flip green channel in image editor.

Is there a reason why this should be core and not an add-on in the asset library?:
I 2 figuring out why doesn't it work before I found out Godot can't read normal maps as it should.

Here I linked how the normal map looks when rendered in blender. Godot reads it upside down.
Normal

I will test and update with a possible fix, please reopen.

[UPDATE]

Could you check that blender exports the normal map with Y up.

I think it makes sense to add an import option to flip the normal map's Y axis. As explained here, there's no universal orientation for normal maps: some engines like Blender and Unity use Y+, others like Godot and Unreal use Y-.

This is especially important if you've acquired a normal map compressed with a lossy algorithm, such as those found on CC0Textures (the only format publicly available there is JPEG). Flipping its Y axis in an image editor would require compressing it again, resulting in further loss of quality.

Was this page helpful?
0 / 5 - 0 ratings