Charlie

Hi, I'm a new user to spine and enjoying using this program but having a bit of trouble finding a way round the following problem
I've done a series of animations using quite high resolution images and I want to now reduce the resolution of the images quite drastically, is there any way I can scale down the size of the original skeleton to fit the lower resolution images?
( At the moment just swapping in lower-res images results with small images on a big skeleton, scaling the skeleton down before importing the smaller images just gives a corresponding size decrease to any images then attached )
Charlie
  • Сообщения: 2

Nate

See scale on SkeletonJson. If you can't find it, let me know what runtime you are using.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

Pharan

I think he means in Spine Editor, Nate.

In which case, I wouldn't know how to fix it in the editor. But you could export a texture atlas and sheet using lower-resolution images. They'd still be big in the editor, but they'll be in tact and lower-res in the game... I think.

Sounds like it could be a useful editor feature though.
Аватара пользователя
Pharan
  • Сообщения: 5366

ZacCom

I second that feature on the images since spine makes the character huge compared to asset. Need a JSON export for unity so scale will be compared to other Unity Assets.
ZacCom
  • Сообщения: 13

Nate

I'm not sure what feature you mean. I described the runtime feature for scaling skeletons and animations at load time. This lets you use different sized images at runtime than you used in Spine.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

djr

Hi Guys, Charlie and I are working on an iOS game together using the spine-c runtime, I'll chime in from the code side of the problem:

What we'd like is something similar to reset xforms in 3DS Max. In the spine editor we'd like to be able to:
for each bone b in skeketon where b.scale != 1
apply b.scale too all children of b
set b.scale to 1
Why do we want this?

Charlie has created a VERY high resolution character with say a height of 10,000 units whereas the highest resolution character should be 1000 units. Now it's true that we could set the skeleton scale to 0.1 within the engine and this would fix it, the engine already scales by 1, 0.5 or 0.25 depending on which iOS device we are running on. So to prevent us from having to create every animation at the arbitrary scale that charlie first chose we'd like to scale and reset the skeleton to be 1000 units high.

This isn't a deal breaker, there are no tears before bed time and I think I can work around it using a python script to traverse the JSON export and reimport it all scaled and reset but it does seem like a nice feature for the spine editor to have.

Does any of that make sense?
Аватара пользователя
djr
  • Сообщения: 2

Nate

I think you can do this:
float spineUnitsToGameUnits = 0.1f;
float iosDeviceScale = 0.25f; // or 1 or 0.5
float skeletonJsonScale = spineUnitsToGameUnits * iosDeviceScale;
animationNode = [CCSkeletonAnimation skeletonWithFile:@"spineboy.json" atlasFile:@"spineboy.atlas" scale:skeletonJsonScale];
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

Søren

It does make sense to have since it can be a bit tricky animating scaling if you need specific values and the scale isn't "1" However it would result in images being scaled instead, keep that in mind.
A "freeze" button to reset scaling on selected bones would set the scale to 1, change the length of the bone (for a better visual representation), offset the child bones correctly and compensate the scale on the images. It could work with image compensation so if you scaled your images up or down it would not compensate scale for them but compensate position so they would still be in the right spot.
Аватара пользователя
Søren

Shiu
  • Сообщения: 2443

Nate

All the scaling I am talking about is at runtime. AFAIK the OP is also talking about at runtime. In the editor people can work at any size and then scale at runtime. I don't think we need any features to change the scale in the editor.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

Charlie

Sorry should have mentioned I'm only talking about within the editor,
A 'freeze' button would be useful, as wouldn't I run into the same problem if I want to reuse a skeleton and animations between characters of different scale (so they use different resolution images) but with roughly the same proportions, ie a Giant and a hobbit. Where I then want to adjust stuff within the editor and not run time
Charlie
  • Сообщения: 2

Nate

If I re-read Shiu's post but this time ignore the first sentence and last sentence which don't make much sense :), I can see how a freeze button could be useful to resize a skeleton and then reset the scale to 1. Like most new editor features not in Trello, this can't be done for quite some time.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

ZacCom

