Custom Shader with Clip Plane

Hi all,

Hopefully, this hasn’t been asked before - if so, apologies.

I’m playing around with custom shaders for the first time and noticed with a simple shader example that a clip plane no longer cuts the model after applying the shader material to the mesh. Am I doing something wrong, or do I need to add something to the custom shader code?

Playground with the problem: https://www.babylonjs-playground.com/#Y6W087#186

Still learning, any guidance is much appreciated! Thanks, J

You need to add some includes in your shaders and enable using clip planes in the ShaderMaterial:

https://www.babylonjs-playground.com/#Y6W087#187

2 Likes

Thanks, @Evgeni_Popov - that’s awesome, appreciate your help!

1 Like