Custom material with Shader

Hello,

I’m trying to make custom Shader material for mesh with a texture. And I’m taking Material Shaders as reference. What I figured out for now:

  • I have to use “Set material Image param” node to push the texture to the shader.
  • I have to input in that node Image field a relative path to my “Bundled” folder. As I have the texture right in that folder, for me it’s “/uvtemplate.jpg”.
  • In JSON that describes the Material with custom Shader, I have to add os it’s picked up by uniform provider:
"texture_units": [
  {
    "link": "pico",
    "name": "pico"
  }
],                    	
  • Then in fragment Shader I get then texture by “uniform sampler2D pico;” And it works.

The missing puzzle piece is and I don’t understand how to get uv coords, to use like: “fragColor = texture(pico, texCoord);”.

1 Like

I figured it out, but there is a bug with custom Shader material and it’s UV’s

1 Like

Hey!! You helped me out with the custom material shader but I am stuck at figuring out how to set the uv. I tried to set a texture from my glsl script.

Best I can tell from searching, you pass in “tex” for the uv coordinates.

{
“name”: “tex”,
“data”: “short2norm”
}

However, it doesn’t work for me either. Is this just something currently broken for making custom shaders?