About material

Hello,

I try to create my first material.

So I copy / paste:

  • builtins/model.vp
  • builtins/model.fp
  • builtins/model.material

I change the vp and fp in the material.
I change the default property of my model.
Run, it seems to work, but I am not sure as there should be no difference…

So I take the fp, and I change the last line:
gl_FragColor = vec4(color.rgb*diff_light,1.0);
for:
gl_FragColor = vec4(0.5,0.0,0.0,1.0);

But I have this error:
ERROR:SCRIPT: main/camera.script:6: ‘/test#model’ does not have any property called ‘light’

But I copy all files, I only change the color at end to test. So there is a light in the vertex constants of the material and the vp has an uniform called light. Why I have this error !?

Because the inputs (uniforms, attributes, samplers etc) that you don’t use will get optimized away by the shader compiler, and then the material cannot find any corresponding “light” property because it doesn’t exist. There is a warning about this so you can catch these things early on when developing

1 Like