Closed joewhatkins closed 2 years ago
I'm thinking it might be simplest to just afford passing in an array of Object3Ds or a single Scene in order to support this use case. Then the end user can perform whatever filtering strategy they want and pass in the result. Then each object is included recursively in the processing. That would mean changing the APIs to the following:
const dynamicGenerator = new DynamicPathTracingSceneGenerator( Object3D | Array<Object3D> );
dynamicGenerator.generate();
const generator = new PathTracingSceneGenerator();
generator.generate( Object3D | Array<Object3D> );
How does that sound?
SGTM - to be clear, we still want users to be able to pass in a scene after this change, right? Just also support single Objects and arrays?
Fat fingered and accidentally closed this, reopening
There would be no change for single objects. A Scene
is just an instance of an Object3D
which is what's currently supported by the generation functions.
Different from #99, as I'd like to just exclude certain meshes from the rendering instead of certain areas.
We're working on a use case where users can switch between conventional rendering for editing a scene and the pathtracer for nice visualizations of the scene.
There are a ton of edit gizmos and widgets we want to include in the edit view but exclude from the pathtracing view.
The easiest way to implement this would probably be to pass a method to (PathTracingSceneGenerator|DynamicPathTracingSceneGenerator) that would filter each of the scene's meshes before building the BVH and generating the scene. This seems to work well implementing it locally.
This sound good? If so I can have a PR out pretty quickly.