03-25-2021, 04:03 PM
Hi,
I have a question about how the RenderableMeshPrimitives are created. I have following setup:
1. I create a DXMesh (let's say SimpleMesh<PositionNormalTexture>) that uses PBR. The corresponding Mesh.Id is 331.
2. Then I create 3 MeshObjectNodes with the same DXMesh. Each part is called part5 and consists of a SceneNode for local to world transformation and a MeshObjectNode called part5_ImportScaleFactorScaledMesh that introduces additional scaling (conversion to units, i.e. from meters to centimeters). The data are at the end (pretty verbose).
Now if I look at the data, it seems that for each MeshObjectNode is created new instance of RenderableMeshPrimitive. From that I assume, that there is no instancing involved. I would like to achieve instancing:
1. There should be only one RenderableMeshPrimitive but it would have instanced data for transformations that would be instanced on the gpu.
2. I have seen InstancedMeshGeometry3DNode. But it works only for WPF MeshGeometry3D (which DXMesh is not). Can it be used in some way (ideally without converting DXMesh to MeshGeometry3D)?
3. What the InstancedMeshGeometty3DNode actually does? Would it be like described in 1, or would RenderableMeshPrimitive be created for each instance? It should create RenderableInstancedObjectsPrimitive so I assume it's the former.
4. Can I force MeshObjectNode to create RenderableInstancedObjectsPrimitive? There is no InstancedMeshObjectNode as far as I know.
Thanks,
Janovsky Roman
The data actually in the system (it's just a part of the whole scene and there are more instances):
1. SceneNode (666) 'part5' WorldBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-25.4 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (667) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
2. SceneNode (668) 'part5' WorldBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-25.9 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (669) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
3. SceneNode (670) 'part5' WorldBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] LocalBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-26.4 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (671) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
ComplexGeometry:
0 RenderableMeshPrimitive indices count: 298818; Material: PhysicallyBasedMaterial (776) OverrideEffect: PhysicallyBasedRenderingEffect; [0.0 -0.1 -0.0 0.0][0.0 0.0 0.1 0.0][-0.1 -0.0 0.0 0.0][-10.7 44.7 6.6 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 323; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
1 RenderableMeshPrimitive indices count: 245904; Material: PhysicallyBasedMaterial (778) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.0 -0.1 0.0 0.0][0.0 0.0 0.1 0.0][-0.1 0.0 0.0 0.0][-10.7 44.7 7.6 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 324; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
2 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 7.4 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
3 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 6.9 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
4 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 6.4 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
5 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 5.9 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShado
I have a question about how the RenderableMeshPrimitives are created. I have following setup:
1. I create a DXMesh (let's say SimpleMesh<PositionNormalTexture>) that uses PBR. The corresponding Mesh.Id is 331.
2. Then I create 3 MeshObjectNodes with the same DXMesh. Each part is called part5 and consists of a SceneNode for local to world transformation and a MeshObjectNode called part5_ImportScaleFactorScaledMesh that introduces additional scaling (conversion to units, i.e. from meters to centimeters). The data are at the end (pretty verbose).
Now if I look at the data, it seems that for each MeshObjectNode is created new instance of RenderableMeshPrimitive. From that I assume, that there is no instancing involved. I would like to achieve instancing:
1. There should be only one RenderableMeshPrimitive but it would have instanced data for transformations that would be instanced on the gpu.
2. I have seen InstancedMeshGeometry3DNode. But it works only for WPF MeshGeometry3D (which DXMesh is not). Can it be used in some way (ideally without converting DXMesh to MeshGeometry3D)?
3. What the InstancedMeshGeometty3DNode actually does? Would it be like described in 1, or would RenderableMeshPrimitive be created for each instance? It should create RenderableInstancedObjectsPrimitive so I assume it's the former.
4. Can I force MeshObjectNode to create RenderableInstancedObjectsPrimitive? There is no InstancedMeshObjectNode as far as I know.
Thanks,
Janovsky Roman
The data actually in the system (it's just a part of the whole scene and there are more instances):
1. SceneNode (666) 'part5' WorldBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-25.4 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (667) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-25 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
2. SceneNode (668) 'part5' WorldBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-25.9 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (669) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-26 25 -12)->(-25 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
3. SceneNode (670) 'part5' WorldBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] LocalBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] Transform: [-0.0 0.0 -1.0 0.0][0.0 1.0 0.0 0.0][1.0 0.0 -0.0 0.0][-26.4 62.8 -7.5 1.0] Flags: Unchanged
MeshObjectNode (671) 'part5_ImportScaleFactorScaledMesh' WorldBounds: (-26 25 -12)->(-26 64 -7) [1 x 39 x 4] LocalBounds: (0 -38 -0)->(4 1 1) [4 x 39 x 1] Transform: Scale(0.1 0.1 0.1) ; Mesh.Id: 331 (IndexCount: 154,620); Mesh.Materials count: 1; SubMeshes count: 1 || PhysicallyBasedMaterial; Flags: Unchanged
ComplexGeometry:
0 RenderableMeshPrimitive indices count: 298818; Material: PhysicallyBasedMaterial (776) OverrideEffect: PhysicallyBasedRenderingEffect; [0.0 -0.1 -0.0 0.0][0.0 0.0 0.1 0.0][-0.1 -0.0 0.0 0.0][-10.7 44.7 6.6 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 323; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
1 RenderableMeshPrimitive indices count: 245904; Material: PhysicallyBasedMaterial (778) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.0 -0.1 0.0 0.0][0.0 0.0 0.1 0.0][-0.1 0.0 0.0 0.0][-10.7 44.7 7.6 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 324; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
2 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 7.4 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
3 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 6.9 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
4 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 6.4 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShadow
5 RenderableMeshPrimitive indices count: 154620; Material: PhysicallyBasedMaterial (780) OverrideEffect: PhysicallyBasedRenderingEffect; [-0.1 0.0 0.0 0.0][0.0 0.1 0.0 0.0][-0.0 0.0 -0.1 0.0][-26.5 62.8 5.9 1.0]; StateSortValue: 0x800000; OriginalObject: Ab3d.DirectX.SubMesh (Mesh.Id: 331; SubMesh index: 0); RenderingFlags: IsVisible IsFrontCounterClockwise IsCastingShadow IsReceivingShado