example_files.zip (4.5 MB)
I am quite well versed with the semantics and math behind “OpenGL vs. DirectX” normal mapping differences.
The attached OmniPBR MDL shader references hollyprivet_normal.png as a normal map. I am at odds with this file and hence wish to ask about the internal policies used by the MDL SDK.
The input texture map obviously (to me) appears to be in OpenGL format since the protrusions are upwards. However, after I run this OmniPBR material through my distillation code (based on example_distilling.cpp) then the normal texture map has been converted into DirectX format (protrusions pointing inward).
I do understand that the policy of the MDL SDK is to assume and use “DirectX format normal maps”.
However, I am at odd’s with what’s happening with this file. What I really need to comprehend is “How to determine if and when I may need to swap/flip my texture RGB channels between OpenGL and DirectX”. In particular, it appears to me that there is no clear context that says “Yes, the source normal map is in OpenGL format and as such the MDL SDK knowingly is going to swap the red-green or invert the green channel when baking out the new normal map on disk” as is actually happening.
So, what information is available to me at the SDK level to figure out what the SDK is actually doing in this process during the baking of the new normal map to disk compared to what it is sourcing as the input image?