Misalignment caused by rotation
Moderator: Graphics Moderators
Misalignment caused by rotation
So, I've got this problem, that every train with a length that isn't 8 tends to misalign when rotated, or when just going the other direction:
The smaller the train, the worse the misalignment. (ignore the gap between the the carriages of the second train) This misalignment is present for every train you rotate.
Note: I suppose that the misalignment on every second track in horizontal position is just me being lazy, but I would like to point out that the alignment I used there is the width of the sprite /2, but this causes the trains in both directions to be disaligned equally but opposite.
Why is this happening, and how do I get rid of it?
Source
The smaller the train, the worse the misalignment. (ignore the gap between the the carriages of the second train) This misalignment is present for every train you rotate.
Note: I suppose that the misalignment on every second track in horizontal position is just me being lazy, but I would like to point out that the alignment I used there is the width of the sprite /2, but this causes the trains in both directions to be disaligned equally but opposite.
Why is this happening, and how do I get rid of it?
Source
Re: Misalignment caused by rotation
This is purely down to offsets, also the trains that you've ticked are also not properly aligned.
Re: Misalignment caused by rotation
You are using 4 sprites-per-set/vehicle, correct?
It looks like everyone in the past 10 years only used the 8 sprites-per-set variant, so the 4-sprites-per-set variant was never adjusted to account for shortened vehicles.
It looks like everyone in the past 10 years only used the 8 sprites-per-set variant, so the 4-sprites-per-set variant was never adjusted to account for shortened vehicles.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: Misalignment caused by rotation
1) I can only provide 1 offset per direction. As for the second train, I set the vehicle size higher to simulate the damned loose coupling that occurred. This is the only not-perfectly aligned train:Leanden wrote:This is purely down to offsets, also the trains that you've ticked are also not properly aligned.
No. Here, have some spritesets:frosch wrote:You are using 4 sprites-per-set/vehicle, correct?
It looks like everyone in the past 10 years only used the 8 sprites-per-set variant, so the 4-sprites-per-set variant was never adjusted to account for shortened vehicles.
If the problem was with the 4-sprites per set stuff, then almost all wagons in almost every set should have this problem. On top of that; the engines of 3 out of 4 of these trains should also experience the problem, which they don't.
Re: Misalignment caused by rotation
Ah i use 8 sprite format as well, you can still use the 8 sprite setup defining the same sprites twice with different offsets.
Re: Misalignment caused by rotation
Excuse me, what do you mean by 8-sprite-whatyamacallit? Like this:Leanden wrote:Ah i use 8 sprite format as well, you can still use the 8 sprite setup defining the same sprites twice with different offsets.
rather than this:
If so, it makes no difference, as this:
is hit just as hard by this problem as the 4-sprite cars, even though it has the 8-sprite thing.
Re: Misalignment caused by rotation
i think that's backwards. everyone used the 8-sprite variant, because the 4-sprite variant was never adjusted for shortened vehicles. (which would only have been possible after the bounding box change, which is "only" like 5(?) years ago)frosch wrote:It looks like everyone in the past 10 years only used the 8 sprites-per-set variant, so the 4-sprites-per-set variant was never adjusted to account for shortened vehicles.
(this also overlaps with vehicle flipping working so poorly with shortened vehicles)
Re: Misalignment caused by rotation
Could I ask whether this:
Is 8-sprite or 4?
Because none of you guys are making any sense to me.
Is 8-sprite or 4?
Because none of you guys are making any sense to me.
Re: Misalignment caused by rotation
That is 8 sprite. Which would mean if you have set it up correctly you would 8 different offsets for each sprite.
Are you using templates for your spritesheets?
Are you using templates for your spritesheets?
Re: Misalignment caused by rotation
Yes. And if I understand correctly, this:Leanden wrote:That is 8 sprite. Which would mean if you have set it up correctly you would 8 different offsets for each sprite.
Are you using templates for your spritesheets?
Is also 8-sprite. And it's hit really damned hard by this bug.
Re: Misalignment caused by rotation
I believe thats part of a 16 sprite setup which was first devised by oberhuemer as part of CETS.Erato wrote:Yes. And if I understand correctly, this:Leanden wrote:That is 8 sprite. Which would mean if you have set it up correctly you would 8 different offsets for each sprite.
Are you using templates for your spritesheets?
Is also 8-sprite. And it's hit really damned hard by this bug.
Re: Misalignment caused by rotation
I'm confused. It's the same setup as the other one.Leanden wrote:I believe thats part of a 16 sprite setup which was first devised by oberhuemer as part of CETS.Erato wrote:Yes. And if I understand correctly, this:Leanden wrote:That is 8 sprite. Which would mean if you have set it up correctly you would 8 different offsets for each sprite.
Are you using templates for your spritesheets?
Is also 8-sprite. And it's hit really damned hard by this bug.
Re: Misalignment caused by rotation
My absolute apologies, im on my phone and its a really small scale. You were right that is an 8 sprite set.
Re: Misalignment caused by rotation
No problem.Leanden wrote:My absolute apologies, im on my phone and its a really small scale. You were right that is an 8 sprite set.
So, now I finally get what you guys are talking about, let's go back to my main question; why do both 8-sprite trains and 4-sprite trains misalign when their size is less than 8? And how do I solve it?
Re: Misalignment caused by rotation
Two points:Erato wrote:No problem.Leanden wrote:My absolute apologies, im on my phone and its a really small scale. You were right that is an 8 sprite set.
So, now I finally get what you guys are talking about, let's go back to my main question; why do both 8-sprite trains and 4-sprite trains misalign when their size is less than 8? And how do I solve it?
A) have you adjusted the length property for the shorter sprites (divide the number of pixels of the horizontal sprite into 32 and then multiply by 8 rounding up any decimals)
B) Have you adjusted the absolute size of the sprite in your spritesheet definition?
Re: Misalignment caused by rotation
A) YesLeanden wrote:Two points:Erato wrote:No problem.Leanden wrote:My absolute apologies, im on my phone and its a really small scale. You were right that is an 8 sprite set.
So, now I finally get what you guys are talking about, let's go back to my main question; why do both 8-sprite trains and 4-sprite trains misalign when their size is less than 8? And how do I solve it?
A) have you adjusted the length property for the shorter sprites (divide the number of pixels of the horizontal sprite into 32 and then multiply by 8 rounding up any decimals)
B) Have you adjusted the absolute size of the sprite in your spritesheet definition?
B) I don't really understand what you mean by that. Do you mean that I should put the sprites in the boxes that I use for the sprites with a length of 8?
-
- Tycoon
- Posts: 2781
- Joined: 22 Feb 2011 18:34
Re: Misalignment caused by rotation
Depends on the template you use. The Dutch Trainset uses separate templates for the different lengths, while the 2cc TrainsInNML set uses one template for all vehicles with length 1-8. Both approaches have their pros and cons. So to answer your question, there is no answer, as it can be both YES (if you take the 2cc TrainsInNML route) and NO (if you take the Dutch Trainset route), you have to decide how to do it.Erato wrote:B) I don't really understand what you mean by that. Do you mean that I should put the sprites in the boxes that I use for the sprites with a length of 8?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: Misalignment caused by rotation
For example i have different templates depending on the length of the train in the horizontal view.
I then setup templates within the code with offsets based upon which sprite template im using.
I then reference these templates in the spritesets:
I then setup templates within the code with offsets based upon which sprite template im using.
I then reference these templates in the spritesets:
- Attachments
-
- 20px.png (258 Bytes) Viewed 2729 times
-
- 21px.png (267 Bytes) Viewed 2729 times
-
- 28px.png (560 Bytes) Viewed 2729 times
Re: Misalignment caused by rotation
You mean like this? I've got one for every length that I use; 8, 7, 5 and 2. And when it's not 8, I get the damned bug.Leanden wrote:For example i have different templates depending on the length of the train in the horizontal view.
I then setup templates within the code with offsets based upon which sprite template im using.
I then reference these templates in the spritesets:
Re: Misalignment caused by rotation
This is your issue right here, you are defining the same offsets in both directions. Try something like this:Erato wrote:Code: Select all
template TEMP_CAR_5_NEW(y,h,d) { [0, y, 8, 16+h+d, -3, -11-h] [9, y, 16, 14+h+d, -14, -4-h] [26, y, 20, 12+h+d, -10, -6-h] [47, y, 16, 14+h+d, -2, -4-h]
Code: Select all
template TEMP_CAR_5_NEW(y,h,d) {
[0, y, 8, 16+h+d, -3, -11-h]
[9, y, 16, 14+h+d, -14, -4-h]
[26, y, 20, 12+h+d, -10, -6-h]
[47, y, 16, 14+h+d, -2, -4-h]
[0, y, 8, 16+h+d, -3, -11-h]
[9, y, 16, 14+h+d, -14, -4-h]
[26, y, 20, 12+h+d, -10, -6-h]
[47, y, 16, 14+h+d, -2, -4-h]
Also why are you using the h + d modifiers?? If you are consistently using the same templates you should be able to just put absolute values in here.
Who is online
Users browsing this forum: No registered users and 15 guests