Load head shape and color on non-humanoid rig

I’ve been building a non humanoid character system, part of which is manually building the rig using inserted parts given by GetCharacterAppearanceInfoAsync(). An issue i ran into is loading the avatar’s dynamic head, when loading it in, the head shape is the default round head and is white regardless of mesh color:

avatar:

built version:

Now for the head shape i know its just applying the corresponding mesh id into the part, but the char info table does not return it, it only returns the ID of the orignal head, with the only indicator that it has a different head shape being in the ‘meta’ table under ‘headshape’, which doesnt return anything useful other than the name of the shape (i.e, manhead, cube). as far as i know the table has no info i can use to get the correct mesh.

As for the coloring, this can be fixed by adding a SurfaceAppearance in the head, and applying the mesh texture as the color map, which fixes it. the issue is that i cant do it during runtime, i tried CreateSurfaceApperanceAsync() which only accepts editableimages. I tried then converting the mesh texture into an editableimage, but since i dont own the asset, it blocks me. i also tried using decals and texture instances, but those do not use the UV map of the mesh, instead projecting from the specified face.

Is there any way to achieve this during runtime? im sure im not the only one who has attempted to replace the humanoid completely, but i cant really find a resource for it.

2 Likes

The ‘meta’ table names are just keys for you to map manually. You can’t dynamically generate SurfaceAppearances without owning the assets, so you’ll have to maintain a local lookup table that maps those headshape strings to the actual MeshIds and textures you need.

the issue is that each roblox head has their own set of headshapes. thats hundreds or even thousands. I dont know how to scrape them all

1 Like

You don’t need to scrape everything. Just map the specific shapes your system actually supports and ignore the rest. If you try to account for every single asset Roblox has ever made, you’ll just end up with an overengineered mess.