Supported Model Formats — Panda3D Manual (2024)

Panda3D contains an extensible plug-in system for loading model files. Theseplug-ins enable Panda3D to load models in a variety of formats, withoutrequiring an explicit conversion step. This page lists the formats and plug-insavailable for loading models into Panda3D.

BAM Format

The most powerful file format that Panda3D supports is BAM. This is a directbinary representation of the internal object structure of Panda3D. As such itsupports almost all of the objects you can create in Panda3D, and any model canbe converted to BAM without loss of information. You can also save any scenegraph structure in Panda3D back to a BAM file using thewriteBamFile() call.

But because BAM files are a reflection of the internal memory structure ofPanda3D, it’s theoretically possible for a BAM file created using one versionof Panda3D to no longer work in a future version of Panda3D. Therefore, if youchoose to work directly with BAM files, you should make sure to always preservethe source assets and information about the pipeline so that you can reconvertthe model as needed.

Because it is such an efficient format, it is very well-suited for shippingwith a copy of a game for end-users. This allows the finished game to loadmodels very quickly, and the plug-ins for loading models can be excluded.This format is very well-suited for shipping with a copy of a game forend-users, with the further advantage that the additional plug-ins do not needto be included with the installed game. The distribution tools thereforeautomatically convert files to the BAM format.

With a few exceptions, most tools and plug-ins do not directly export to theBAM format. To create a BAM file manually, you can use a tool likeegg2bam, or you can simply load or create themodel in Panda3D and use the writeBamFile() method.

Egg Format

The second-best-supported file format in Panda3D is the Egg format, a text-basedformat that is unique to Panda3D. There are many tools available to manipulateEgg files, and you can even open an Egg file in a text editor to see what itcontains. See the Egg Files section for more detailed information aboutthis format.

An Egg file can contain static geometry, but it can also contain informationfor animating the model, as well as information about the model’s material, ie.what color the material has, and how this color changes under the influence oflighting). However, unlike BAM, it cannot represent all of the things that arepossible in Panda3D. For instance, light sources are not represented.

Panda3D provides various tools forconverting models to the Egg format.Furthermore, there are exporter plug-ins for various modelling packages thatare able to produce Egg files.

The plug-in for loading .egg files is provided with Panda3D out of the box.Panda3D also provides an API for manipulating Egg files programmatically.The EggData class is the main entry point of this API.

glTF Plug-In

An increasingly commonly used format for 3D assets is theglTF format. This is a standard format that is very widelysupported by many modelling suites. There are also many models available on theinternet in this format.

The best way to load these files is via the third-partypanda3d-gltf plug-in.This plug-in is not included with Panda3D by default, but needs to be installedseparately. The easiest way is to use the following pip command:

python -m pip install -U panda3d-gltf

If you do not install panda3d-gltf, Panda3D will load glTF files using theAssimp plug-in, which also supports glTF files. However, panda3d-gltf issignificantly more mature and featureful than the Assimp loader, so it isstrongly recommended that you use panda3d-gltf instead.

For more information on the glTF format and importing glTF files into Panda3D,see glTF Files.

Assimp Plug-In

Panda3D also provides a plug-in out of the box that integrates with the Assimplibrary. This third-party library supports a broad range of different formats,such as .obj, .stl and .dxf, allowing them to be loaded into Panda3D without anexplicit conversion step.

The full list of supported formats is available on this page:

https://assimp-docs.readthedocs.io/en/latest/about/introduction.html

The quality of support varies substantially from format to format, and it ispreferred to use a more specific plug-in if one is available for that format.For example, Assimp includes support for .gltf files, but the panda3d-gltfplug-in (mentioned above) is considered to be higher-quality.

Please note that while skeletal animations are supported, morph targets (alsoknown as shape keys) are not currently supported by the Assimp plug-in, even ifthey are supported by the underlying format.

Caution

Models loaded with the Assimp plug-in may appear rotated around the X axis,due to the fact that Assimp uses a Y-up coordinate system whereas Panda3Duses a Z-up coordinate system. A future version of Panda3D will correct thisautomatically, but for now, you will need to manually rotate your models:

model.setP(90)

The following Config.prc settings can be used to control the behavior of theAssimp loader. Note that you will need to clear the model cache after changingone of these variables for these changes to take effect.

Variable name

Default

Description

notify-level-assimp

warning

Sets the verbosity of debug messages (spam, debug, info, warning, error)

