- 수정됨
sRGB and Alpha Is Transparency
Hi Harald,
I find that when bringing in SPINE assets into Unity, the texture settings are messed up. sRGB and Alpha is Transparency is disabled.
This isn't a big issue, but I find that this also gets disabled randomly.. not sure if its because I'm deleting the cache or what.
But is there a way to export SPINE files to have those settings auto enabled in Unity?
Not a big deal, just curious if you knew what was causing this.
Thanks
These settings might seem counter-intuitive at first look. They are set automatically when importing Spine assets, they actually prevent incorrect mipmap generation on textures with pre-multiply alpha enabled (which is the default), see comments in spine-runtimes/SpineEditorUtilities.cs at 3.7:
// Note: 'sRGBTexture = false' below might seem counter-intuitive, but prevents mipmaps from being
// generated incorrectly (causing white borders due to undesired custom weighting) for PMA textures
// when mipmaps are enabled later.
texImporter.sRGBTexture = false;
[..]
texImporter.alphaIsTransparency = false; // Prevent the texture importer from applying bleed to the transparent parts for PMA.
Did you encounter incorrect rendering in any case, which was resolved when changing settings to sRGB or alphaIsTransparency=true
? Or did you just think it seems wrong?
I have got the same problem, the default exported spine sprite has lower saturate, and 4x bigger size, you can see as below
and if toggle the "Alpha Is Transparency" option on, some glitch appeared.
I found this issue only appear in linear color space.
An old forum thread mentioned this, the user gumboots provide a workaround.
[http://esotericsoftware.com/forum/Colour-different-Spine-Unity-colouring-in-Unity-10586?p=48258&hilit=sRGB#p48258]
If the patch could be merged into the official Unity runtime, may release some future pain :-)
Regarding lower saturation: you will receive lower saturation when using Linear color space (Player settings -> Other Settings -> Rendering -> Color Space
) and having sRGB (Color Texture)
disabled, when using Gamma space it should not change at all.
In order to receive consistent color, I have just changed the code to set the default value of sRGB (Color Texture)
to true
again. The console warning will notify users in case of incorrect mipmap generation when sRGB (Color Texture)
and Generate Mip Maps
are both enabled in Gamma space (which was the problem that should be prevented by setting sRGB (Color Texture)
to false
).
Regarding your statement:
bluegobin wroteand 4x bigger size, you can see as below
This is due to compression being enabled on the left and disabled on the right. You should not encounter any file-size-changes, at least we never had this issue.
bluegobin wroteand if toggle the "Alpha Is Transparency" option on, some glitch appeared.
Alpha Is Transparency
shall remain disabled (which is why we set this as default settings upon import). What you can see here is the underlying color bleed in the rgb layers (this prevents semi-transparent pixels to be partly black).
The next unitypackages will contain the changes to sRGB (Color Texture)
default import settings, they have just been pushed to the git repository.
Harald wroteIn order to receive consistent color, I have just changed the code to set the default value of
sRGB (Color Texture)
totrue
again. The console warning will notify users in case of incorrect mipmap generation whensRGB (Color Texture)
andGenerate Mip Maps
are both enabled in Gamma space (which was the problem that should be prevented by settingsRGB (Color Texture)
tofalse
).
Thanks for the help @Harald!
Could this possibly be a public bool that users can set in the export options? In case some other uses want to set their own sRGB values? Could save you some headache for the next time, when another user wants sRGB default to be false? :think:
IndieDoroid wroteCould this possibly be a public bool that users can set in the export options?
You mean import-options I guess. Thats a good idea, I will add an entry to the Spine Preferences. Thanks for the input!
I have added an issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1410
It will hopefully make import much simpler in the future.