Hi @alex and @clrkng,
I’m trying to get my head around SpeckleMaterials, RenderMaterials, displayValues, displayStyles, and how to change line being able to change lineWeights and pointSizes, so I ended up here.
I’ll try to give a brief explanation for all of these terms:
SpeckleMaterials: Are materials that extend regular three.js materials, like MeshStandardMaterial or MeshBasicMaterial and have additional builtin functionality like RTE and batching support
RenderMaterial: Is speckle’s material data model. It holds a bunch of properties that can sufficiently describe how materials look. It’s mostly attributed to meshes
displayValues: Are objects attached to speckle objects which describe a renderable object. A good example here is a Brep having a Mesh as a display value. It;s not limited to this though. displayValues
are created by connectors when sending data out
DisplayStyle is also a speckle material data model, similar to RenderMaterial, but it’s meant for line based objects.
As for how to change the lineWeights, the displayStyle line’s object needs to have it’s lineWeight property set to an appropriate value. Note that the lineWeight value is expressed world space and the resulting displayed line thickness will never be less than 1px.
Changing point sizes is currently not possible based on data received by connectors. The viewer does support varying point size as show here but this means it will only work in custom web apps for now.
I’m sure @clrkng can make that project public so you can access it,
I’ve tried using your stream in this live example and the point materials get updated correctly.
This means that there is something down the line from where you set the custom point material here which is causing this behavior. I would suggest, commenting the lines after that one by one and see which one is causing the issue.
As per the documentation, setMaterial is an overloaded method which can take materials in 3 different formats. The format that my example is using is the intersection type RenderMaterial & DisplayStyle & MaterialOptions. This overload creates a material based on the intersection between RenderMaterial, DisplayStyle and MaterialOptions. Because this method does not discriminate based on the render view’s geometry type (mesh, lines, points) it needs to be able to build materials suitable for all gometry types. It’s also the easiest to work with, (though not necessarily the most efficient one).