Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Acessing SkinnedMeshRenderer data
#1
Hi!

I'm trying to test the Obi Softbody add-on, and I need to retrieve the mesh data from the SkinnedMeshRenderer.

In my current implementation (without softbody), I set three Graphics Buffers of position, normal and tangent streams of the SkinnedMeshRenderer, and then access their offsets.
However, when I try to skin the SMR with Softbody Skinner, I retrieve initial vertex data like it was in the viewport before the simulation.
As far as I understand, Softbody Skinner should update skinned mesh renderer buffers after a simulation tick, and it should work, but I'm obviously missing something.

Code:
TryGetComponent<SkinnedMeshRenderer>(out var smr);
Mesh skinMesh = smr.sharedMesh;

using GraphicsBuffer skinPositionsBuffer = smr.GetVertexBuffer();
using GraphicsBuffer skinNormalsBuffer = smr.GetVertexBuffer();
using GraphicsBuffer skinTangentsBuffer = smr.GetVertexBuffer();

int[] skinPositionStrideOffset =
            {
                skinMesh.GetVertexBufferStride(positionStream),
                skinMesh.GetVertexAttributeOffset(VertexAttribute.Position),
            };
int[] skinNormalStrideOffset =
            {
                skinMesh.GetVertexBufferStride(normalStream),
                skinMesh.GetVertexAttributeOffset(VertexAttribute.Normal),
            };
int[] skinTangentStrideOffset =
            {
                skinMesh.GetVertexBufferStride(tangentStream),
                skinMesh.GetVertexAttributeOffset(VertexAttribute.Tangent),
            };


Thank you very much for your time!
Reply


Messages In This Thread
Acessing SkinnedMeshRenderer data - by Eritar - 02-02-2026, 02:37 PM