How to convert PNG texture to Material for Godot 3?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By roma

I started making a minecraft-like game and faced a problem: I have textures for different sides of the blocks, but I don’t know how to create a .Materials file from the texture png. Sorry for my bad English

:bust_in_silhouette: Reply From: Inces

Create a Cube in blender, assign one material to each side of the cube there. Export mesh as .gltf with materials set to “placeholder”.
In Godot You will have a MeshInstance of your cube. You can choose materials property in editor, and You will see 6 surface slots. Create new shader material there, new shader, with this code:

shader_type spatial;
uniform sampler2D image;

void fragment():
      ALBEDO = texture(image,UV).xyz ;

didn’t test it, I hope I didn;t make syntax error :slight_smile:
Anyways, now when You choose any of your material, You will see new property imageunder shader parameters. Input your texture there, and it should work.