Godot Tutorial - Vertex Displacement using Visual Shader

 
"Displacement mapping is an alternative computer graphics technique in contrast to bump mapping, normal mapping, and parallax mapping, using a (procedural-) texture- or height map to cause an effect where the actual geometric position of points over the textured surface are displaced, often along the local surface normal, according to the value the texture function evaluates to at each point on the surface." (Wikipedia)
Yes, Displacement is very useful for making procedural things.
Here's how to make it using Visual Shader

Create a Plane


Subdivide it


Create new material


Change the cull mode to disabled


Go to "Vertex" and add Texture Node
 

Create Noise Texture


Add VectorOp(Add) node
 

Add Vertex node


Then connect to Vertex

Well but this looks weird.
Why? Because it adds all the vector components so it's not just adding Y, but X and Z too

Add Multiply node


Set Y to 1

Now it's correct because the addition of x and z becomes 0, because they are multiplied by 0. So x and z are added with 0 which means nothing

Try changing x to 1, then the x will be added to 1.


Likewise if x is changed to -1, then the x will be added to -1

But our mesh looks flat, as far as I know, because we change the vertices, then the normals become incorrect.

Connect to normal

Well now it doesn't looks flat anymore, but might look boring

On fragment shader, add noise texture











Still not satisfied? add Gradient Texture


Then color as you wish


How do you make the displacement higher or lower?Just change the Y


What if you want to change the property of noise but the texture or vertex don't go along?
Simply copy one of the noise textures and paste it, because they are the same resource, they will follow one another.



What if you want to change the details?
Simply change the subdivision, you can change it as you wish


Lower Subdivision = Lower Details
Higher Subdivision = Higher Details






Comments

Popular posts from this blog

Godot Tutorial - How to make Sword Slash Effect using Visual Shader - 3 different versions

Godot Tutorial - How to fix shader clipping