Inserting Lighting in shader

I have 2 questions about dissolve shader. PlayCanvas 3D HTML5 Game Engine

  1. How to manipulate with material color, that hasn’t a diffuse map texture(simple color). What i need to change?
  2. How to integrate a lighting to this shader. I found info, that i need to use chunks and work with them, where i can read about it?

Hi @wazti,

Since that is a custom shader, you have full control of the resulting pixel color on your fragment shader.

For example you can multiply the base color by a constant color value to give it a tint:

vec4 color = texture2D(uDiffuseMap, vUv0);
color.rgb *= vec3(0.3, 0.5, 1.0);

Or remove the texture dependency fully and keep a base color:

vec4 color = vec3(0.3, 0.5, 1.0, 1.0);

You got it right, the easiest way to integrate lighting to your shader is to override the internal engine shaders. Just note shader chunks are still an undocumented feature.

A good place to start are these shader chunks examples here:

You can find the full list of shaders used by the engine in this repo: