How to add custom per vertex data to a mesh load from obj

Godot Version




I think what i want to do is quite easy, but i’m still stuck…
I want (with gdscript) to load a mesh in my scene (actually an obj, but i Can change this to gltf if it’s help) and add per vertex data (xyz velocity) load from a txt file.
My data (obj and txt) have been generated with paraview, so vertex information are in the same order in both files.
I easily make the fonction to read my txt file and i have been able to load my obj and add it to my 3dmeshinstance.
But i cannot find the way to add an array_custom to my mesh to use per vertex data intro my shader.

Actually i have a plane.mesh = imported_obj and customvel in PackedFloat32Array() with all the values already filled

Thanks for any help/leads

The first custom array in ArrayMesh is index 6 as you can see in the enums:

I don’t think you can’t just import it directly. You’ll have to use ArrayMesh to build a new mesh after it’s imported, then save that to use it instead of the imported resource.

1 Like

Godot says it has OBJ direct support, and that it can be loaded through MeshInstance3D. Although I have not used it yet. I was able to drag my obj file into my resources and it appeared as a mesh

Thanks you,

I just copy my surface array then clean it, update custom0 and regenarate the surface.

I doesn’t need to do it very often, it’s only to visualize CFD results, so the user Can wait few seconds before screen update.

Pehaps i Can only update custom0, but i doesn’t find how to do this

Sorry thé auto corrector IS activated in an other language