With lights (#94) the current idea is that these are objects that live inside the scene, and apply to all children in that scene (and grandchildren, etc).
Clipping planes have some similarities with lights, as in that they have a position and orientation in the world. I'd like to explore if we can treat lights and clipplanes in the same way. This may make the API simpler. Possibly there are other (future) features that also fall in this category.
I don't think there is much need to set lights per-object, but this need is there for clipping planes: sometimes you want to clip a single object, to "make space" for other objects, and sometimes you may want to apply the same clipping to a much bigger set of objects.
Ideas
Option 1 - props of Material (what we have now)
We have now more or less copied the approach of ThreeJS: we have Material.clipping_planes and Material.clipping_mode. This only really covers the first individual-object use-case.
(In ThreeJS the renderer has clippingPlanes prop (in addition to Material.clippingPlanes), which covers the use-case of applying the same clipping to multiple objects. This feels odd to me though.)
Option 2 - live in the scene
Make Light and ClipPlane objects participate in the scenegraph. They'd apply to the node they're a child of, as well as any of its children, grant-children, etc. This way, you can set clipplanes on the scene, on individual objects, and on groups of objects.
The lights and clipplanes would also be transformed according to the transforms of the node's they're part of. This can be an advantage or disadvantage :)
One (major) disadvantage of this is that you have to organize the scene graph in a specific way. If the position of an element in the graph determines its visibility, transform, lights, and clipping planes, then you can run into trouble because an element cannot be in multiple places in the graph at the same time.
Option 3 - prop of WorldObject
Like 2, but instead of being a Woldbject, they'd be a property of a WorldObject. That way they can be re-used in multiple places in the scenegraph, and clipping-planes can keep being just tuples.
Make lights and clipping planes world objects that live in the scene.
Give all world objects a configurable property that lists lights and clipping planes that apply to them. This allows users to control the rendering process.
Lights apply to all objects by default.
Clipping planes apply to no objects by default.
These defaults match the most common use scenarios.
With lights (#94) the current idea is that these are objects that live inside the scene, and apply to all children in that scene (and grandchildren, etc).
Clipping planes have some similarities with lights, as in that they have a position and orientation in the world. I'd like to explore if we can treat lights and clipplanes in the same way. This may make the API simpler. Possibly there are other (future) features that also fall in this category.
I don't think there is much need to set lights per-object, but this need is there for clipping planes: sometimes you want to clip a single object, to "make space" for other objects, and sometimes you may want to apply the same clipping to a much bigger set of objects.
Ideas
Option 1 - props of Material (what we have now)
We have now more or less copied the approach of ThreeJS: we have
Material.clipping_planes
andMaterial.clipping_mode
. This only really covers the first individual-object use-case.(In ThreeJS the renderer has
clippingPlanes
prop (in addition toMaterial.clippingPlanes
), which covers the use-case of applying the same clipping to multiple objects. This feels odd to me though.)Option 2 - live in the scene
Make
Light
andClipPlane
objects participate in the scenegraph. They'd apply to the node they're a child of, as well as any of its children, grant-children, etc. This way, you can set clipplanes on the scene, on individual objects, and on groups of objects.The lights and clipplanes would also be transformed according to the transforms of the node's they're part of. This can be an advantage or disadvantage :)
One (major) disadvantage of this is that you have to organize the scene graph in a specific way. If the position of an element in the graph determines its visibility, transform, lights, and clipping planes, then you can run into trouble because an element cannot be in multiple places in the graph at the same time.
Option 3 - prop of WorldObject
Like 2, but instead of being a
Woldbject
, they'd be a property of aWorldObject
. That way they can be re-used in multiple places in the scenegraph, and clipping-planes can keep being just tuples.Other options?
...
cc @brisvag