Nate писал(а):I'm not sure what feature you mean. I described the runtime feature for scaling skeletons and animations at load time. This lets you use different sized images at runtime than you used in Spine.
Thanks Nate I am learning so much about Spine I used a Set Scale and was able to modify my character to the proper scale with one functions. Easy just didn't understand the functions it starting to make since. My game is back in progress. Thank you again for all the support.
PS I probley will find something else but I think my workflow will be busy on the game side of things.
ZacCom
  • Сообщения: 13

lexaur

Sorry for hijacking the thread but I have a very similar problem as the OP. After reading the forums for hours and hours I can't seem to find a solution for it. So here goes the stupid question:

How can I scale the bones of the animation so that I can use multiple different texture sheets?
Some background info:

- Using Unity, C# runtime to import the animations to Unity(I have seen the instruction video). Animations work really well and look awesome but as the original graphics are so high quality(5k x 5k) the character looks bad inside the game and takes too much space.

- Using the scale in the skeletonData only affects to the scaling of the world size not the actual texture size.

If I scale the exported texture sheet from Spine to for example 50% manually . I can't find a place for the bone scale and it breaks the animation. I have tried adding the scale to both of the .json file as well as to the .atlas file without any luck. Just need the sync for the bones and the textures depending on texture size.

It can't be this hard :)
lexaur
  • Сообщения: 3

Nate

Here's a scenario: You create your art at 5x resolution and design your skeleton and animations in Spine at this resolution. Now you want to use the art and skeletons in your game at multiple lower resolutions: 0.2 is normal size, 0.1 is half size for small screens, and 0.4 is double size for large screens.

You need three separate texture atlases at each of these sizes. The Spine packer doesn't currently do resizing, so you'll need to write a script with something like Imagemagick (freeware) or Photoshop to batch process your images to the needed sizes. You can then pack the images using Spine. Alternatively you can use Texture Packer Pro (3rd party payware) to pack the images (choose the libgdx texture atlas export format).

Now that you have 3 atlases, in your game you can choose the correct atlas and scale based on the user's screen size. For the 0.2 atlas set the SkeletonJson (SkeletonData in Unity) scale to 0.2, for the 0.1 atlas set the scale to 0.1, and for the 0.4 atlas set the scale to 0.4.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

lexaur

Thanks Nate for the reply, it cleared a lot of things!

Just to be sure the phases are:
1. Create the animation with the original art and export the animation to the .json and .atlas files
2. Scale down the original parts to what ever size
3. Use the Spine texture packer to recreate an atlas for the new size
4. Use this new atlas along with the new texture sheet in Unity.

Do I need to care about the paths or anything inside the .json or .atlas files? As if I have understood correctly the .json file has all the bone/animation information and .atlas the graphical info. So these two files should match along with the sprite sheet.
lexaur
  • Сообщения: 3

Nate

Names in the atlas need to match the names of the RegionAttachments, that is all.
Аватара пользователя
Nate

Nate
  • Сообщения: 11260

Pharan

And an additional quirk:
Even if you assign the image to the material and correctly assign the material to your Spine-Unity atlas asset;
The generic Spine-C# will still try to search for the filename specified inside the libGDX .atlas.txt file. (since, being generic, it has no knowledge of Unity's structure. or does it? I recall it switching from using the material's filename to one of the material's member fields. while the atlas image file no longer needs to be the same as the material name, it seems to still need to follow the filename in the .atlas.txt file?)

In other words, renaming your image file after it's been packed will cause spine-C# to not be able to find it and cause bright pink rectangles to be drawn.

(this topic reminded me of this problem we had a couple of months ago. Should we add this to the github readme, Nate?)
Аватара пользователя
Pharan
  • Сообщения: 5366

lexaur

Thanks both of you, now I magically got it to work!

Would it be possible to have different sheet scaling options inside Spine? So you could automatically do like 5 different sheet sizes and atlases when exporting.
lexaur
  • Сообщения: 3

Nate

Resizing options for packing are planned.

Pharan, runtime specific documentation is always welcome! :)
Аватара пользователя
Nate

Nate
  • Сообщения: 11260


Вернуться в Editor