Page 1 of 1
					
				SpriteParameters::rotation
				Posted: Wed Sep 11, 2024 3:10 pm
				by LuziferSenpai
				Hey,
it would be nice if we could define a rotation for a sprite, so that we dont need to provide different angles or rotations of something.
I personly would use this for a mod, that would automaticly make 3 more equipment pieces for each one, for each direction.
Another use case:
When doing new pipe visualizations, I could just do the dot in the middle and then one arm at the top.
After that, I can easily just rotate the arm as I need, so with that I would reduce file size.
For example:
			
		
				
			 
- visualization-arm-north.png (674 Bytes) Viewed 861 times
 
Would turn into this, with a rotation of 1 or something like that.
			
		
				
			 
- visualization-arm-east.png (4.98 KiB) Viewed 861 times
 
Greetz,
Luzifer
 
			
					
				Re: SpriteParameters::rotation
				Posted: Mon Feb 03, 2025 9:06 pm
				by Oktokolo
				That's a nice modder QoL feature and could also help make big mods with tons of animations less of a VRAM hog.
Should probably be an angle in radians for easy scripting in prototype phase.
			 
			
					
				Re: SpriteParameters::rotation
				Posted: Mon Feb 03, 2025 10:27 pm
				by ElectroMagnetic
				+1 good idea
			 
			
					
				Re: SpriteParameters::rotation
				Posted: Mon Feb 03, 2025 10:53 pm
				by Muche
				Wouldn't that trade lower VRAM usage for higher CPU/GPU processing usage, i.e. lower FPS?
I mean, something has to rotate those pictures at some point in time.
			 
			
					
				Re: SpriteParameters::rotation
				Posted: Mon Feb 03, 2025 11:30 pm
				by Kiplacon
				Muche wrote: Mon Feb 03, 2025 10:53 pm
Wouldn't that trade lower VRAM usage for higher CPU/GPU processing usage, i.e. lower FPS?
I mean, something has to rotate those pictures at some point in time.
 
The main benefit is that you could make more flexible graphics with just one sprite instead of making unique sprites for everything. You would still be loading the rotated frames while the game is loading, so performance-wise it's theoretically all the same once the game is running. The idea is that it'd be a procedural alternative to making unique sprites for every application. One example is that I want to make an animation that's just a sprite spinning around its center. Right now I would have to make a sprite sheet that has every frame of rotation I want for the animation. If I could instead specify that frame X of the animation is the given sprite rotated 10 degrees times X repeated for 35 frames, it would make simple animations and sprites like this more flexible.
 
			
					
				Re: SpriteParameters::rotation
				Posted: Tue Feb 04, 2025 12:56 am
				by Oktokolo
				Muche wrote: Mon Feb 03, 2025 10:53 pm
Wouldn't that trade lower VRAM usage for higher CPU/GPU processing usage, i.e. lower FPS?
I mean, something has to rotate those pictures at some point in time.
 
GPUs are optimized to rotate, skew, and stretch texture coordinates while applying them to planes in a 3D space. No need to use the CPU for that. Just have the sprite's plane rotate, and the GPU will do the same it does now. There is no hardware optimization in the GPU for the edge case of someone making a 2D game.
 
			
					
				Re: SpriteParameters::rotation
				Posted: Tue Feb 04, 2025 1:46 am
				by curiosity