Trying to get my Barycentric Shader working as a custom material?

You can’t use uv2 as it is used by the system as a 2nd coordinate set: I have used uv3 instead in the PG below.

Also, in the barycentric function, you assume that each triangle has unique vertices, which is not the case of the plane: there are only 4 vertices and 2 are reused in the two triangles. I have used the convertToFlatShadedMesh method of Mesh to make unique vertices.

https://playground.babylonjs.com/#LFZ3QM#1

1 Like