CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
347 stars 83 forks source link

Add flag to TextureLoader for sRGB textures, load some textures as linear #398

Closed azrogers closed 6 months ago

azrogers commented 8 months ago

Fixes #332.

Currently, all textures in Unity are loaded as if they're sRGB textures. This isn't correct for things like normal maps, where treating them as sRGB will mess up the direction of the normals. This change adds a flag to TextureLoader::loadTexture to allow specifying which textures are sRGB, and specifies the flag for each texture loaded based on the Unreal implementation.

kring commented 7 months ago

Looks great! Please just merge in main. It's another painful conflict, unfortunately.

azrogers commented 7 months ago

@kring Merged with main! It feels a little bit like I did something wrong in the merge but the changes look right to me, so 🤷‍♀️

kring commented 7 months ago

The changes look good, except that it looks like there's an accidental cesium-native downgrade in here. It's really easy to do, because submodules don't merge quite the same way that normal files do. If you just do the normal process of 1) git merge origin/main, 2) fix conflicts, 3) git commit -a, you'll end up accidentally reverting submodules changes in the branch you're merging from. The trick is to do 2.5) git submodule update --init --recursive

j9liu commented 6 months ago

Thanks @azrogers !