Commit Graph

647 Commits

Author SHA1 Message Date
AlexandruPopovici fe1a9f2eb3 Updated the older synchronous object loading function 2023-06-06 20:29:26 +03:00
Alexandru Popovici b3d8c5d28c Text support and limited Dimensions support (#1604)
* Font loading (hidden under a .png for now). Simple experiments with rendering text

* Added some text rendering tests. WIP on billboarding

* Added tests using troika-text-three library which uses sdf font textures instead of generating text geometry

* WIP on supporting speckle text objects

* Some more work on speckle text object integration. Worked on text materials, text batch and text object. We're now rendering basic text

* We're now rendering the text for various dimension types. Changed text to use display style first, since that's the one that contains it's color.

* Implemented text selection. Text can now be selected and works the same way every other speckle objects works when selecting

* Implemented the rest of the filtering features for text.

* Batch building can now be async. Building text batches needs to be async because that's how the troika libary works. Fixed an issue with the section box not clippin text properly

* Removed dummy text geometry data from it's RenderData. Enabled render views with metadata to count as valid. getRenderableRenderViews now returns nodes with metadata as well. Text now supports proper unit conversion. Text now is being displayed correctly(-ish) when inside blocks. Autocad text is now being displayed
2023-06-06 15:49:47 +03:00
AlexandruPopovici ebdb30dc14 Fixed a source of possible race conditions 2023-06-01 17:04:11 +03:00
Alexandru Popovici de48e2c453 Base objects in Blocks (#1600)
* Fixed a displaying issue with blocks that contain non-direct-convertible objects.

* Revert "Fixed a displaying issue with blocks that contain non-direct-convertible objects."

This reverts commit dc44a07d79e605e42e605befde1b09fdc95429d5.

* Different approach on fixing the Base object with display values in Blocks which should not generate regression since it's restricted only to blocks and works the same way for other situations except this one

* Added 'elements' lookup as well

* Check if display values or elements exist before destructuring them
2023-05-29 16:23:09 +03:00
AlexandruPopovici 0b7887767a Updated how the viewer emits the Busy signal so it reflects it's activity better 2023-05-22 18:03:47 +03:00
Alexandru Popovici 1668cf6a65 Alex/diffing part 2 (#1579)
* Fixed an issue with curves doubling up on geometry and also not being selectable after the last filtering changes. Added the options to make lines transparent. Added lines to diffing

* Points now are diff-able and support proper visual diff-ing. Visual diff filters are now chosen internally by the Differ. Fixed an issue with LineBatch and transparency

* Implemented PLAIN visual diff mode, where all objects keep their original materil, but opacity is manipulated via the diff time. Added API member function to switch between the PLAIN and COLORED visual diff modes

* Diffing fixes for instances and blocks. Things seem to be working fine, but there are some caveats. Additionally, some older issues were fixed and diffing now works better on all the rest of the streams

* Fixed the diffing issues with revit instances and hosted elements and nesting, etc. SetUserMaterial now accepts an optional list of rvs to apply the filter to, instead of figuring out the rvs itself.
2023-05-19 16:41:26 +03:00
AlexandruPopovici 7248156d89 Fixed an issue where elements weren't properly read for revit instances 2023-05-18 18:36:37 +03:00
Alexandru Popovici 294f2a101d Instance/Block Selection Fixes (#1572)
* Fixed conflicts

* Fixed the issues with instances not isolating. Fixed the issue with not being able to zoom in on instances
2023-05-11 11:34:37 +03:00
Alexandru Popovici e7d77ab157 Fix for #1525 (#1566) 2023-05-08 18:02:36 +03:00
Alexandru Popovici 71ed93192f Added speckle type inheritance parsing in the converter (#1565) 2023-05-08 18:01:34 +03:00
Kristaps Fabians Geikins b02a07e2b6 feat: Frontend 2.0 MVP 2023-05-08 10:47:01 +03:00
AlexandruPopovici 3238427488 Due to a small overlook, mesh batches had color VBOs created always, regardless if there were colors or not. With this fixed, we're reduced memory footprint taken up pointlessly 2023-05-07 17:14:43 +03:00
AlexandruPopovici a8a43497d2 Added world reduction after subtree removel from the scene. Removed all sandbox calls to the World interface 2023-05-06 00:07:06 +03:00
AlexandruPopovici 793f8bab51 Fix for an issue with block instances conversions and older older commits 2023-05-05 23:49:29 +03:00
Dimitrie Stefanescu 65334ff3c0 fix(viewer): adds support for @elements as well as elements in viewer traversal (#1563) 2023-05-05 20:33:14 +03:00
Iain Sproat 4eab7d9dcd chore(deps): bump node to 18.16.0 (#1564) 2023-05-05 12:43:39 +01:00
AlexandruPopovici e90abfbe88 Added BAS direct indexing from TAS for shapecasting as well. Forgot to add it in the last PR 2023-05-02 15:24:58 +03:00
AlexandruPopovici 14d7e46c55 Added automatic explode range calculation. Fixed an issue where meshes with no faces were making the viewer throw errors. They are now properly ignored. Fixed an issue where the TAS was not computing the total bounds correctly after creation, leading to incorrect world sizes 2023-05-02 15:11:24 +03:00
Alexandru Popovici 6a09866535 Top Level Acceleration Structure (#1553)
* Started implementing the TAS by using the same BVH library and  solid bounding boxes as dummy geometry. It works great so far, we're almost at 10X faster than without it. Still needs a bit more work put int the details

* Implemented shapecasting with the TAS in a fairly efficient way. This means that our current application for shapecasting, the section outlines, are much faster to generate now.

* Implemented TAS refiting whenever batch objects change their position/rotation/scale. It's sufficiently fast. The refiting process itself is very very fast on the TAS, the thing that slows it down a bit is all the matrix multiplications. We can speed those up via micro optimisations

* Replaced default three.js box geometry construction with a bare bones one since that's all required for our TAS

* Used buffers in the occlusion query solve to avoid pointless vector creation

* Some small changes and renames

* Changed the section box helper to use Box3Helper instead of BoxHelper beacuse Box3Helper always uses vertex positions relative to world origin and stores the transformation in it's world matrix which it never uses inside the vertex program, hence no floating point imprecision. The worldView matrix which it does use, has as a result small values essentially working like RTE. It will only work for relatively small objects, though and if we have large box helpers far away from origin it, we will begin to see jitter. However, this is just a visual helper, so I'm fine with that caveat

* Reported bounding box the the TAS is it's own BVH bounds now, not te cummulated BAS bounds like before. It's much faster this way

* Limited object explode transform calculation to exclusevely 1 per frame, since UI events coming from sliders and such tend to create multiple events per frame, leading to us computing millions of transformations pointlessly.

* The TAS leafs now only have the minimum possible of 8 vertices and 12 triangles. This sped up BVH operations a bit

* Considerable speedup for ray-TAS intersection by eliminating the need to iterate over all contained batch objects to determine the intersected one by comparing the intersection result vertex index. We can simply compute the intersected one since they are built in order with a constant stride between them inside the vertex array
2023-05-02 13:34:05 +03:00
Alexandru Popovici e8d947e772 Added support for numeric line fiters (#1545) 2023-05-02 13:32:32 +03:00
Alexandru Popovici 7ea5e35761 Diffing (#1543)
* WIP on naive diffing

* WIP on animating modified objects after diff

* Some more work on this

* Default building

* Removed and added now get opacity transitions as well

* Updated starting model

* Implemented two 'subpasses' in side the color pass, where opaque and transparent draw groups are rendered individually. Disabled double side depth rendering when visual diffing, to avoid AO generated by backfaces, visible through transparent diffed objects. Removed previous hacks

* Finished with cleaning up diff-ing related viewer functionality.

* Implemented UserMaterialState into filtering manager, as a 'sticky' filter which always gets applied before any other filters, until removed. Visual diff-ing and undiff-ing now go through the filtering manager so other filters can be stacked on top of it

* diff API function now checks to see if the diffing streams exist, if not, it loads them, computes the diff and applies the visual diff all in one call. Added undiff in the API which removes all the diff related sticky filters. Added setDiffTime in the API. DiffResult now holds modifiedOld and modifiedNew speckle objects in the same member as 2 item sequential arrays

* There was an unreported git conflict in one of the shaders. Fixed that
2023-04-21 15:41:26 +03:00
Alexandru Popovici 4aef572a44 Multi Viewer (#1518)
* Fixed an issue with HDRIs not generating proper PMREMs over multiple viewer instances

* WIP on makign the world tree multiple instanced

* The WorldTree is no longer static. Each viewer has it's own instance and it hands it over to whoever needs it.

* Fixed an issue with filtering and the new non-static tree. Also removed the 'root' key from the NodeData structure since it's not needed

* Added an guard when building batches for situations where all render views have invalid geometries. This generally means there is somethign wrong with the stream itself

* multi-viewer css fixes

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2023-04-21 13:12:15 +03:00
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
Alexandru Popovici 9b6be5ba52 Disabled rendering of line-based geometry in the shadowcatcher pass (#1476) 2023-03-23 14:04:05 +02:00
Iain Sproat 87e8d08e64 chore(deps): bump node to 18.15.0 (#1446) 2023-03-10 11:01:30 +00:00
AlexandruPopovici f187510467 Merged 2023-03-08 14:34:37 +02:00
Alexandru Popovici 3932a4bb93 Occlusion queries no longer report the ocluding speckle object, only it's id. This avoids walking the tree to fetch the object itself, which is unused in 99% of uses cases for occlusion testing. If the users need the object itself, they can still fetch it via the viewer API using it's id. This improves total occlusion query speed by 30-100x (#1438) 2023-03-06 17:33:34 +02:00
Alexandru Popovici 7bac769180 Fixed the issue with polycurve elements being conveted twice. Added the concept of nesteNodes in NodeData interface, but I'm wary of using it extensively (#1436) 2023-03-03 16:17:23 +02:00
AlexandruPopovici 06fc06adf5 Implemented hosted revit instances not stacking their host's transformation 2023-03-02 17:00:34 +02:00
AlexandruPopovici e037b310e5 Disabled tonemapping for point and point cloud materials 2023-03-02 13:13:57 +02:00
Iain Sproat d8b7123ed0 chore(deps): bump node from 18.14.0 to 18.14.2 (#1426) 2023-03-01 12:16:55 +00:00
AlexandruPopovici cc2a68f6ea RevitInstances now always stack transforms 2023-03-01 11:52:39 +02:00
AlexandruPopovici 38d81c2d06 Merged 2023-02-28 15:20:37 +02:00
Alexandru Popovici 6b7dbc5d70 Reduced Viewer Memory Footprint (#1406)
* The ObjectLoader and ViewerObjectsLoaders are disposed upon loading complete.

* Added viewer parameter for keeping or discarding original geometry data. Defaults to discarding it. WIP on mesh and point cloud implementation for actual discarding it

* Geometry data from raw nodes is now disposed after building their reder views

* Removed raw geometry data from points and lines

* Removed the float64 array which was persisted pointlessly by the section plane outlines feature. Also fixed a bug for this feature regarding resizing the point buffer and RTE

* Implemented BVHs in local space, relative to world origin. This cuts down on it's redundant memory footprint by half

* Implemented SpeckleMeshBVH which completely hides the RTE-related transformations that we're making to reduce memory footprint.

* Added some clarifications to the SpeckleMeshBVH class
2023-02-28 13:07:33 +02:00
Alexandru Popovici b9d68efc55 #1408 - Separate Object Layers by Geometry Type (#1422)
* Extended the ObjectLayers on a per geometry type basis. We can now restrict intersections and rendering based on geometry type (mesh, line, point)

* Disabled geometry type based filtering of opaque/transparent/stencil objects in the batcher, since we're using separate object layers for the geometry types now

* Fixed and issue with OR-ing layers
2023-02-27 16:20:42 +02:00
AlexandruPopovici b231204d24 WIP on instances transformation 2023-02-27 11:10:18 +02:00
AlexandruPopovici 0c5303e8e7 Implemented instance and revit instance conversion. First draft 2023-02-24 16:59:41 +02:00
Alexandru Popovici 5a17271afe Ignoring curves with no display values (#1398)
* Empty curves are now ignored and warned about instead of crashing the viewer

* Fixed typo
2023-02-21 11:26:34 +02:00
Alexandru Popovici 1c78607942 Alex/#1347 Async Loading and Load cancelling (#1367)
* Implemented async walk for the world tree. Implemented asyn render tree building and async batch building. Implemented progressive loading

* WIP tree walk async that actually works using a generator

* Async walking now properly works and can be interrupted

* Properly working async walk

* Added loadObjectAsync function in the API which should be used if stream loading needs to be cancelled and for 'progressive' loading. Added a priority argument to the loadObjectAsync and to walkAsync functions which makes the async-iness so to speak configurable.

* Refactored the sync and async subtree batch building to remove duplicate code. Changed some logs for better clarity

* Fixed an issue with point clouds and material creation
2023-02-17 13:45:22 +02:00
Alexandru Popovici 5f53558abe Added displayable geometry validation instead of testing it's aabb, which is 0 for points (#1373) 2023-02-15 16:18:05 +02:00
Alexandru Popovici 234c403430 Fixed a viewer issue related to having meshes with no vertex data and IBO shufling. We're now ignoring any render view which lacks vertex data and we're also displaying a warning when such objects are converted (#1369) 2023-02-14 12:43:44 +02:00
Iain Sproat a6fba9ebd3 chore(node): bump node version to 18.14.0 (#1365) 2023-02-10 11:44:44 +00:00
Alexandru Popovici 3c78bfe9bb Clamped the maximum shadowcatcher texture size to the maximum hw allowed texture size modulated by a customisable scale (defaults to 0.5). This fixes the error we had for some streams where resulting texture size would exceed the maximum allowed (#1364) 2023-02-09 11:48:04 +02:00
AlexandruPopovici 9bfa2b8931 Changed some default shadowcatcher parameters 2023-02-02 18:54:10 +02:00
Kristaps Fabians Geikins 7aec9bf29d fix(frontend): viewer dragging not working in some cases (#1357) 2023-02-02 16:34:46 +02:00
AlexandruPopovici a9c97825dd Merge branch 'main' into alex/#1332-selection-style 2023-01-27 13:29:24 +02:00
AlexandruPopovici 39d68df932 Fixed an issue where batches would remain hidden after applying visibility only to stencil objects 2023-01-27 11:00:39 +02:00
AlexandruPopovici 248948363a Fixed an issue I created myslef a while ago. Reverted the object loader to the original state and made the ViewerObjectLoader to send the logger's logging function instead of the logger itself when creating ObjectLoader instances 2023-01-26 18:42:12 +02:00
AlexandruPopovici ef7495a397 Fixed an issue with transparent materials and outlining. Fixed an issue with selecting objects and shadowmap. Added section planes update to the stencil and stencil mask passes 2023-01-26 18:30:44 +02:00
Alexandru Popovici c6694c2511 query now returns the proper query result type. Added return type to the Utils functions (#1342) 2023-01-26 14:15:24 +02:00