How to implement the global-clippingPlanes in three.js

I am curious that the WebGLRenderer.clippingPlanes can specify clipping the global plane. Can anyone explain how it works globally? I really hope to get your reply

1 Like

Generally:

  • local clipping planes work on specific objects
  • global clipping planes work on the whole scene

Here is an example of a scene with two global clipping planes. They are placed as a sandwich, so that only the space between them is rendered.

Lines 77-78 create two planes, line 93 defines them as global clipping planes, lines 99-106 rotate them.

https://codepen.io/boytchev/full/LYJOrQL

image

Remove or comment line 93 to see the scene without global clipping:

1 Like

Thanks for your reply. I understand the difference between global clipping and local clipping. I’m just curious about how to achieve global clipping, because the material of each object is different, why can a clippingplane affect the whole world? By defining a few global uniforms? Or is it something else? I’m curious about the internal implementation of three.js