assimp-calc-tangent-space

false

Calculates tangent and binormal vectors, useful for normal mapping.

assimp-join-identical-vertices

true

Merges duplicate vertices. Set this to false if you want each vertex toonly be in use on one triangle.

assimp-improve-cache-locality

true

Improves rendering performance of the loaded meshes by reorderingtriangles for better vertex cache locality. Set this to false if youneed geometry to be loaded in the exact order that it was specified inthe file, or to improve load performance.

assimp-remove-redundant-materials

true

Removes redundant/unreferenced materials from assets.

assimp-fix-infacing-normals

false

Determines which normal vectors are facing inward and inverts them sothat they are facing outward.

assimp-optimize-meshes

true

Reduces the number of draw calls by unifying geometry with the samematerials. Especially effective in conjunction with assimp-optimize-graphand assimp-remove-redundant-materials.

assimp-optimize-graph

false

Optimizes the scene geometry by flattening the scene hierarchy. This isvery efficient (combined with assimp-optimize-meshes), but it may resultthe hierarchy to become lost, so it is disabled by default.

assimp-flip-winding-order

false

Set this true to flip the winding order of all loaded geometry.

assimp-gen-normals

false

Set this true to generate normals (if absent from file) on import.

assimp-smooth-normal-angle

0.0

Set this to anything other than 0.0 in degrees (so 180.0 is PI) tospecify the maximum angle that may be between two face normals at thesame vertex position that are smoothed together. Sometimes referred toas ‘crease angle’. Only has effect if assimp-gen-normals is set to trueand the file does not contain normals. Note that you may need to clearthe model-cache after changing this.

assimp-collapse-dummy-root-node

false

If set to true, collapses the root node that Assimp creates, if itappears to be a synthetic dummy root node and contains no meshes. Thisvariable is new as of Panda3D 1.10.13 and will become true by default asof Panda3D 1.11.0.

Other Formats

Other file formats need to be converted first to a supported format. Panda3Dprovides various utilities that can be used toconvert models to the Egg format.

For several formats for which Panda3D ships with a to-egg conversion tool,Panda3D can automatically do the step of converting the model to .egg on load.For example, Panda3D ships with a flt2egg converter, which can convertOpenFlight models to the Egg format. If you try to load a .flt file, Panda3Dwill implicitly invoke flt2egg behind the scenes. The plug-in responsible forthis is called p3ptloader.

The formats supported by this plug-in are OpenFlight (.flt), LightWave (.lwo),AutoCAD (.dxf), VRML (.wrl), Direct X (.x), and Wavefront OBJ (.obj).However, note that some of these formats can be loaded by the Assimp loader, inwhich case this plug-in is only used if the Assimp plug-in is not available.Also note that the obj2egg converter is extremely limited and does not supportmaterials or textures, so it is not recommended to load .obj files via thisroute.

Supported Feature Table

This table lists the most commonly used supported file formats and the featuresthat are supported by these formats and their respective importers:

.bam

.egg

.gltf

.obj

.dae

.x

Node hierarchy

✔️

✔️

✔️

✔️

✔️

✔️

Custom object tags

✔️

✔️

✔️

Geometry

Triangle meshes

✔️

✔️

✔️

✔️

✔️

✔️

Higher-order polygons

✔️

✔️

✔️

✔️

Lines and segments

✔️

✔️

✔️

✔️

✔️

Vertex colors

✔️

✔️

✔️

✔️

✔️

✔️

Materials and Textures

Basic materials

✔️

✔️

✔️

✔️

✔️

✔️

Basic textures

✔️

✔️

✔️

✔️

✔️

✔️

Texture blending

✔️

✔️

Gloss maps

✔️

✔️

✔️

Normal maps

✔️

✔️

✔️

✔️

Height/parallax maps

✔️

✔️

✔️

Emission maps

✔️

✔️

✔️

✔️

✔️

Roughness/metal maps

✔️

✔️

✔️

Texcoord transforms

✔️

✔️

✔️

Animation

Object animations

Skeletal animations

✔️

✔️

✔️

✔️

✔️

Morph targets

✔️

✔️

✔️

Split animation files

✔️

✔️

Other

Collision shapes

✔️

✔️

Light sources

✔️

✔️

✔️

Level of detail (LOD)

✔️

✔️

External references

✔️

NURBS curves

✔️

Shaders

Supported Model Formats — Panda3D Manual (2024)
Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 6804

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.