- Modifié
Issue with SkeletonGraphic and URP
Hi! I've encountered a visual issue with SkeletonGraphics after switching the project we're working on to URP.
In the past, this issue was resolved by applying the material belonging to the SkeletonDataAsset into the inspector (for SkeletonGraphic). However, now that URP is active... regardless of if the SkeletonGraphicDefault
material or the SPINE's actual material is selected, (in this case, it'd be Shu_Material
) the lines that are seen around the mouth area and other parts (collar) won't smoothly disappear. I believe that the lines are different "layers" that our artist prepared before animating the file, but these things should go away (they have in the past) when working in Unity (both Game and Scene views). I have already imported the URP SPINE extra shaders/etc., but I noticed that they are not to be used with SkeletonGraphics.
If you have any pointers, advice, or ideas, that would be awesome! Or if you need more information, I can post more screenshots and details. Thanks in advance!
Edit: We're using Unity 2019.4.28f1!
JulianRice a écritthe lines that are seen around the mouth area and other parts (collar) won't smoothly disappear
JulianRice a écritIf you have any pointers, advice, or ideas
I see something like this in Spine if I forget to check "Unpremultiply alpha" when unpacking textures. Outline around each part (mouth, eyes, etc). Maybe there is something similar in Unity?
Well, these are my thoughts out loud.
Thanks for the tip Drako!
Drako a écritI forget to check "Unpremultiply alpha" when unpacking textures
Do you mean not selecting Premultiply Alpha in the settings? We tried exporting one of the SPINE with that option deselected and played around with the materials in Unity (with URP) and managed to get most of the extraneous outlines to disappear. However, some of the pieces (layers I assume) seemed a bit blockier, and there were some bits of white/transparency that appeared for the first time as a result. Do you have any idea what this could be?
Also (aimed more towards the SPINE developers), in the case that this is the best solution one can reach in the given circumstances/software versions, is there an alternative to re-exporting every single SPINE project with this single checkmark toggled off? We have 600+ SPINE projects for the project we're working on, and if there's something in the code (I have yet to see anything obvious in the .json/.atlas/.meta files) that we can prepare a program to crawl through and auto-update/edit for us, that would be a big time-saver for the artists on our team.
Thank you!
I'll write right away that I have no experience with Unity. I am only expressing my assumptions, so you should not expect much from me.
JulianRice a écritDo you mean not selecting Premultiply Alpha in the settings?
JulianRice a écritis there an alternative to re-exporting every single SPINE project with this single checkmark toggled off?
I assumed the problem was with this checkbox in import/export.
In Spine Web Player we have "premultipliedAlpha" parameter with "true" default value. This parameter and its value are used in conjunction with "Premultiply Alpha" in export settings from Spine. As I understand it, if the checkbox "Premultiply Alpha" was checked during export from Spine, then we must set "premultipliedAlpha" = true in Spine Web Player.
Maybe same for Unity? Maybe somewhere we have something like "premultipliedAlpha" too? And you don't need re-export all yours spine projects?
JulianRice a écritHowever, some of the pieces (layers I assume) seemed a bit blockier, and there were some bits of white/transparency that appeared for the first time as a result. Do you have any idea what this could be?
No idea. Although I sometimes got strange graphical artifacts in Web Spine Player due to strong discrepancies in versions. My json-files was generated in old Spine Editor. Looked for discrepancies in formats, corrected files.
But for Unity, are there separate runtimes for each separate version of Spine?
Btw, I see this yours "bits" in picture in first post too.
Can you check this model in Spine Editor? Maybe this is not problem with Unity, but something with model?
Drako a écritI'll write right away that I have no experience with Unity. I am only expressing my assumptions, so you should not expect much from me.
Regardless of your experience with Unity, your experience with SPINE itself is helping me a lot, so I appreciate the time you're taking to respond!
Drako a écritIn Spine Web Player we have "premultipliedAlpha" parameter with "true" default value
Generally when importing SPINE files into the project, we work with a JSON, PNG, and Atlas file. I assume the JSON stores information on the actual movement/animation, whereas the PNG is where the assets/layers are and the Atlas is a summary of sorts(?) of the png and its layers (or bones).
I've already sifted through all three files looking for some kind of "alpha" or "multiply" (those kinds of keywords) but haven't found anything. So that made me think that it's labeled as something else... or somehow integrated into the png data itself.
Drako a écritBut for Unity, are there separate runtimes for each separate version of Spine?
Nah, I mean there's a unitypackage that SPINE releases for us to integrate into our Unity project, but I don't believe those are "separate runtimes"... if I'm answering that question right~
Drako a écritBtw, I see this yours "bits" in picture in first post too.
Yeah I just noticed that it was in the original picture too ?, thanks for pointing that out! I already talked to our artist and have that fix on the way. The issue with the outlines is still prominent among the other SPINE projects that have yet to be re-exported though. Hoping to find some kind of solution in the coming week >_<~
JulianRice a écritI've already sifted through all three files looking for some kind of "alpha" or "multiply" (those kinds of keywords) but haven't found anything. So that made me think that it's labeled as something else... or somehow integrated into the png data itself.
No, it is not hidden anywhere. This is a variant of store textures in png-file. Like "ready-to-use" (with "Premultiply Alpha") or "raw textures" (without "Premultiply Alpha"). Something to do with transparency, I don't even know how to explain.
In the application that uses json/atlas/png files, you must specify whether the textures are already "ready to use" (with "Premultiply Alpha") or not. With the wrong choice, we get problems with transparency.
When I open json/atlas/png files in Spine Web Player, I can indicate for him that the png-file with textures are "ready-to-use" (with "Premultiply Alpha").
test = new spine.SpinePlayer("player-container", {
jsonUrl: "test.json",
atlasUrl: "test.atlas",
backgroundColor: "#2a313d",
showControls: 1,
premultipliedAlpha: true,
showLoading: 1
});
this is for Spine Web Player:
premultipliedAlpha: true
I have a suspicion that there is probably something like this somewhere in Unity. Somewhere around loading textures from png-files.
Sorry for the late reply.
When using the spine-unity runtime, your Material (and Texture) settings on the Unity side of things need to match how the atlas texture has been exported from Spine (Straight alpha vs. PMA workflow). Please check if your asset settings match the following documentation:
spine-unity Runtime Documentation: Advanced Premultiplied vs Straight Alpha Export
spine-unity Runtime Documentation: Advanced Premultiplied vs Straight Alpha Import
Most likely you need to enable or disable Straight Alpha Texture
at your Material to fit your export settings.
Harald a écritMost likely you need to enable or disable Straight Alpha Texture at your Material to fit your export settings.
Thanks for the reply Harald!! I've read through both links of documentation.
We're currently using SPINE 3.8, so I believe the Atlas Texture Settings
option on Unity isn't present (?). Is there a way to assign from somewhere other than the SPINE section of the preferences?
Looking at the rest of the details... particularly the Correct Texture Packer export and Texture and Material import settings
for Straight Alpha
:
Even after checking sRGB, Alpha is Transparency, and Straight Alpha Texture, the lines still appear. I assume this is because it doesn't match the texture packing settings in SPINE (no premultiplied alpha, yes Bleed). We've experimented with re-exporting some portraits with the correct settings marked in SPINE, and the portraits work just fine after that. So the question is, would re-exporting (even if it takes a lot of time) every project from SPINE and re-importing into Unity with those settings applied be the best solution for this case?
Drako a écritI have a suspicion that there is probably something like this somewhere in Unity. Somewhere around loading textures from png-files.
I've looked around everywhere on the Unity-end and did find some texture importing settings within the code, but nothing clear that sounds like a "premultiply alpha" setting or something along those lines.
Thanks both of you ?
JulianRice a écritWe're currently using SPINE 3.8, so I believe the Atlas Texture Settings option on Unity isn't present (?). Is there a way to assign from somewhere other than the SPINE section of the preferences?
Actually the spine-unity 3.8 runtimes already provide this setting. Are you perhaps using a very old version of the spine-unity 3.8 runtime (the name of the unitypackage shows the date)?
Anyway, you could still manually assign the same settings at your skeleton Textures and Materials, it has the same effect. If this does not resolve the problem, then something else is going wrong.
JulianRice a écritEven after checking sRGB, Alpha is Transparency, and Straight Alpha Texture, the lines still appear. I assume this is because it doesn't match the texture packing settings in SPINE (no premultiplied alpha, yes Bleed).
Which export settings did you use when exporting your skeletons? You need to know how you exported your textures to then match your Unity settings to those used to export your textures.
Are you perhaps using Linear instead of Gamma colorspace in your Player settings, under Other Settings - Renderung - Color Space
? As documented on the spine-unity documentation pages, when using Linear color space, you must use straight alpha.
JulianRice a écritWe've experimented with re-exporting some portraits with the correct settings marked in SPINE, and the portraits work just fine after that. So the question is, would re-exporting (even if it takes a lot of time) every project from SPINE and re-importing into Unity with those settings applied be the best solution for this case?
It depends on how you exported your atlas textures before, perhaps you just didn't find the correct Texture and Material settings yet.
If you really need to re-export all your atlas texture assets, we always recommend using the Spine Command Line Interface (CLI), to automate the export of all your assets. Once set up, you can re-export all your assets from a single script.
Hi Harald,
I just wanted to provide a status update on this issue—the TLDR is that we've resolved the problems!
We updated Unity to LTS 3.2021 and realized that it involved a mandatory upgrade from SPINE 3.8 to 4+, so we bumped it to 4.1.
From there, all 1000+ SPINE projects had to be re-exported, but it was automated via a shell script that I wrote (after the version updates) that synced up and auto-exported all of our projects from a SPINE GitHub repository to a repository with our game's assets.
Thanks for the advice and help, and I hope that others who may have this issue note that it's been resolved ?
Thanks for the update, very glad your original issues are now resolved!