How to create a Clipping Plane in SceneKit scene?

I am trying to treat SCNPlane as cutting plane in a SceneKit Scene which is trasperent and sliding in the perpendicular direction only.

The plane should be cutting the nodes in the scene as it moves in any direction. The XY plane is moving in Z direction should how the part of the node geometry which is above the plan and hide the remaining and as the plane moves it should start hidding or unhidding the node geometry.
Can we create something like clipping plan in SceneKit scene?


Thanks in advance.

Replies

One way to do that is to use a shader or shadermodifier to simply discard fragments beyond the z position of the plane. Everytime the plane’s position updates, update a uniform in the shader.

Thank you for your quick response on this.


As I am new to OpenGL shader programming, Can you suggest me any way to do it without help of shaders ?

I have found that there exist an api as "GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);". Can I use this API for inserting a custom cliping plane ?


Also, I noticed that this API (glClipPlanef) is present on OpenGLES1.0. Please let me know how can I use OpenGLES1.0 for rendering. I am crating my window using SCNView from interface builder and setting Rendering API control in inspector as "OpenGLES".


Please let me know.

why don't you use simple cube, boolean tests and cull hidden nodes.