Custom shader with built-in ADS model

There is good example about custom shaders here. But! How can I mix this dissolve effect into standard material? Like if I have any box with shades and then it dissolves by click wiith such cool animation? Should I use shader chunks in this case or implement my own Phong material?

Standard Material has it’s own shader.

You can override it with your own custom shader with specific effect.
Also, notice that update function will set default shader back.

Seems, That’s not what I’m really want, but thank you, I will try soon;

I believe you can do this effect using the shader chunk system, yes. All existing shader chunks can be found here:

I can imagine using the opacity map and overriding the default opacity chunk to do this:

Hmmm. But I’m not sure how you’d get the burning edge to be colored differently. Maybe @Mr_F has some advice.

1 Like

I see, thank you. In this case I should override diffuseTex chunk and discard pixels by threshold from opacity map. No need in burning edge, but albedo function is a good place for it too. But this answer still is not full.
I need to add one else uniform - opacityThreshold or smth like this - a number [0, 1]. Should I create new material or this is a workaround of dynamic adding uniforms?

What if I want change chunk, but I’m not sure what exactly material using (tex or just flat color)? I want create new chunk and include it inside main flow.

For example:
myChunk:

uniform vec3 edgeColor;
void albedoModifier() {
    if (dAlpha + 0.1 < alpha_ref) dAlbedo *= edgeColor.rgb;
}

diffuseConst:

uniform vec3 material_diffuse;
void getAlbedo() {
    dAlbedo = material_diffuse.rgb;
    albedoModifier(); // I need to insert this string into chunk, but it seems better into main()
}