mrdoob/three.js — Issue #1330: dynamic clipping box
Author: landonsilla
Created: 2012-02-15 00:44:36+00:00
State: open

I have a scene that I render as a `ParticleSystem` or a mesh. Here's the `ParticleSystem` one:

http://archive.cyark.org/3d/index11.php?chunks=3

I want to put in a bounding box and have the user control the extents of the bounding box. And this bounding box would double as a clipping box, meaning anything outside of this box would not be visible. I'm new to 3d rendering, but I think this concept is pretty common. My question: How do I do this?

I figure, on every render() loop, I can go through all my points and test with simple math equations if they are out of the box or not. This concept is simple, but would probably kill my computer. My second thought would be to render massive black rectangles with outward culling which would just, essentially, block things outside of the box. This would require the background to be a flat color matching my blocking rectangles, which I don't want. I'd prefer a non flat background, like the one in my example above.

Is there an element in the api to do this? I found issue #647 which was rather brief, but implies that it can be done. Can you kindly provide some more information as to how to implement this?

I gather this is a feature in webgl that doesn't really have a three.js layer to support it. Is that correct? I don't know webgl, but I can learn. How do I incorporate webgl into my three.js application?