godot icon indicating copy to clipboard operation
godot copied to clipboard

Add option to invert roughness maps.

Open rbwldrf opened this issue 10 months ago • 8 comments

Some modelling workflows have smoothness maps instead of roughness maps. I thought it would make things easier if there was an option to invert it in editor.

Feel free to uncomment the SConstruct file, I couldn't build without commenting it out because I'm on SCons 4.8.1

rbwldrf avatar Jan 24 '25 14:01 rbwldrf

OK, is there anything else I should fix?

rbwldrf avatar Jan 24 '25 14:01 rbwldrf

Nope that's all resolved

AThousandShips avatar Jan 24 '25 14:01 AThousandShips

Similar to the Normal Map Invert Y import option, this could be handled at import time so you don't need different shader versions when different materials use different texture conventions. This in turn leads to better performance and faster load times.

In fact, Normal Map Invert Y can already achieve this! This is because it inverts the texture's green channel on import, regardless of what the texture actually contains. Either use an ORMMaterial3D (green is the roughness channel in an ORM map), or use a StandardMaterial3D and set the roughness channel to green instead of red.

Calinou avatar Jan 24 '25 15:01 Calinou

Huh. That's a valid point. I just thought it would be a nice QOL feature similar to Heightmap Flip Texture.

rbwldrf avatar Jan 24 '25 15:01 rbwldrf

#99676 should already do what you want (arbitrarily remap color channels of a texture at import-time).

RedMser avatar Jan 24 '25 16:01 RedMser

That's a good implementation! I honestly hadn't noticed that, which is most likely the culprit of my proposal.

Keeping that in mind, and I'm playing devil's advocate here, I suppose this proposal could help prevent other users from missing that setting, marginally improving UX at the expense of whatever performance hit the addition of a per-material variable would add.

I get that bloating the BaseMaterial3D like this is not in the interest of most, and I totally understand if this doesn't get added. I'm just spitballing an (admittedly flawed) alternative solution to a problem caused by a lack of understanding of the engine and a want for a quick and easy tinker that I rushed without research towards existing fixes to the problem and was a little too eager to share.

rbwldrf avatar Jan 24 '25 17:01 rbwldrf

The previous discussion rejected adding a boolean to invert roughness maps to the material system. I don't currently have the reference links to it.

The reasoning is it adds an unused feature to the material system.

However, a texture import setting that rewrites the texture might be okay.

Edited:

Like https://github.com/godotengine/godot/pull/99676

fire avatar Jan 24 '25 18:01 fire

For context one past rejected PR:

  • https://github.com/godotengine/godot/pull/59673

But the rejection was not in writing anywhere there

AThousandShips avatar Jan 24 '25 18:01 AThousandShips

If anyone was looking for this feature https://github.com/godotengine/godot/pull/99676 allows you to invert any channel.

fire avatar Jun 12 '25 02:06 fire