user defined clip plane
See original GitHub issueI’d like to use user defined clipping planes. In openGL i would use:
glClipPlane(GL_CLIP_PLANE0, planeEq);
glEnable(GL_CLIP_PLANE0);
How can I do the same with webGL?
Issue Analytics
- State:
- Created 12 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
User-Defined Clip Plane - OpenGL Wiki
User -Defined Clip Plane. From OpenGL Wiki. Redirect page. Jump to navigation Jump to search. Redirect to:.
Read more >User clip planes on feature level 9 hardware - Win32 apps
A clip plane is defined by a vector with 4 components. The first three components define an x, y, z vector that emanates...
Read more >Clip Planes
I define my half-space using a unitized normal vector in (A,B,C) and a distance-from-origin in D. Clip planes are usually defined in world...
Read more >User-defined clipping planes, TInputShortcut example
ClipPlane allows you to define custom clipping planes. See our documentation of nodes, X3D documentation of ClipPlane, and a simple demo or very ......
Read more >Post: Clipping Plane - MIDAS IT
It displays the defined Clipping Plane when user click the Apply button in the Property Window or the Plot button in the Define...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hey many thanks guys!!
Your suggestions made me reconsider the problem, and I noticed that there was no ‘general’ lag, but only flickering when the near clip plane changes (the mirror position compared to the mirrored camera position).
So, you were almost there @WestLangley: it’s the matrices of the mirrored camera you need to update, not the camera itself.
Result: no more ‘lag’ : http://jsfiddle.net/slayvin/PT32b/2/ 😃
Yes, I’ve thought about it. It would be great to have a
new THREE.mirror()that handles everything. I’ll try to code something…I recently encountered the same problem while implementing reflective flat surfaces (aka ‘mirrors’ 😄 ) into three.js As far as I know, you can not have user-defined clipping planes with WebGL, at least not with the ‘simple’ openGL way you described. The trick is to use the “Oblique View Frustum” method, which is explained in this paper: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf The purpose of this method is to replace the near clip plane of your mirrored camera frustum by the plane defined by the reflective surface. There is even some source code provided (in C++ though): http://www.terathon.com/code/oblique.html
I successfully ported that method in three.js and here is a sample scene to show this live: http://jsfiddle.net/slayvin/PT32b/
The only remaining issue is that the renderTarget is rendered a frame behind, and I have no clue why! This causes some flickering when the camera moves too fast and when the mirror is going through other objects.
Any idea on how to fix this? Do I need to implement a kind of multi-buffering method, or is it simply because I don’t udpdate the camera matrix after modifying the frustum? If so, how can I do that?