RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
1.02k stars 186 forks source link

Any trick to prevent rendering slowness for partially dynamic scene? #598

Closed lanceshih closed 1 month ago

lanceshih commented 1 month ago

I have a complicated scene, in which only a very small fraction of elements are dynamic during rendering.

I know I can set the "dynamicScene" parameter to true to tell Embree to do a faster BVH build, but I always think repetitively building a new BVH for the entire scene simply because of the small fraction of changing elements is a waste of time. Is there any trick to handle this situation?

johguenther commented 1 month ago

Two tricks that could work:

  1. The pathtracer searches for emitting geometries (to act as light source), which is currently not optimized and slow when there are many instances in the World. To workaround try setting parameter geometryLights of the pathtracer to false (will lead to more noise in the images if emissive geometries are used).
  2. If indeed the BVH build is the bottleneck then gather all the static elements of the scene into a single Group (keeping the default dynamicScene=false), which then becomes one Instance in the World (this requires to apply or "bake" the transformations into the Geometry's vertex positions). Then each dynamic geometry is put into its own Instance (with an updated transform each frame). Thus there should only be a few instances in the World in total, updating or building the top-level BVH is then fast (you may even not need to set dynamicScene to true at the World).