Skip to content

PointSplatModel

Visualization for a cloud of points using splatting.

Target: Sofa.GL.Component.Rendering3D

namespace: sofa::gl::component::rendering3d

parents:

  • VisualModel

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the object belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
enable Display the object or not 1
radius Radius of the spheres. 1
textureSize Size of the billboard texture. 32
alpha Opacity of the billboards. 1.0 is 100% opaque. 1
color Billboard color.(default=[1.0,1.0,1.0,1.0]) 1 1 1 1
pointData scalar field modulating point colors
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseComponent
master nullptr for regular objects, or master object for which this object is one sub-objects BaseComponent

Examples

PointSplatModel.scn

<?xml version="1.0" ?>
<!-- Mechanical PointSplatModel Example -->
<Node dt="0.005" gravity="0 -10 0">
    <RequiredPlugin pluginName="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [NewProximityIntersection] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [LineCollisionModel PointCollisionModel TriangleCollisionModel] -->
    <RequiredPlugin pluginName="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin pluginName="Sofa.Component.IntegrationScheme.Forward"/> <!-- Needed to use components [RungeKutta4IntegrationScheme] -->
    <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [PointSetTopologyContainer PointSetTopologyModifier] -->
    <RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel PointSplatModel] -->

    <DefaultAnimationLoop/>
    <CollisionPipeline verbose="0" />
    <NewProximityIntersection alarmDistance="0.5" contactDistance="0.3" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <CollisionResponse response="PenalityContactForceField" />
    <Node name="Fluid">
        <RungeKutta4IntegrationScheme />
        <MeshOBJLoader name="meshLoader" filename="mesh/dragon_clean.obj" scale3d="0.2 0.2 0.2"/>
        <PointSetTopologyContainer />
        <MechanicalObject name="MModel" position="@meshLoader.position"/>

        <PointSetTopologyContainer name="con" />
        <PointSetTopologyModifier name="mod" />

        <UniformMass name="M1" vertexMass="1" />
        <!-- Visual model -->
        <PointSplatModel name="VModel" radius="0.25" alpha="0.1" color="cyan" />
        <PointCollisionModel contactStiffness="100"  />
    </Node>
    <Node name="World">
        <MechanicalObject position="-4 -1.6 -4    4 -5.6 -4    4 -6.4 4    -4 -2.4 4" scale="1.075" />
        <MeshTopology triangles="0 1 2  0 2 3" />
        <TriangleCollisionModel contactStiffness="20" moving="false" simulated="false" />
        <LineCollisionModel contactStiffness="20" moving="false" simulated="false" />
        <PointCollisionModel contactStiffness="20" moving="false" simulated="false" />
        <OglModel name="VModel" color="blue" printLog="true" />
    </Node>
</Node>
def createScene(root_node):

   node = root_node.addChild('node', dt="0.005", gravity="0 -10 0")

   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Detection.Algorithm")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Detection.Intersection")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Geometry")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Collision.Response.Contact")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.IO.Mesh")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Mass")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.IntegrationScheme.Forward")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.StateContainer")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Constant")
   node.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Dynamic")
   node.addObject('RequiredPlugin', pluginName="Sofa.GL.Component.Rendering3D")
   node.addObject('DefaultAnimationLoop', )
   node.addObject('CollisionPipeline', verbose="0")
   node.addObject('NewProximityIntersection', alarmDistance="0.5", contactDistance="0.3")
   node.addObject('BruteForceBroadPhase', )
   node.addObject('BVHNarrowPhase', )
   node.addObject('CollisionResponse', response="PenalityContactForceField")

   fluid = node.addChild('Fluid')

   fluid.addObject('RungeKutta4IntegrationScheme', )
   fluid.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/dragon_clean.obj", scale3d="0.2 0.2 0.2")
   fluid.addObject('PointSetTopologyContainer', )
   fluid.addObject('MechanicalObject', name="MModel", position="@meshLoader.position")
   fluid.addObject('PointSetTopologyContainer', name="con")
   fluid.addObject('PointSetTopologyModifier', name="mod")
   fluid.addObject('UniformMass', name="M1", vertexMass="1")
   fluid.addObject('PointSplatModel', name="VModel", radius="0.25", alpha="0.1", color="cyan")
   fluid.addObject('PointCollisionModel', contactStiffness="100")

   world = node.addChild('World')

   world.addObject('MechanicalObject', position="-4 -1.6 -4    4 -5.6 -4    4 -6.4 4    -4 -2.4 4", scale="1.075")
   world.addObject('MeshTopology', triangles="0 1 2  0 2 3")
   world.addObject('TriangleCollisionModel', contactStiffness="20", moving="false", simulated="false")
   world.addObject('LineCollisionModel', contactStiffness="20", moving="false", simulated="false")
   world.addObject('PointCollisionModel', contactStiffness="20", moving="false", simulated="false")
   world.addObject('OglModel', name="VModel", color="blue", printLog="true")