[Animation] Getting the data required for rendering from your classes

[Animation] Getting the data required for rendering from your classes

As the title says I have been struggling to get the data required to render the complete animated mesh in it's current state. I did find the vertex buffers, but the index buffers are different in the class structure to those of the vertex buffers so it was confusing... Maybe not enough documentation on this but anyways what should my approach be to getting the raw data out of the animated model so I can render it?

p.s after googling, I've found this quote by havok.yoav from back in 2009 : "the normal solution is to save out the renderable mesh seperately to a format used by the in game graphics engine"
a few things about this:
1. I need to get the raw data vertex info, indices, mats, no documentation or demo about this one...
2. If he means a separate file (because he said format), then what is the point of Havok Animation if I can't get the vertex data of the model's current state.

Thank you in advance ;]

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi, I've very recently been experiencing the exact same issue. I can serializeLoad some assets but I'm really struggling to get my hands on the vertices, indices and normals. After loads of googling, reading(even on the very sparse Havok Documentation) and research I can see that I can access the Vertices by grabbing them through the hkMesh objects etc. However I'm not entirely sure how to go about it yet. How did you get your hands on the Vertices exactly, if you don't mind me asking?I was recently given the same information regarding your point (2) above. I totally concur as I'm not sure I see the point if I have to export and load in 2 seperate files?!What we really need is a CURRENT standalone example from one of the ace Havok engineers which details how to 1.) load some assets from a 3rd party animation tool;2.) expose the loaded resource in order to grab the vertices and other primitive specific data3.) prime that data so that it is ready to be consumed by a rendering platform API like DirectX or OpenGL.

Thank you very much for the reply, I'm glad to know that I'm not the only one having this struggle.

The overall class containing the entire animated model is hkaAnimationContainer. Have this link I found explaining the entire hierarchy: http://www.cardkingdomgame.com/2011/09/19/havok-animation-integration

Also, before I get the raw data on plate, I have a problem:
hkLoader* m_loader = new hkLoader();
Actually gives me an exception. Also there's a side issue, visual studio crashes with this exception and I can't see the call stack.

havok_joe's picture

Hi aesthegod:
hkLoader* m_loader = new hkLoader(); Actually gives me an exception.
can you make a fulldebug version to see if there is any output or call stack? Also, maybe you can copy your code into 
to see if it works or not.

By the way, thanks for finding the link which is quite useful.
And if you can access the code in
which should be accessable for the free download version, and step through some simple demo like
The mesh convert code is inenv->m_sceneConverter->convert( scene );

It shows how the internal renderer convert the mesh and material data, and will be helpful for you to make your own converter.

Joe Developer Support Engineer Havok www.havok.com

Oh wow you're awesome man thanks! ;D

About the m_loader I will try that as soon as I get back home. The crash is unaccissble memory 0x00000000c somewhere inside the SDK. I guess I have to do some more SDK configuring pre-compiler-wise.

havok_joe's picture

Hi aresthegod:For the animation mesh data related question, please refer tohttp://redfort-software.intel.com/en-us/forums/showthread.php?t=107222But I will still follow the khLoader problem here.Cheers

Joe Developer Support Engineer Havok www.havok.com

Hi Aresthegod,I see you also found the CardKingdomGame blog. Really useful information there regarding his struggles integrating the Havok engine! In particular his heirarchy graph relating to the AnimationContainer structure was invaluable. I just cannot for the life of me find ANY damned code relating to its use/implementation on the net (and trust me I have looked...).I've even actually emailed that guy a few days ago to see if he can send me some example code or point me in the right direction.
So at the moment I'm slowly trudging through each stage making small gains. But still - this is way more complicated and involved that I ever expected. The thing is - I can see these tools and modules will be super useful and are extremely powerful. I don't want to give up on intergrating them but at the same time I'm not sure I can waste any more time messing about with the interface and limited info/docs etc.I had a similar error with the loader so I swapped to hkSerializeUtil::load with the error reporting and don't have that issue anymore.A big issue I had to figure out on my own was to get my include load order correct, as well as finding out how to split the includes/defines/excludes between the header(.h) and implementation(.cpp) files. Mainly because there was nothing about this in the docs.If you drop me your email I'll send over my HavokManager classes and we can compare notes if you'd like. Might help you to make some headway etc.

Well, I'm going to have to track memory of my code and find the structure of the data.

Sure we can do that no problem you can find me gabriel_m20032003@yahoo.com but I don't have a manager class, hopefully that's not discrediting me or anything because I know my skill, I'm still prototyping.

havok_joe's picture
Best Reply

Hi aresthegod:
For the problem you got to create the hkLoader instance, have you initialize the havok memory system before you are trying to new the hkLoader ?
Something like

hkMallocAllocator baseMalloc;
// Need to have memory allocated for the solver. Allocate 1mb for it.
hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault( &baseMalloc, hkMemorySystem::FrameInfo(1024 * 1024) );
hkBaseSystem::init( memoryRouter, errorReport );
hkLoader* loader = new hkLoader();

hkLoader is mainly useful for demo code where it keeps a reference to all the resources it loads. And its memory is controled by havok system.


Joe Developer Support Engineer Havok www.havok.com

Login to leave a comment.