How to understand the matrix part of this gdshader

###4.2.1

QuestionRecently I watched a video of how to make effects like in game balatro. https://www.youtube.com/watch?v=Alwy-TH0WzE

The effect is pseudo3D. When cursor moving around the card, it will rotate accordingly

About he gdshader the code down below

I am making a video to introduce the code line by line. However I don’t know the meaning of matrix part in it. Can someone interpret how it works? Why we need a matrix to process the card image?

I will be appreciate! Thank you!

I’m no matrix math expert, but it looks like a rotation matrix for 3D vectors - basically, you can rotate a vector by multiplying it with a matrix. You can see that most numbers in the matrix are defined as either the sine or cosine of one of the angles he wants to rotate by.

You can search for “rotation matrix” to find explanations and examples and such. It’ll probably help if you understand polar coordinates too.

1 Like

It’s abs the key word I need, thank you.
I am searching for related information