Files
speckle-server/packages/viewer/src/modules/objects
Alexandru Popovici 90439d7d41 Alex/#1447 advanced batching (#1488)
* #1051 Implemented batch splitting based on a configurable mximum batch vertex count and configurable maximum batch object count. We're not splitting single objects though since that's not required right now and will do it when the need arrives

* Implemented dynamic batch object transformation using all available vertex uniforms.

* Fixed batch object index buffer size

* Added debug per object movement for debugging

* WIP on texture based object transform

* Finally fixed a bug which was making three.js use the same shader for multiple batches, and thus messing up individual obects transforms

* Integrated shadows, AO, depth, and selection material with the recent batching changes.

* Implemented per object BVH building and correct intersection testing when each object has its own transformation

* Implemented BatchObject which holds the single source of truth for individual transformations, it's BVH and some other WIP things

* Restructed how object level and batch level BVHs are constructed and used. Also added a bounds check for intersecting the batch level BVH (which is not really a bvh, just a flat list of small bvhs)

* Shapecasting now provides the intersected BatchObject inside the callbacks, so required data could be fetched from it. SectionOutlines now work correctly

* Fixed some issues regarding the shadowcatcher and the colored and ghost material uniform updates

* Fixed an issue with colored material and shadows. Restructed how speckle materials are defined and extended. This removes duplicate code as well as duplicate functionality. Implemented fro the standard material, still need to do it for the basic material

* Removed unused material and shaders

* Custom material defintion and extension MK2

* Improved the RTE and TRANSFORM_STORAGE shader blocks for minimal redundancy. Updated all shaders. Updated all materials to MK2. Still need to find a way to avoid some boilerplate code in the base materials

* Fixed an issue where three was incorrectly frustum culling objects

* Fixed the issue where depth material programs were getting ignored for batches with same object count, leading to incorrect depth

* Removed the need to have a preprocessor define for 0BJ_COUNT inside the batched shaders. This eliminates the extra startup time taken by all the program compiles. In order to do it, I had to drop using the scene override material in the depth pass. Instead we're applying the override material before the pass render on each objecti individually

* Added a generic method for overriding the batch's material, which can be used by any pass. Added a material cache for each batch so that we don't need to clone materials more than we need to. Fixed an issue in the depth mateial clone function which made three not update our uniforms (this happens so often I'm getting sick of it). Filters now use cached material so they work correctly

* Fixed a dreaded three.js bug where it would sporadically not update our custom uniforms for reasons unknown

* Finally managed to get mixins working for out material system. With this, we avoid needing to write duplicate boilerplate code for all speckle base material types. Only applied it to SpeckleStandardMaterial because I want to test more before I adopt it globally. Implemented our custom material overriding approach to the stencil and stencil mask passes.

* A lot of dead brain cells. Transforms and RTE and BVH and all them things work correctly, with the exception of transforming around a point very far from origin. That will cause jitter because we end up multiplying large floats

* Managed to get RTE working properly with individual object transforms, transforms around random pivot. Fixed an issue caused by the fact that three-mesh-bvh messes up the bounding box of objects very far away from origin. Worked around it. WIP on cleaning things up

* Solution for object transforms in a real RTE context (far from origin). First pass on cleanup. Solution will be applied to the rest of the shaders in the next commit

* Updated WebGL 1.0 transform texture sampling and matrix array transform fallback

* Updated all shaders with object transforms RTE solution

* Updated remaining materials to the new mixin'ed approach implemented a little while ago. This removes a ton of boilerplate repeated code

* Update the normals pass. Simplified and removed reduandant batch update ranges from the before/after pass callbacks

* Reorganized BatchObject so we're not wastefull with matrix and vector instantiations

* Added explode function in the viewer API

* Enabled cleaning of redundant geometry

* Some html crap

* Fixed an issue with filtering out invalid render views. Removed the red sphere of doom (forgot it in). Fixed an older issue (not related to this branch) where instance points were deleted while still being shared by other lines, yielding invalid lines

* Fixed ShowBatches

* Fixed some sandbox related issues and improved qol
2023-04-20 15:44:31 +03:00
..