Line Style and Point Size

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 must say I’m rather confused…

Anyway, I can unfortunately not access Claire’s Speckle Project

1 Like

Hi @JoostGevaert

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,

Cheers

2 Likes

Thanks a lot for that explanation @alex. This already clears up things significantly.

1 Like

Hi @alex
Thank you very much for the example.
I have just tried to implement it but see no results, although I get no bug.
Here is the new code for points style : geometrie-pour-architectes/src/extensions/styles.ts at d6716ab0fac71c05907e87de54eb36a420119a42 · ENAC-CNPA/geometrie-pour-architectes · GitHub
Which I import in : geometrie-pour-architectes/src/main.ts at d6716ab0fac71c05907e87de54eb36a420119a42 · ENAC-CNPA/geometrie-pour-architectes · GitHub

Here is the result : Géométrie pour Architectes

Points are loaded in the console, but don’t become blue.

What I don’t get is how your code works, even if you don’t explicitly declare any SpecklePointMaterial on line 46.

Hi @RaphaelVouilloz

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).

Cheers

Anyway, I can unfortunately not access Claire’s Speckle Project

@JoostGevaert made the project public, so inspect at your leisure!

2 Likes