- 수정됨
[Unity3D] How to remember offset after stripping whitespace
Hello again!
Sorry that I've been asking so many questions with this frequency lately, but we've been stumbling to quite a few problems on this project.
Lately we've noticed that whenever we get an animation where the sprite images have white/blankspace around, there's a lot of problems after importing in Unity. I assumed it's because during export we're setting the atlas to remove the whitespace (most ideal for perfomance as we all know) and Unity has no way to apply the FFD and translation of sprites properly after that. So we've been needing to go through a lot of animations and fixing all the sprites now, making sure they have no white space
My programmer tells me though that he thinks Unity should be able to know offset of sprites import despite removing the whitespace though, so he believes this is either a bug or something that we're not doing properly.
Example: Some attachments of a Sprite in Photoshop, with their blank space around: Image removed due to the lack of support for HTTPS. | Show Anyway Image removed due to the lack of support for HTTPS. | Show Anyway
How the animation looks on Spine:
http://youtu.be/-7TYrbUDHso
How it looks in Unity after import:
https://www.youtube.com/watch?v=rI-lkImUw7U
Any ideas? Much appreciated
viewtopic.php?f=9&t=2838&p=14608&hilit=whitespace#p14608
I've been on a project before where the artist failed to remove the whitespace from the image assets before importing into the game engine, so I know a little about what you're going through.
In the long run, you will be better off using imagemagick (I run from batch files) to strip the whitespace and then re-rigging the animation in spine. The time and effort to write a program to do this automatically far outweighs the time it would take to let your animator redo the animations.
Once this is done, DO NOT strip whitespace when exporting the atlas.
Imagemagick example...
FOR /R %%I in (*.png) DO mogrify -trim +repage %%I
Nope, Unity doesn't know how to handle it.
Whitespace stripping doesn't work properly with meshes. (wasn't there supposed to be a warning in the editor for this already?)
You may have to re-export the wings from photoshop pre-trimmed/pre-stripped and then remap them into meshes and reanimate them in Spine.
Also, next time, I recommend using the Photoshop Script that comes with Spine that exports the psd layers into individual pngs + spine json
. It trims your images and aligns them in the json so you can begin rigging in Spine right away. You can find the Photoshop script in your Spine folder.
tangent:
There's also a handy tool called gifcam: http://blog.bahraniapps.com/gifcam/
It's useful for capturing short animations on screen like what you did.
Pharan wroteNope, Unity doesn't know how to handle it.
Whitespace stripping doesn't work properly with meshes. (wasn't there supposed to be a warning in the editor for this already?)You may have to re-export the wings from photoshop pre-trimmed/pre-stripped and then remap them into meshes and reanimate them in Spine.
Also, next time, I recommend using the Photoshop Script that comes with Spine that exports the psd layers into
individual pngs + spine json
. It trims your images and aligns them in the json so you can begin rigging in Spine right away. You can find the Photoshop script in your Spine folder.tangent:
There's also a handy tool called gifcam: http://blog.bahraniapps.com/gifcam/
It's useful for capturing short animations on screen like what you did.
Thank you guys! That was an important lesson.
This is going to be a bit of a nightmare because we outsourced this particular job, so I was hoping our animators wouldn't have to remap and reanimate all the mess. sigh Oh well.
Whitespace stripping doesn't work properly with meshes. (wasn't there supposed to be a warning in the editor for this already?)
It's coming!