Jan Posted February 15, 2014 Report Share Posted February 15, 2014 Hello, I've written a spriter importer for my own render engine. Everything is working as expected up the point when bones are scaled in spriter. Then my displayed characters are distorded badly. I think I just didn't understand how scale is applied in spriter and unfortunately things are still not getting clear to me even after thinking about it and reducing setups to a minimum. So my basic questions are: Which role is playing scale in the whole transformation setup and in which order is it applied? Here are some points that confuse me: The scml documentation says for scale: "ratio of (original) image width/height". When I change the scale in spriter all other connected bones are moving to. So obviously scale is also applied to the bone transformation and is not only applied as a factor to the image size. Is the documentation outdated at this point or did I misunderstand the documentation? In a very basic setup when I connect one sprite to a bone the sprite is rotated by 270°. That is right because the bone base position points down the positive x-axis. So the sprite must be rotated in it's local space by 270°. When the bone is scaled before the sprite is attached to it, the newly attached sprite gets a scale factor which compensates the bone scaling so that the sprite is displayed in its original size. In this setup the sprite gets a scale factor also for the x axis although it is rotated by 270°. I would have expected that it is scaled in y. As far as I can understand this scaling in x makes only sense if it is applied after rotation. This seems unusual to me and changing the transformation order (first rotate, then scale) only solves issues in certain situations. Thank you very much for your help! Kind regards, Jan Quote Link to comment Share on other sites More sharing options...
lucid Posted February 16, 2014 Report Share Posted February 16, 2014 Hello Jan, Spriter is designed to work even on engines using separate sprites for each object, where only scale and angle are applied on an individual basis. This might help to explain: So, the if the first bone is 1.5 x scaled, then rotated. Any child bone or sprite, will be 1.5 x scaled*their own x scale, then rotated, and any child of that bone, will be the result that multiplied x scale times it's own, etc. Please let me know if that answers your question, if not I can give a more detailed answer. Quote Link to comment Share on other sites More sharing options...
Jan Posted February 16, 2014 Author Report Share Posted February 16, 2014 Hello lucid, thank you very much for the quick reply. When I got you right my assumed order of transformation is wrong. Just to clearify, I thought a sprite's transformation would be calculated like this: M_sprite = M_parent_t * M_parent_r * M_parent_s * M_t * M_r * M_s (Last transform applied first.) But scaling must be calculated independently. So the correct way would be: M_overall_scale = M_parent_s * M_s M_sprite = M_parent_t * M_parent_r * M_t * M_r * M_overall_scale Did I get you right? Unfortunately I didn't have the possibility to test this but I will do that as soon as possible. Jan Quote Link to comment Share on other sites More sharing options...
lucid Posted February 17, 2014 Report Share Posted February 17, 2014 that looks right, Jan. let me know if it works Quote Link to comment Share on other sites More sharing options...
Jan Posted February 17, 2014 Author Report Share Posted February 17, 2014 Hi lucid, my scaling problems seem to be solved, no more distortions... Thank you! Jan Quote Link to comment Share on other sites More sharing options...
lucid Posted February 18, 2014 Report Share Posted February 18, 2014 np Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.