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

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

I am struggling trying to get this to work like I did in this example:
https://www.babylonjs-playground.com/#G3GZA1#162

Any ideas how to get this working anyone? I was hoping to draw the quad of the ground plane without doing a whole customShader

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

Thank you for the solution its been a long day! Now I can go to bed.

1 Like