filament icon indicating copy to clipboard operation
filament copied to clipboard

Part of mesh is only visible

Open rohan-nara opened this issue 2 years ago • 8 comments

I am trying to view my 3d model in mobile using android studio filament library After exporting my .blend file to .glb in Blender The issue I faced was only certain parts of the mesh are visible , that is only the eyes and mouth of the character are visible in the modelviewer loadgltf , not the whole character mesh don't know why this happen.

this is the code snippet:

  private fun loadGlb(name: String) {
    Log.v("working","glb function called")
    val buffer = readAsset("models/${name}.glb")
    modelViewer.loadModelGlb(buffer)
    modelViewer.transformToUnitCube()

snippet by: https://medium.com/@philiprideout/getting-started-with-filament-on-android-d10b16f0ec67 png only this part of the character is visible

I have checked the face orientation of the 3d meshes and the normal maps.

The exported Gltf file (.gltf + .bin) from blender(Checked on 2.83 , 2.92 , 3.1) versions are not loading into the model viewer The exported Gllb file from blender(Checked on 2.83 , 2.92 , 3.1) versions are loading into the model viewer , but entire mesh is not visible, only part of the mesh is visible , and animation is playing . Also please let me know the exact glb , gltf format supported by filament.

arya-1.zip

This is embedded glTF model. it has no .bin file in it .

arya-1glb.zip

This is glb version of the same model

rohan-nara avatar Jul 14 '22 09:07 rohan-nara

Thanks, I'll take a look. We support both styles of glTF (gltf + bin and glb).

prideout avatar Jul 15 '22 16:07 prideout

Ah, this model has more than 709 bones, definitely higher than our limit of 256.

@pixelflinger this is the first time we've hit a skinning limitation on a well-formed model, sort of interesting.

prideout avatar Jul 15 '22 18:07 prideout

TO clarify, in this model only one joints attribute is used at a time (4 or fewer simultaneous joints, thus fitting into BONE_INDICES) but there are more than 256 joint targets.

@rohan-nara if you want to support models like this you will need to change CONFIG_MAX_BONE_COUNT, which will affect GPU memory footprint and your device minspec, since ES3.0 only guarantees 16 KiB and we store 64 bytes per bone.

Before doing with this, I would double check with your Blender artist that all these bones are truly necessary.

prideout avatar Jul 15 '22 18:07 prideout

I've confirmed that the model loads correctly after changing CONFIG_MAX_BONE_COUNT to 1024 and removing the static_assert that checks for sizeof(PerRenderableBoneUib) <= 16384

@pixelflinger I wonder if the above static_assert is really necessary? In general users should perhaps be able to adjust CONFIG_ params (within reason) without fear of hitting asserts.

prideout avatar Jul 15 '22 18:07 prideout

We need to keep the static assert, but we can make it dependent on CONFIG_MAX_BONE_COUNT. Also, there should be a runtime assert instead of partially rendering the mesh, probably. Or at least a log (once).

pixelflinger avatar Jul 15 '22 21:07 pixelflinger

@prideout and @pixelflinger Thank you for the responses . Can I get ,what code changes to be done, So That I could use them.

rohan-nara avatar Jul 16 '22 03:07 rohan-nara

@prideout and @pixelflinger can I know , where to find the CONFIG_MAX_BONE_COUNT . It would be helpful thanks

rohan-nara avatar Jul 20 '22 02:07 rohan-nara

@rohan-nara The CONFIG_MAX_BONE_COUNT is here. See our BUILDING.md instructions on how to build Filament.

bejado avatar Jul 20 '22 19:07 bejado

We now have an ASSERT_PRECONDITION in RenderableManager::Builder::Build, so Filament will throw rather than rendering a partial model. (see https://github.com/google/filament/pull/5868)

I'll change the static_asset as suggested by @pixelflinger before closing the bug, but @rohan-nara, just to be clear: you will need to build Filament yourself, as Ben mentioned.

prideout avatar Aug 15 '22 18:08 prideout