I didnt want to use “colors array” as I want to apply different color on picking or highlighting.
(The optional parameter colors is an array of successive Color4, one per line point).
Lines like these… also have a master .color property… which you can easily set to a Color3-type value. In the above PG, I start green, then turn red after 5 secs, then turn white after another 5 secs.
StandardMaterial doesn’t work on these babies.
As a side-note, I’m not sure you can “pick” a line… but you can certainly highlightLayer and glowLayer them. Both of those… have colors of their own, too… so you can leave the lines white, but then when glowLayer or highlightLayer activates, it will “appear” to change the line color… to the glow/highlight color.
Lots of options, but… standardMaterial colors is not one. Sorry. Stay tuned for more comments, as I could have said something wrong, and I might need correcting. (common for me)
Hi thanks for the answer. I tried to modify the ShaderStore but it did not seem to work. Then I looked at Babylon.js/linesMesh.ts at master · BabylonJS/Babylon.js · GitHub and it seems to use other shaders: color.vertex and color.fragment and the _colorShader material seems private with no setter. I could not find in the code where “LineVertexShader” is used.
I might have various line objects using different vertex shaders.
The example seem to modify a global VS for lines. Is there a way to handle multiple version of VS for lines? Like having my own custom material for LineMesh the same way that I have for the other Mesh types.
Note: in the VS I need to write, the data defining the positions of the points come from computation on float textures and is animated with time. Different VS adapted to their specific data are required.
Solved!
I just need to do a normal mesh having a ShaderMaterial with a Line fillMode and fill it with dummy vertices. (or better, subclass the Mesh object and modify its _draw method to avoid having to fill a vertex array with dummy vertices).