DYN-3896 Add support for geometry instancing in render pipeline#11914
DYN-3896 Add support for geometry instancing in render pipeline#11914mjkkirschner merged 33 commits intoDynamoDS:masterfrom
Conversation
mjkkirschner
left a comment
There was a problem hiding this comment.
I will need to continue reviewing this and the LibG changes - at the moment I don't yet understand the changes in the HelixWatch3dViewModel
|
@saintentropy discussed with @saintentropy - I will work to add some tests for this repo for this functionality. |
add viewmodel test that renders instances add test classes add test file
| /// <summary> | ||
| /// A flag used to indicate if the current geometrical configuration of an item has instance information. | ||
| /// </summary> | ||
| bool InstanceInfoAvailable { get; } |
There was a problem hiding this comment.
If something does not have instance information, it won't be an IInstanceableItem, right?
| /// <param name="package">The render package, where graphics data to be | ||
| /// pushed.</param> | ||
| /// <param name="parameters"></param> | ||
| void AddBaseTessellation(IRenderPackage package, TessellationParameters parameters); |
try making interfaces internal
small fixes internals visible for test update tests
| /// <returns></returns> | ||
| public bool ContainsTessellationId(Guid id) | ||
| { | ||
| return MeshVertexRangesAssociatedWithInstancing.ContainsKey(id) || LineVertexRangesAssociatedWithInstancing.ContainsKey(id); |
There was a problem hiding this comment.
@mjkkirschner Hmmmmm.... Not sure but we may need to handle a transform that has both mesh and line type tessellation data. Maybe when edges are on. I can't remember how that case was supported.
There was a problem hiding this comment.
It might be a bit of a hack but the LIbG portion could actually handle this ^^^ I think. I always wondered why we didn't handle the ShowEdges in the base tessellation call. Maybe puts too much ownership on those implementing IGraphicItem. In this case we are still internal so it may work to let the instanceableItem handle the data. In the case of a cube, AddBaseTessellation(instancingPackage, factory.TessellationParameters) could inspect the TessellationParameters and add only a mesh or a mesh and line data if edges are needed. They would have to have separate GUIDs. The subsequent call to AddInstance(instancingPackage, factory.TessellationParameters, labelKey) could also add the correct instance references fo either mesh only or mesh and line data.
There was a problem hiding this comment.
This may also be follow up task?
There was a problem hiding this comment.
I wonder if we can just push the line data to the baseTessellation from this method:
or always generate the edge data in baseTessellation but only using it (extracting it from the render package) if show edges is on.
For the current state of the PR, I think we need to decide the following:
- When show_edges is on, we don't use instancing OR -
- When show_edges is on, we use instancing but don't draw edges... OR
- When show_edges is on, we use instancing for the meshes, but push a bunch of non instanced edge data?
There was a problem hiding this comment.
Could be also...
4. Edges added within instancing implementation.
| } | ||
|
|
||
| /// <summary> | ||
| /// A test class that creates a pyramid using instancing. |
add test that will fail until libG changes are merged
|
|
||
| } | ||
| [Test] | ||
| [Category("Failure")] |
There was a problem hiding this comment.
we can enable this after the LibG changes are merged, it will fail until then because the number of instances will be incorrect.
|
Hey @mjkkirschner, the show edges implementation looks good. This PR LGTM |
Purpose
https://jira.autodesk.com/browse/DYN-3896
The purpose of this PR is to add geometry instancing support in the render pipeline for the 3D background preview. This work build on the PR where we modified the render pipeline to gather one
RenderPackageper node. Instancing can be utilized to reduce tessellation overhead for symmetrical geometry types (cube, rectangle, sphere, circle, ellipse, cylinders, coordinate systems, and planes) as well as dramatically improve render time and memory usage required for the 3D Preview. Perf and memory testing will depend on the object type and size of tessellation data but an example of 30,000 spheres reduces the tessellation and render time from 23 to 2 sec and memory size of Dynamo from 5gig to 500 mb.(500,000 Spheres)

Specifically this PR adds to Dynamo:
IInstanceableIteminterface that follows the pattern ofIGraphicItemwhere the interface is applied to object who can be rendered via instancing. The interface add a method to the object to define a base set of tessellation data and methods to set transformation matrices for any instance geometry. The transforms handle the transition, rotation, and scaling of the base tessellation data to the objects placement in 3D spaceIRenderInstancesinterface for extending RenderPackges to support storing base tessellation data and instance mtaricesHelixWatch3DViewModelto utilize the Helix instancing APIs to render geometry with associated instance matrices.There will be an associated PR for LibG to utilize these new interfaces and new API's
Todo
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@aparajit-pratap @mjkkirschner
FYIs
@QilongTang @jasonstratton