Is it possible to use normals from Sprite Bump in Godot? I know there is a way to define a normal map for a 'sprite' node in Godot, but I can't see anywhere to define a normal map in a CreatureGodot node.
Thanks in advance!
Normals in Godot?
Re: Normals in Godot?
Hello,
I am not sure how Godot's shader or nomals system works, I know there definitely is one. This might be more of a general Godot-related question than anything else.
Essentially the creature character when rendered in Godot already contains UVs per vertex, you wil need to figure out in Godot how to use those UVs to sample the normal map you want and then modify the normal. Since the characters are essentially a flat plane ( 2D to 3D ), you will just be modifying some unit vector (0, 0, 1) for example that gets changed via the normal map. That is the simplest example I can think of. However you should take a look at the Godot shader docs to see how it can be done.
Thanks
I am not sure how Godot's shader or nomals system works, I know there definitely is one. This might be more of a general Godot-related question than anything else.
Essentially the creature character when rendered in Godot already contains UVs per vertex, you wil need to figure out in Godot how to use those UVs to sample the normal map you want and then modify the normal. Since the characters are essentially a flat plane ( 2D to 3D ), you will just be modifying some unit vector (0, 0, 1) for example that gets changed via the normal map. That is the simplest example I can think of. However you should take a look at the Godot shader docs to see how it can be done.
Thanks
Re: Normals in Godot?
Thanks for that - haven't looked much at shaders at all.
It's really straightforward for a simple 2D sprite in Godot - just add the sprite texture, the normal map and a Light 2D and it's job done. I was hoping there might be a simple, magical way to do it with the Creature runtime
It's really straightforward for a simple 2D sprite in Godot - just add the sprite texture, the normal map and a Light 2D and it's job done. I was hoping there might be a simple, magical way to do it with the Creature runtime
-
- Posts: 9
- Joined: Wed Apr 14, 2021 3:51 am
Re: Normals in Godot?
Is it still the case that the only way to get normals on animation is to write our own shader for it?
Re: Normals in Godot?
Hello,
yes because Creature exposes it as a regular Godot Mesh. So you should be using Godot's own material system to achieve that.
You can also export as GLTF to take advantage of their 3D renderer for that.
Thanks
yes because Creature exposes it as a regular Godot Mesh. So you should be using Godot's own material system to achieve that.
You can also export as GLTF to take advantage of their 3D renderer for that.
Thanks
-
- Posts: 9
- Joined: Wed Apr 14, 2021 3:51 am
Re: Normals in Godot?
GLTF is super cool, but my game is 2d. I did find a shader tutorial that got the lights working, so yay! I'll put it here for reference in case anyone else wants/needs to know how to do it.
Modified from https://www.gdquest.com/tutorial/godot/ ... rmal-maps/:
1) Expand the Creature node’s Material in the Inspector and create a new Shader Material
2) Add a new Shader in the corresponding property.
3) Click the Shader to open the shader editor and paste this code into it:
4) Drag your normal map texture into the new normal shader param that was created.
Bam, your creature animation should be lit now.
Please ignore this horrible animation that was quickly done for testing.
Modified from https://www.gdquest.com/tutorial/godot/ ... rmal-maps/:
1) Expand the Creature node’s Material in the Inspector and create a new Shader Material
2) Add a new Shader in the corresponding property.
3) Click the Shader to open the shader editor and paste this code into it:
Code: Select all
// Mandatory line to define 2D shaders
shader_type canvas_item;
// Allows us to assign a normal map to the shader in the Inspector
uniform sampler2D normal_map;
void fragment(){
// Converts the texture data into a unit vector, with each channel in the [-1, 1] range
NORMAL = 2.0 * texture(normal_map, UV).rgb - 1.0;
}
Bam, your creature animation should be lit now.
Please ignore this horrible animation that was quickly done for testing.