hello everybody Im trying to make a 2d memory game but the problem is to flip the card. in order to flip the card I need to rotate the image along the y axis but in 2d I cant do that so instead I need a 2d shader that will rotate the image along the y axis with the specified value (for example 0 means the image is not flipped at all and 1 means the image is fully flipped). do you know how can I implement this shader? (since I dont know much about shaders).
Do you really need a shader for it? Would scaling along an axis not emulate rotation?
well you right but the thing is that with shaders you can make the rotation effect more realistic and actually making it look like a true 3d rotation (something like a perspective effect). scaling would work but if there is a shader that can produce a better effect that will be cool.
Well at that point you might be better off asking yourself if it's perhaps worth making it actually 3D instead. 3D doesn't have to mean bad performance. If you don't use the effects and features that have a heavy cost. Probably better to use fixed-function transforms rather than shaders for the rotation I would think.
edit: or if you are really adamant about keeping it 2D why not use animated spritesheets? You could just have the rotation animation be pre-rendered. That would be significantly more performant I'd expect.
You may be interested in this shader: https://godotshaders.com/shader/perspective-warp-skew-shader/
yep I think this shader does the job, godot shaders? why I didnt know about this site before so much awesome shaders. thank you everybody.
© 2022 - 2024 — McMap. All rights reserved.