- Edited
mesh bug?
It looks fine when I created an animation on spine,
But the animation looks broken when I play it on unity.
I made a movie clip to demonstrate the bug on unity runtime.
https://www.dropbox.com/sh/svocmf9hlkpg ... c_xccOuLCa
How can I fix this?
Any help would be appreciated,
inho
Do you strip whitespace? This can't be done when using meshes. Sorry it's a gotcha, I should really add a warning for this!
https://trello.com/c/8hdXgHcQ/131-warni ... ith-meshes
What do you mean with stripping whitespace? Could you explain more on the topic so that I can solve the issue?
I applied a mesh transformation without any whitespace or transparent area, but the image part with mesh transformation still too big on unity runtime.(it's ok with spine editor)
Yeah. I don't think this is a whitespace problem.
If it were, we'd have incorrect UV mapping and parts being cropped around the edges of the mesh, which isn't what's happening here.
Looks more like RegionAttachments are being scaled differently vs MeshAttachments (or SkinnedMeshAttachments).
(But yes, I think the warning is a good call for UX).
This incongruous scaling happened to me before and it was HILARIOUS. But re-exporting the json seemed to fix it. I couldn't really understand why. But it happened right when Skinning was introduced to the runtimes.
Did you try re-exporting the .json? Or is this a brand new export?
If that's not the problem, let's try investigating further:
Are you using the Scale field on the SkeletonData asset?
Are you scaling the root bone?
(Awesome art, by the way. Does your artist have a tumblr or deviantART account?)
EDIT:
Oh. hmm.. it does look like some cropping is happening on the sides. But that doesn't seem to add up with what's happening.
Can you share your json? (without the images)
Thank you Pharan!
I put json file(npc_anim.json) in dropbox folder above.
;Did you try re-exporting the .json? Or is this a brand new export?
I modified the animation quite a few times to see which transformation caused problem, so I exported the animation to json a few times.
;Are you using the Scale field on the SkeletonData asset?
;Are you scaling the root bone?
I'm not using scale field, and I'm not scaling the root bone.
- Edited
Oh wow.
It looks like the data being exported really is what is being seen in Unity.
So it might be an export bug in the editor and not a runtime bug. Not sure though (without the images).
I think my hunch was incorrect. It looks like the exported vertex data of the FFD keys might be the culprit.
Try opening your project and, then re-importing the skeleton from the json you exported using
Spine > Import Data...
See if it's broken.
If you can share the project too, we can compare better.
But I think you'll be able to see the problem if you use Import Data...
yourself.
You can also email the project + images to Nate so he can confirm. Let's wait for Nate to see what he can tell us.
As far as I can see though, there is a lot of whitespace being stripped. Turning it off doesn't seem like an option.
Your current setup is kinda far from ideal. Next time, you can try using the Photoshop json+png export script that comes with Spine. It should be in the Spine install folder. (Nate/Shiu, would you consider making the script a Gist on github? Going into Program Files to look for a photoshop script is a bit weird.)
It's called LayersToPNG.jsx
. It exports pngs per layer from a psd and generates a skeleton you can import into spine that has all the layers pre-aligned so you can save on setup time and not have this problem of giant images being loaded into the editor.
PS
I wonder if it's easy or a good idea to add a per-attachment whitespace stripping feature that modifies your source images + applies transform compensation in the editor instead of modifying what comes out in the atlas on export :p
wingstudio wroteWhat do you mean with stripping whitespace? Could you explain more on the topic so that I can solve the issue?
I mean to uncheck these: Image removed due to the lack of support for HTTPS. | Show Anyway
Pharan wroteI wonder if it's easy or a good idea to add a per-attachment whitespace stripping feature that modifies your source images + applies transform compensation in the editor instead of modifying what comes out in the atlas on export :p
I would say either strip whitespace yourself before bringing it into Spine (easy), or the texture packer could use the mesh information to strip pixels that are outside of the mesh and adjust the UVs (complicated).
It does seem pretty strange and possibly more than just a whitespace stripping problem. Are you sure both your Spine and runtimes are using the latest?
About the versions ;
spine : With 'About spine' menu, I see spine 1.0. I purchased spine professional on 3th Apr. this year and downloaded using link in purchase confirmation email.
spine runtime : I couldn't find version information..(where can I find it?) but I downloaded latest one just now, and it didn't get better.
Unity : I'm using unity 4.3.1fI uploaded spine animation project 'npc_anim.zip' at dropbox folder above.
If there's no problem with versions, could you check the project if there's anything wrong?
Please post the .spine file.
I understand that the ideal is to prepare them, pre-trimmed and optimally rotated, outside of Spine before bringing them in and setting up and stuff like that.
But this honest mistake seems to happen a lot;
people not knowing about the consequences of having giant images with lots of space in the editor.
I've seen it before and it slows down the editor quite a bit if there are enough of them— I assume because of fillrate.
It also affects the feature of being able to click on images to select their parent bones in animate mode. (Unity uses alpha-based hit detection for selecting their sprites in 2D mode. Does Spine do this? I wonder how slow that is)
Some people proceed to animate a lot of stuff only to realize it's better to pre-trim the images.
What options do they have at this point?
I'm not really requesting for it. I certainly wouldn't benefit from it. :p
Maybe Spine should be able to detect the abundance of whitespace on the source images and warn the user accordingly instead?
Anyway, on the problem at hand :
I think the problem is in the exported data.
I'm seeing generally similar results when using the assets in Unity, but unlike the video, I don't see the mesh UV mapping chopping off the torso+arms image on the sides. From this, I think the whitespace stripping isn't the problem at all.
You should send Nate the .spine file.
Yep, seems to be a problem in the data, need the .spine file.
For hit detection Spine uses the center of the image as if it were whitespace trimmed. This is likely better than what Unity is doing, as images are easier to select because whitespace counts, but there still isn't a problem with images with lots of whitespace on top of each other. Could be better if it was the center of gravity, but probably not by much.
It's true it can cause problems for new users. We'll do something about it at some point!
I think the reason Unity used alpha-based is because things often get piled on top of one another (guess they chose to lean on selectivity over sensitivity). If, for example, you have a triangle image over a circle image of roughly the same enclosing box size, you'll have trouble selecting the one underneath. I remember selecting with untrimmed images was really impossible to work with before, I guess it was fixed. Thanks!
- Edited
I zipped all the files in the project folder, and there's .spine file in it.
Please download the file from the dropbox link I posted before.
Thank you,
inho
And I have another question. I executed LayersToPNG.jsx using photoshop, it didn't ask for target directory and I had no clue where the output files are.
Where will I be able to find them? I looked into the script source, and I guessed output file folder is <directory of current psd>/images, but I couldn't find them.
I'm using Mac OSX.
Good point. I was hoping the folder could be clearer in the script too.
Right now, if your psd is saved, it should save the images and json in the same folder as the psd, but in a subfolder called "images".
I'm not sure what happens if your image isn't saved.
Really? It didn't come out? Maybe you have two copies of the psd?
Also try to unlock all the layers and have no folders when you're doing this. Sometimes, even minutely complicated layer setups causes the script to fail without error messages and thus not save anything.
I've actually never tried the LayersToPNG script on mac, I wonder if there is a problem there. Don't see why it shouldn't work though it's fairly simple js. I recommend taking your entire PSD and if you have things like adjustment layers etc. make sure they are "baked" in. You can do this in a duplicated PSD or make a new group you copy everything to. That is how I do it.
Zip file is zero bytes.
For what it's worth ... I had an issue that looks very similar to this, but I was stuck on an old version of the editor. I updated it to the latest and my issue is solved.
Sorry nate, I uploaded new zip file 'animation(source).zip' !
colinday : Thank you for your advice, I checked editor version, and I found out that editor download latest update automatically. In setting dialog, it says Ver. 1.7.12