Billboards and Joint Animation in an Egg-File

I’m working on an animated model, and I want to include a billboarded quad in said model.

Now, normal animation works fine, I do believe. Similarly, the billboarding works as expected.

However, the two don’t seem to work well together: giving the billboard armature weights seems to destroy the billboarding. Which is not all that unexpected–after all, vertex animation could rather complicate billboarding, I daresay.

Now, in code I could simply reparent the billboard to an exposed joint.

But I want this model to be usable “out of the box”, with no code save for common setup (e.g. a call to “setShaderAuto”, etc.).

A little research turned up this thread, which indicates that it can be done–but only if one requires that a certain PRC-definition be set. While this might work, the model would once again not be functional “out of the box”.

So, is there another way forward? Is there another way that I might achieve my end, with no required code or PRC-settings…?

I don’t see why not just attach the animation to the billboard node.

I’m not sure that I follow.

If you mean that I should apply joint-weights to the billboard, such that it is moved by a joint, then doing so seems to cause the billboarding to no longer work.

If you mean that I should use the billboard as the root-node and have the animated model be a child of it… Hmm… I would expect that doing so would result in the whole model being billboarded, unless I also applied a compass-node or some such to it…

It would also rather complicate the animation of the model for people trying to use it, I would expect.

And for the future, EGG is not a good choice for asset storage.

Has there been talk of abandoning it? (I forget whether I’ve seen such discussion.)

I’ll confess that its feature-set has worked well for me thus far–see support for things like billboarding and texture-animation being baked into the model.

There are too many ambiguities in this format. And that’s enough to forget about him.

For example, what is a billboard in panda? And why it should suddenly become animated. It seems to me that these are incompatible concepts, just like an animated lookAt()

However, in EGG, this is possible.

I doubt that there’s any perfect file-format.

I could see a vertex-animated billboard working, although it would likely be awkward.

What I’m trying to do, however–a billboard that’s merely moved by a joint–seems perfectly sensible to me.

However, this is all somewhat besides the point. I will take into the back of my mind your advice about using another format–but doing so would require first researching whether said format included the features that I want from it, and whether Panda supported those features from it. (Including specifying billboards and texture-animations in the model-file.)

In general, Egg is not a format, but a markup language. Which allow you to simply set the properties of the nodes at boot.

from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor


class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        # Load the environment model.
        self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.scene.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)

        # Load and transform the panda actor.
        self.pandaActor = Actor("models/panda-model",
                                {"walk": "models/panda-walk4"})
        self.pandaActor.setScale(0.005, 0.005, 0.005)
        self.pandaActor.reparentTo(self.render)
        # Loop its animation.
        self.pandaActor.loop("walk")
        
        self.pandaActor.setBillboardAxis()

app = MyApp()
app.run()

I don’t think there’s any other way to do it right.

The thing is, as noted above, I’m looking for a way to do this without requiring specific code of end-user devs.

(And note that, as linked above, it can be somewhat done–but it requires the application of a PRC setting, which incurs the same problem.)

But if you’re saying that there is no such way, then fair enough. I’ll wait for others to weigh in, just in case, but I hear you.

Could you be more specific about what you’ve tried? Which specific egg syntax is not working for you?

Are you trying to place a billboard under a dart tag? If so, you may need to use <Dart> { structured }.

To explain, consider the following simple model: The outer object is just a box, normal geometry. The inner object is a billboarded quad. Specifically, the exporter, YABEE, has been modified to spot a game-property named “billboard” (after lower-casing), and to export the geometry like so:

  • Carrying a “billboard” tag
  • And excluding the world-matrix when collecting its vertices
    • Without this, the billboard ends up incorrectly positioned, it seems. See here for more.

This results in the billboard acting as expected:

However, if I then attempt to include the billboard in an animated actor, I encounter a problem:

  • If it’s not controlled by the actor’s armature, then it doesn’t move with the animations.
  • And if I do have it be controlled via vertex-animation controlled by the armature, it no longer functions as a billboard, and is misplaced.



If feasible, the solution that occurs to me is to have the billboard instead be parented under a node controlled by the armature. In code this can be done via “exposeJoint”–but is there a way to specify such a relationship in the egg-file…?

I’m not familiar with the “Dart” tag offhand, but looking at the egg-file for the test-model above, I do see such a tag under the armature’s group. It currently has the value “1”, but changing that value to be “structured” doesn’t seem to help.

I believe the egg loader implicitly makes exposed joints for geometry that is nested underneath a <Joint> without explicit vertex membership information.

I think otherwise it may be necessary to explicitly mark the billboarded group as having its own coordinate system using some .egg tag. I’m just guessing here, though, sorry.

Hmm… Messing about with a test egg-file doesn’t seem to have changed the behaviour observed. (Save for those cases in which I broke it sufficiently that the model didn’t load at all. :P)

That does sound like it could work…

That’s fair!

In fact, I’ve pretty much settled on dropping the billboarded element from the model. I had rather wanted to include it, as it provided a neat effect, but it’s not an important part of the model, I daresay.

So, let me call this closed for now, with my thanks to all who offered help!