Posts

Godot Tutorial - How to fix shader clipping

Image
  So I have AnimatedSprite with a shadow shader But as you can see, the shadow shader is cut off Let's say that our AnimatedSprite is in a Quad and what we'll do is expand the Quad Add Vertex node Add Multiply node and multiply by 2 This enlarges the Quad Now correct the texture by multiplying the UV Add Multiply node and multiply by 2 then connect Well, but the position is not correct Simply go to Vertex and add the Add node then adjust it My AnimatedSprite offset is in the center, so I add it by the size of my texture divided by 2. And yeah, no clipping anymore

Godot Tutorial - How to fix edge stretching

Image
So I have a sprite scene   If I move the UV, the pixels at the edge will stretch   it's quite annoying but we can handle it Decompose the UV that has been added Add Step node and set the value to 1 Then multiply with alpha and connect it Here it is but what if you move it with a negative value? Add the OneMinus node then the UV will flip horizontally But what about the Y? 'Extract' Y then add Step node Multiply them (by adding a multiply node) then connect. Likewise if you move the Y with a negative value add the OneMinus node then the UV will flip vertically

Godot Tutorial - Vertex Displacement using Visual Shader

Image
  "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 a