It looks like the position does not effect the instanced Version of the grease line?
I have a situation where we are saving out grease lines as glbs and them are re-importing them (hence why in this PG you see me make a new material from the vertexData.)
How can I first have the position on the greaseLine instanced mesh take effect?
You canāt modify the VertexData directly because GreasedLine builds its own buffers according to the properties provided to the builder function or to the constructor of the mesh.
You can use these properties to get or set colors and points:
How can you set vertex alphas then? The colors only accepts Color3s?
And why would setting the vertex color buffer prevent the instance from going into the correct position when that has nothing to do with where the points are located?
In this example Iām not modifying any of that but the instance still will not reposition? Even going into the inspector and trying to move it does nothing?
Also can you explain the colors vs the colors textures? Its kind of confusing to have three difference references to colors. Id imagine you only need the colorsTexture and pointers or just the colors, seems kinda redundant?
Sorry, I was not quite precise when I wrote that you canāt set the VertexData. However when you are dealing with PositionKind itās a different story. There are three other buffers created when setting the points. These buffers are needed for the camera facing feature.
This is seems to be a bug in GreasedLineMesh because it works with GreasedLineRibbonMesh so itās not about paths. I wil check it. Iāve created a lot of PGās for testing but Iām sure I didnāt cover all scenarios. Thank you for pointing out the issue.
There are multiple examples in the docs how to use these features:
If you provide the colors option it will create a colorsTexture but you can set the texture manually as well. The colorsTexture can be shared between multiple lines. So you can create the texture manually and set it to multiple lines however if you create each line with colors it will create one colorsTexture for each line.
Indeed, you should always use finalWorld, which will contain the right world matrix in all circumstances (morph, instance, thin instance, skinning), whereas world is not always defined (as you experienced!).
@Evgeni_Popov My visualization tests started to fail for the ShaderMaterial after I changed to finalWorld as you suggested and I tracked down the problem. If the mesh has instances it needs finalWorld but if there are no instances of the mesh it needs world. I tried to look at the generated shader code for some defines I can use to distinguish the two situations but I didnāt find anything. How to correctly deal with this issue? Thanks!