Skip to content

Commit

Permalink
fixed linear color space when loading ktx textures
Browse files Browse the repository at this point in the history
  • Loading branch information
pfcDorn committed Jan 18, 2024
1 parent 1b840bf commit a1ece43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Runtime/Scripts/SceneImporter/ImporterTextures.cs
Expand Up @@ -152,6 +152,7 @@ async Task<Texture2D> CheckMimeTypeAndLoadImage(GLTFImage image, Texture2D textu
#if HAVE_KTX
if (Context.TryGetPlugin<Ktx2ImportContext>(out _))
{
bool isLinear = !texture.isDataSRGB;
#if UNITY_EDITOR
Texture.DestroyImmediate(texture);
#else
Expand All @@ -161,7 +162,8 @@ async Task<Texture2D> CheckMimeTypeAndLoadImage(GLTFImage image, Texture2D textu

using (var alloc = new Unity.Collections.NativeArray<byte>(data, Unity.Collections.Allocator.Persistent))
{
var resultTextureData = await ktxTexture.LoadFromBytes(alloc, false);

var resultTextureData = await ktxTexture.LoadFromBytes(alloc, isLinear);
texture = resultTextureData.texture;
texture.name = textureName;
}
Expand Down

0 comments on commit a1ece43

Please sign in to comment.