I'm working on a procedural planet generator. My implementation is running a compute shader that calculates vertice positions based on noise algorithms and writing the vertex data directly into the vertex buffer using the ArrayMeshes SurfaceUpdateVertexRegion() method.
However, I can't figure out how to do the same with the updated normals. There doesn't seem to be a dedicated method for this, all I found is SurfaceUpdateAttributeRegion(), but every attempt at using that so far failed, to the point where I think that this is might be something totally different (contextually).
I either get errors that my planet mesh does not have an attribute buffer at all (which is strange since I do initialize the mesh with a normals array), or I get errors that I write too much into the buffer (the amount of bytes that exceed the buffer are the total amount of bytes I write, so basically it assumes the buffer is 0 in size.
This is the syntax for the method updating the vertices, which works perfectly fine:
PlanetMesh.SurfaceUpdateVertexRegion(0, 0, Rd.BufferGetData(VertexBuffer));
0 being the surface id (there is only 1) and 0 being the offset (no offset).
I would really appreciate any and all help or pointers how I can get this done.
I tried using the SurfaceUpdateAttributeRegion(), assuming normals would be part of "attributes", but errors messages make me doubt it by now.
A rendering server method which I forgot the name of also implied that the normals are directly stored inside the vertex buffer, but that would leave me even more clueless in how to update them specifically.