Panda3D crashes and throws error when loading a .fbx model
Description
when loading the .fbx model in panda3d using the Actor class ( since the model had animations ), it would give errors like :assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon? and Assertion failed: mismatched number of frames at line 242 of c:\buildslave\sdk-windows-amd64\build\panda\src\chan\animChannelMatrixXfmTable.cxx and ultimately close. Also, when converting the model to any other format like .glb or .gltf ( embedded and non-embedded both ), the model would loss all it's animations and it's texture. this has happened to me for more than a single a model, but i am only going to attach the current model.
Steps to Reproduce
from ursina import *
from direct.actor.Actor import Actor
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
ground = Entity(model='cube', scale=(100, 1, 100), position=(0, 0, 0), texture='white_cube', texture_scale=(100, 100), color=color.green, collider='box')
entity = Entity(collider='box', scale=1, position=(0, 1, 0))
#animations are stored within the file
actor = Actor("assets/FpsGlock.fbx")
actor.reparent_to(entity)
actor.ls() # list all the animations within the file
print(actor.getAnimNames()) # get a list of the animation names
def input(key):
if key == 'space':
actor.play("Armature|Shoot") # use .play() instead of loop() to play it once.
# camera.position = (0, 0, -5)
# camera.look_at(entity)
# EditorCamera()
FirstPersonController()
app.run()
( Taken from ursina's Animation Documentation )
Environment
- Operating system: windows 11 pro
- System architecture: x64 based intel i3 11th gen
- Panda3D version: 1.11.0.dev2480
- Installation method: pip
- Python version (if using Python): Python 3.8.10
- Compiler (if using C++): No compiler, using python only !
COMPLETE ERROR :
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes> & C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\Scripts\python.exe c:/Users/Shivam/Downloads/UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d/Echoes/src/game/try.py
info: Using primary monitor: Monitor(x=0, y=0, width=1366, height=768, width_mm=344, height_mm=193, name='\\\\.\\DISPLAY1', is_primary=True)
:prc(warning): Invalid integer value for ConfigVariable win-size: 614.4000244140625
:prc(warning): Invalid integer value for ConfigVariable win-size: 1092.800048828125
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
set window position: Vec2(137, 77)
:prc(warning): changing default value for ConfigVariable paste-emit-keystrokes from '1' to '0'.
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
package_folder: C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\lib\site-packages\ursina
asset_folder: c:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\src\game
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
:assimp(error): Failed to triangulate polygon (no ear found). Probably not a simple polygon?
Assertion failed: mismatched number of frames at line 242 of c:\buildslave\sdk-windows-amd64\build\panda\src\chan\animChannelMatrixXfmTable.cxx
Assertion failed: mismatched number of frames at line 242 of c:\buildslave\sdk-windows-amd64\build\panda\src\chan\animChannelMatrixXfmTable.cxx
............. ( same lines of error atleast 20 more times )
Assertion failed: mismatched number of frames at line 242 of c:\buildslave\sdk-windows-amd64\build\panda\src\chan\animChannelMatrixXfmTable.cxx
Traceback (most recent call last):
File "c:/Users/Shivam/Downloads/UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d/Echoes/src/game/try.py", line 11, in <module>
actor = Actor("assets/FpsGlock.fbx")
File "C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\lib\site-packages\direct\actor\Actor.py", line 292, in __init__
self.loadModel(models, copy = copy, okMissing = okMissing)
File "C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\lib\site-packages\direct\actor\Actor.py", line 1915, in loadModel
model = self.loader.loadSync(Filename(modelPath), loaderOptions)
AssertionError: mismatched number of frames at line 242 of c:\buildslave\sdk-windows-amd64\build\panda\src\chan\animChannelMatrixXfmTable.cxx
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes>
For the .fbx model, it wouldn't load and through an error !
for the .glb model, it would have missing animations and texture !
A new Bizzar discovery, while trying to recreate the same error again for the full error message using the same script and model, it didn't through any errors and worked !! ( though the result was glitched and missing it's textures )
here's the new log :
PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes> & C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\Scripts\Activate.ps1
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes> & C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\Scripts\python.exe c:/Users/Shivam/Downloads/UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d/Echoes/src/game/try.py
info: Using primary monitor: Monitor(x=0, y=0, width=1366, height=768, width_mm=344, height_mm=193, name='\\\\.\\DISPLAY1', is_primary=True)
:prc(warning): Invalid integer value for ConfigVariable win-size: 614.4000244140625
:prc(warning): Invalid integer value for ConfigVariable win-size: 1092.800048828125
Known pipe types:
wglGraphicsPipe
(3 aux display modules not yet loaded.)
set window position: Vec2(137, 77)
:prc(warning): changing default value for ConfigVariable paste-emit-keystrokes from '1' to '0'.
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
package_folder: C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\venv\lib\site-packages\ursina
asset_folder: c:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes\src\game
:pnmimage:png(warning): iCCP: known incorrect sRGB profile
PandaNode Cube.001
Character __Actor_modelRoot
GeomNode (1 geoms) S:(MaterialAttrib)
['Cube.001', 'Cube.001.1', 'Cube.001.2', 'Cube.001.3', 'Cube.001.4', 'Cube.001.5', 'Cube.001.6', 'Cube.001.7', 'Cube.001.8', 'Cube.001.9', 'Cube.001.10', 'Cube.001.11', 'Cube.001.12', 'Cube.001.13', 'Cube.001.14', 'Cube.001.15', 'Cube.001.16', 'Cube.001.17', 'Cube.001.18', 'Cube.001.19', 'Cube.001.20', 'Cube.001.21', 'Cube.001.22', 'Cube.001.23', 'Cube.001.24', 'Cube.001.25', 'Cube.001.26', 'Cube.001.27', 'Cube.001.28', 'Cube.001.29', 'Cube.001.30', 'Cube.001.31', 'Cube.001.32', 'Cube.001.33', 'Cube.001.34', 'Cube.001.35', 'Cube.001.36', 'Cube.001.37', 'Cube.001.38', 'Cube.001.39', 'Cube.001.40', 'Cube.001.41', 'Cube.001.42', 'Cube.001.43', 'Cube.001.44', 'Cube.001.45', 'Cube.001.46', 'Cube.001.47', 'Cube.001.48', 'Cube.001.49', 'Cube.001.50', 'Cube.001.51', 'Cube.001.52', 'Cube.001.53', 'Cube.001.54', 'Cube.001.55', 'Cube.001.56', 'Cube.001.57', 'Cube.001.58', 'Cube.001.59', 'Cube.001.60', 'Cube.001.61', 'Cube.001.62', 'Cube.001.63', 'Cube.001.64', 'Cube.001.65', 'Cube.001.66', 'Cube.001.67', 'Cube.001.68', 'Cube.001.69', 'Cube.001.70', 'Cube.001.71', 'Cube.001.72', 'Cube.001.73', 'Cube.001.74', 'Cube.001.75', 'Cube.001.76', 'Cube.001.77', 'Cube.001.78', 'Cube.001.79', 'Cube.001.80', 'Cube.001.81', 'Cube.001.82', 'Cube.001.83', 'Cube.001.84', 'Cube.001.85', 'Cube.001.86', 'Cube.001.87', 'Cube.001.88', 'Cube.001.89', 'Cube.001.90', 'Cube.001.91', 'Cube.001.92', 'Cube.001.93', 'Cube.001.94', 'Cube.001.95', 'Cube.001.96', 'Cube.001.97', 'Cube.001.98', 'Cube.001.99', 'Cube.001.100', 'Cube.001.101', 'Cube.001.102', 'Cube.001.103', 'Cube.001.104', 'Cube.001.105', 'Cube.001.106', 'Cube.001.107', 'Cube.001.108', 'Cube.001.109', 'Cube.001.110', 'Cube.001.111', 'Cube.001.112', 'Cube.001.113', 'Cube.001.114', 'Cube.001.115', 'Cube.001.116', 'Cube.001.117', 'Cube.001.118', 'Cube.001.119', 'Cube.001.120', 'Cube.001.121', 'Cube.001.122', 'Cube.001.123', 'Cube.001.124', 'Cube.001.125', 'Cube.001.126', 'Cube.001.127', 'Cube.001.128', 'Cube.001.129', 'Cube.001.130', 'Cube.001.131', 'Cube.001.132', 'Cube.001.133', 'Cube.001.134', 'Cube.006', 'Cube.006.1', 'Cube.006.2', 'Cube.006.3', 'Cube.006.4', 'Cube.006.5', 'Cube.006.6', 'Cube.006.7', 'Cube.006.8', 'Cube.006.9', 'Cube.006.10', 'Cube.006.11', 'Cube.006.12', 'Cube.006.13', 'Cube.006.14']
os: Windows
development mode: True
application successfully started
info: changed aspect ratio: 1.779 -> 1.779
:display:windisplay(warning): Could not find icon filename textures/ursina.ico
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes> python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> import panda3d; print(panda3d.__version__)
1.11.0.dev2480
>>> quit()
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes> python --version
Python 3.8.10
(venv) PS C:\Users\Shivam\Downloads\UrsinaForMobile-8d74a959172fbf02f522553fe9671684d005857d\Echoes>
I can fix the animation sampling problem, but the topology of the model is totally broken, in a way that Assimp can't convert properly. I can't really verify that my sampling changes are working before there is a model whose geometry converts properly in the first place.
@rdb what about this one ?
https://sketchfab.com/3d-models/glock-5a96c958a4ee4fbfba9b4c3aaadf3efb
or you can just try with any model you have then share it with me ? i will see what differences they have and try to fix the model myself ( since i am the one who needs it ) !