Hello there, I am new to both three.js and stackoverflow. My goal is to clip and cap three.js objects that have been rendered so that I can move a helperPlane back and forth through the object in order to peek inside it and observe the object within. This task resembles the advanced clipping techniques described for OpenGL in this resource: More OpenGL Game Programming - Bonus - Advanced Clip Planes. Given that this functionality is achievable in OpenGL, I am curious if there exists a way to achieve similar effects in WebGL?
I have adapted the clipping_stencil example from threejs (webgl - clipping stencil), and everything appears to be correct as long as I do not alter the position of the helperPlanes. However, moving the helperPlanes causes some of the cap faces of the larger mesh to disappear, introduces rendering artifacts (possibly z-fighting related issues), and renders the caps in undesired positions.
Setting the renderingOrder property for the meshes was essential for ensuring the inner mesh is dynamically rendered within the scene. Yet, I am currently unsure about handling the z-fighting issue when adjusting the clipping planes using sliders.
I have also posted this query on discourse.threejs. All the details can be found in this JSFiddle link. Any assistance or guidance on resolving these challenges would be greatly appreciated.
Your modified JavaScript code goes here...