How to achieve joint-like drawing performance? How are they drawn so fast?

How to achieve joint-like drawing performance? How are they drawn so fast?

chirieacam
Enthusiast Enthusiast
436 Views
2 Replies
Message 1 of 3

How to achieve joint-like drawing performance? How are they drawn so fast?

chirieacam
Enthusiast
Enthusiast

Hi,

 

Anybody knows how are the joints drawn so fast?

 

I've been using MPxDrawOverride::addUIDrawables to draw x-ray links between my custom nodes, but the performance is kinda bad when playing an animation with multiple nodes.

 

I've been looking at MPxGeometryOverride (reading that it may perform better) but couldn't figure it out how to draw the links on top of everything (x-ray).

 

Anybody have any tips?

 

Thanks, have a nice day!

0 Likes
437 Views
2 Replies
Replies (2)
Message 2 of 3

zewt
Collaborator
Collaborator

I don't think it's possible to render things quite as fast as the built-in locators and joints, but the biggest thing is to make sure you're passing false to the isAlwaysDirty parameter of MPxDrawOverride.  That lets it avoid re-preparing the draw even if the transform changes.  (I'm not sure why they made that a parameter on the ctor instead of just a setter or an override like everything else in the API...)

 

Message 3 of 3

chirieacam
Enthusiast
Enthusiast
Thanks for your thoughts, zewt. Unfortunately I'm already passing false for isAlwaysDirty.

As you said, I guess the built-in nodes like joints might be drawn in an optimized way that we do not have access to.

0 Likes