Animation question: how animate the construction of an model

Hi folks,

I want the following effect:

I have a modell (say a 3D box) - and I want that the box is assembled in an animation where the various sides from the box are coming from various directions.

Basicly I already can do this. I could make flat squares out of polygons for each side of the box and lerp them to the final positions, done. I assume that one can do this with the animation/actor stuff (which I haven’t tried out).

The “problem” is that the box is finally a group of seperate nodePaths/geomNodes - and if I want to have e.g. lines drawn on the edges I fight currently with visual disturbances (probably something you would call “z-fighting”).

My wish would be to have one nodePath object after the animation has been shown.

Any good pointers/ideas? I currently think about modifying the geoms/polygon positions of the modell - but I don’t know if this is a road into trouble :wink:

Are there options to “merge” 2 (or more) modells into one model?

Kind regards,

Sure, you can merge them. Get all six models parented under a common node, and then do:


However, this won’t have anything to do with Z-fighting. You experience shimmering effects, “Z-fighting”, whenever you have multiple different polygons overlaying the same space, whether those are part of one object or multiple different objects.

There are tricks to eliminate Z-fighting, all of which have some problems, and some of which are easier than others; and the best solution is different for different cases. You mention line segments–are you scribing line segments on your cube faces?


Hi David,

thanks for the pointer. I’ll try out.

I have a quite simple problem. One of my animation requirements is to build up a 3d bar graph. As background I would like to have 3d’d walls and the corresponding floor as bottom. The 3d bars need to have lines on the edges to be visible (at least in some color variations), as well as I need some lines on the walls and the floor to show the units/scaling. As simple as Excel or other 3d business graphic package do (at least for the start).

If I make 3 seperate nodes (surfaces) for the 2 walls and the floor and draw line segments around the squares I get display problems/z-fighting. The line segments and the surfaces are overlapping each other at the X-, Y- and Z-axis where the walls and the floor are connecting. I tried to move the line segments a bit in the foreground but without satisfying results.

I think I can solve this with making one modell which consists already out of the walls, the floor and the line segments. But then I can not make any fancy “buildup” animation where the floor and the wall are “flying” together.


I am very very new to Panda3D, however I have a lot of experience with 3D art. In that context if I had to do what you’re describing and z-fighting was a problem after the animation ended I would simply swap objects.

What I mean is that you might try loading two models, one visible to start that gets the animation applied to it and then a second solid cube that takes no animation but that is formed solidly as a single object (sharing verts between the faces). The second cube would be invisible until the animation was complete, then it would become visible and the animated cube would become invisible.

If you swaped it properly the user probably would never notice. Hopefully I understood your problem, if not feel free to ignore this post :wink:

This is a good suggestion, but still, even if your cube and the line segments are in one node, you will experience Z-fighting. Z-fighting has nothing to do with rendering multiple different objects; a single object can Z-fight with itself just as easily as with another object.

One approach is to bias the wireframe toward the camera a bit. Panda can do this for you with a call like this:


This, unfortunately, doesn’t necessarily work on all graphics cards and all drivers. You might try each of OpenGL, DirectX8, and DirectX9; if it doesn’t work in one mode, it might still work in another.

If that doesn’t work, you can use Panda’s built-in decalling mechanism, which will work reliably on all graphics cards, but is a bit of a nuisance to use. Let me know if the DepthOffsetAttrib trick doesn’t work for you, and I’ll explain how to use the DecalEffect properly.