Shadow Contact in Babylon - ambient occlusion

Hey @Evgeni_Popov,

One more follow up question here:

I noticed in the all the version of code, when creating rtt material, you used clone rather than creating a new Standard Material:

const material = mesh.material ?? scene.defaultMaterial;
const materialForRTT = material.clone(material.name + "_rtt");

Just out of curiosity, is there a reason you clone it rather than creating a new material? What’s difference between cloning vs creating a new material in this context? Can I create a new material? Which approach is better?

Tawibox

There is no particular reason to use “clone” instead of creating a new one in this example, so feel free to do as you wish :slight_smile:

Why does BJS not make depth material? :astonished:

We have a kind of depth material, but internally, used by the depth renderer.

Note that providing users with a depth material would not cover all needs, as it would not take into account custom deformations in the vertex shader. In this respect, a plugin depth material would be better suited.

2 Likes

OK, I see