Unity-Technologies/com.unity.demoteam.hair

Accessing position vertices

TumiJourdan opened this issue · 1 comments

I would like to access the mesh data of the strands in cpu, but I can't seem to find a way forward.
I can find the mesh and the mesh filter but no position data.

The closest I have managed is :
vertices = hairInstance.strandGroupInstances[0].sceneObjects.strandMeshFilter.mesh.vertices;
But this returns an empty array.

Capture

In the above image I can see that the Mesh has no position data. Just 2 UV channels. As far as I know the data exists because of the unique hair node used in shader-graph has a position attribute.

Truly stumped, any suggestions?

Hi there,

I can see why this may be confusing. The mesh that you mention (named "X-Lines:[strandGroupIndex]" when rendering lines) indeed does not store any position data, but only topology and metadata used during rendering.

The actual position data of the strands sits elsewhere: Take a look at the SolverData struct (HairSimData.cs) where the various buffers are annotated.