Godot Vertex Shader Documentation
As an open source project Godot has a lot of trouble keeping its documentation fresh and relevant. This is likely because most people interested in open source projects are programmers and all they want to do is program. This is all the more true with a game engine as it attracts mostly people who want to make games, not people who want to work on tools. This situation leaves Godot in a place where much of the documentation has been around for awhile, and while it is still good, it becomes a little outdated. This PR replaces a section of the documentation to focus on using the vertex shader to displace vertices in a mesh, something that many new users would like to know more about.
The new documentation explains how to create a mesh within Godot and then create and apply a shader material to it. Then it explains how to write and use a vertex shader to displace the vertices to create a new heightmap. This is very useful for creating a lot of different effects.
One important part of this contribution is that it includes a code implementation of fbm-noise. fbm-noise is something that is used a lot for graphics stuff in gamedev but many new programmers struggle to implement it. So having an implementation in the official documentation should help many new users.
Heightmap made with sin and cosine:
Heightmap made with noise (much more interesting):
This documentation teaches new users how to:
- Create and subdivide a Plane Mesh
- Create and assign a material to a Mesh
- Write a Shader that displaces the vertices of a Mesh
- Pass values (Uniforms) into a Shader to update the Mesh in realtime
- Approximate normals from a height function
- Use a light with a custom material
This tutorial replaces one titled "Mesh generation with heightmap at shaders". The old tutorial required the user to use Gimp and Blender to make a plane and a heightmap. The new tutorial removes those requirements and instead goes more into depth on how to use a Vertex shader.
At the end of the tutorial the user should end up with something like this:
GitHub Proof of Authorship
- GitHub Account: https://github.com/clayjohn
- Pull Request: https://github.com/godotengine/godot-docs/pull/1540