@xyz unfortunately when I convert it seems to erase the hidden billboard code. @cybereality
I actually have no idea what the above code is trying to do.
My understanding is that we have:
Model space which is all points defined relative to the models center at 0, 0, 0.
World space which is all points defined relative tot he world's center at 0, 0, 0.
View space which is all points defined relative to the camera at 0, 0, 0.
And finally Clip space which is perspective and other stuff applied.
To go from Model space to World space we multiply by the Model matrix.
In Godot the Model matrix is called WORLD_MATRIX.
To go from World space to View space we multiply by the View matrix. In Godot the View matrix is called CAMERA_MATRIX.
In Godot the Model matrix and View matrix have been premultiplied to allow a direct translation from Model space to View space, this matrix is called the MODELVIEW_MATRIX.
To make a billboard shader the MODELVIEW_MATRIX must be changed such that it does not apply rotation, but still applies translation and scaling.
MODELVIEW_MATRIX = WORLD_MATRIX * CAMERA_MATRIX.
I believe the CAMERA_MATRIX = translation_matrix rotation_matrix scaling_matrix
Which gives us this:
MODELVIEW_MATRIX = WORLD_MATRIX (translation_matrix rotation_matrix * scaling_matrix)
Now we want to remove the rotation part so we get this:
MODELVIEW_MATRIX = WORLD_MATRIX (translation_matrix scaling_matrix)
I'm not sure where to get translation_matrix and scaling_matrix?
I'm sure I'm making a lot of other mistakes in logic. Can you fill in the gaps?