What's different between pc.Material, pc.BasicMaterial and pc.StandardMaterial?

As the title, I don’t know the difference between these materials.
From the source code of playcanvas engine, pc.StandardMaterial and pc.BasicMaterial both inherit from pc.Material. They both have setShader method.
If I want to write custom shader, Which material should I use ? :face_with_raised_eyebrow:

Standard is for usual cases. It has shader for reflection, diffuse map, efc. Most of time its enough.

If you need custom effects with your own shaders, use basic one.

But in the official custom shader tutorial, it use pc.Material instead. :disappointed_relieved:


    // Create the shader from the definition
    this.shader = new pc.Shader(gd, shaderDefinition);

    // Create a new material and set the shader
    this.material = new pc.Material();
    this.material.setShader(this.shader);

What’s the different?

1 Like

Well, the best way to compare fully it is to check Basic ones definition on GitHub.

In a nutshell, you can replace any shader with yours.
Basic has only diffuse map, standard has a lot of maps for almost any purpose.

So it depends on what do you want. If you need only shader - use pc.Material either than any other.

1 Like

I see, thank you. :smiley: