How to implement clipping on ShaderMaterial?
http://fiddle.jshell.net/sogrey/5wL20k3m/32/show/
First advice is to include the clipping ShaderChunk
s, as is done in the built-in shaders in ShaderLib
. Both are found under src/renderers/shaders
.
In the example, the plane is clipped, but the box is not. The material of the box is ShaderMaterial.
1 Like
Is that all?
Yes. You have to #include
them in the same/similar places that they are included in e.g. MeshBasicMaterial
, whose shaders you will find in the ShaderLib
folder (three.js\src\renderers\shaders\ShaderLib
). They are named meshbasic_vert.glsl.js
and meshbasic_frag.glsl.js
.