Advanced Sprite Billboarding with Godot C#, GDScript and GDShader [Godot Tutorial]
HTML-код
- Опубликовано: 5 июл 2024
- How to billboard a 3D sprite or plane mesh along an arbitrary axis using C# or GDScript scripts, or with GDShader. Godot has built-in full billboarding and billboarding along the global-Y, but if you want an object to point in the direction its travelling and rotate to face the camera, you'll have to do it this way.
⏱️ Timestamps:
0:00 Intro
0:32 Setting up the sprite
1:42 C# Implementation
4:55 Godot's in-built billboarding
5:57 Demonstration under moving node
6:43 Accounting for scale
7:20 GDScript implementation
8:49 Why we might need shaders
9:13 Setting up plane mesh and material shader
10:15 Cleaning up the shader
10:58 Writing the shader
12:55 Demonstration of shader
13:40 Conclusion
📻 Addendum:
If you're using the shader and find that your mesh is invisible you can:
A. Double check the order of the cross product, as reversing the order would mean you're pointing the back face to the camera; or
B. Add "cull_disabled" to the render_mode list to disable back-face culling.
🎶 Music tracks from:
- Le Metroid - Black Hole
- Provided by Lofi Girl
- • Le Metroid - Black Hol...
____________________________________________________________
You can also visit me at:
WEBSITE 🌏 polysthetic.com
THREADLESS 🕶️ polysthetic.threadless.com
DRIBBBLE 🏀 dribbble.com/polysthetic
RUclips 🎥 / polysthetic
AUDIOMACK 🎼 audiomack.com/polysthetic
INSTAGRAM 📸 / polysthetic
MASTODON 🦣 mastodon.online/@polysthetic
TWITTER 🐦 / polysthetic Хобби
📻 Addendum:
If you're using the shader and find that your mesh is invisible you can:
A. Double check the order of the cross product, as reversing the order would mean you're pointing the back face to the camera; or
B. Add "cull_disabled" to the render_mode list to disable back-face culling.
You may also want to set the render_mode to "unshaded" to prevent it from interacting with the light, similar to the 3D sprite.