Jump to content

LoadModel Help


Clackdor
 Share

Recommended Posts

I am trying to replace my instances of LoadMesh() in my program with LoadModel() to take advantage of the automatic LOD properties of a model. However, when my character is declared as a Model, the animations no longer work. The model resorts to the T-pose. If the character is declared as a Mesh, then the animations work fine.

 

The Animate() documentation says this:

Important:This will only have an effect when used directly on a mesh or on an entity that has a mesh child entity (e.g. a Model).

 

It doesn't seem to be working out for me. I've tried various children of the model for animating and loading the animations.

Link to comment
Share on other sites

Hi Clackdor,

If you have a look at the animation loading in the skeleton lua script you have to load the animations in to each LOD level. I'll try to convert this to a C++ version as well so you can see how it works. I just load the animations in the lua script and they run fine when called from C++. When I upload the updated lua script I'll do a quick video to show the animation crontrol in C++.

Link to comment
Share on other sites

So, what you are saying is that I'm seeing an LOD model that doesn't have the animations loaded?

 

I would use a command like:

 

LoadAnimation(GetModelLODEntity(object.model,lod), "abstract::"..object.Animations[Anims].fileName ..".gmf" )

 

I'll have to see if that GetModelLODEntitiy command is valid in C++.

Link to comment
Share on other sites

OK, yeah, looks like I have two problems. I cannot figure out how to reference each of the LOD entities in C++. The animations are only Loaded on to the LOD3 model and not the base, LOD1, or LOD2 models. wacko.png

 

The other issue I am having is that the LOD3 models is standing on its head when I animate it.

 

Yes. You need to loop through each LOD and load in each animation. I haven't done this in C++ yet, I'll look at it this morning =). Are you wanting to write it all in C++ and leave lua out?

 

I am avoiding Lua. I'm operating on the assumption that everything that can be done in Lua can also be done in C++. Gaining knowledge in C++ is my primary motivation for starting this project. It helps me in my actual bread-winning life.

 

I'm also trying to stay consistent. My other animated model is done entirely in C++. The difference between her and the skeleton model is that I don't need to do the LoadAnimation() command. All of the animations are in a single sequence and already loaded in the base model. Once you release the UU3D files, I may combine all the animations so the skeleton does the same thing for me.

 

The other things I'm toying with in my head is to write my own LOD switching function that just uses the meshes. I just figure that the engine will do it "better".

Link to comment
Share on other sites

GetModelLODEntity() and CountModelLODEntities() will let you access all LOD versions of a model.

 

LOD entities get removed from the model hierarchy and are not children when they are not in use at a certain distance. This is because a simple rotation or repositioning of the root model requires all child matrices to be updated. If you have a character with 100 bones, and three LOD levels, that means ~300 matrices have to be updated each time anything moves!

 

In Leadwerks3D, hidden entities will simply not have their matrices updated at all, and LOD entities will still be children. This is a tradeoff because it means you can never count on a hidden entity to have correct matrix data.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

So, I'm down to figuring out why my first instance of loading the skeleton object doesn't have an axe. I can load up to N skeletons just fine, N-1 skeletons have an axe and 1 doesn't, always the first instance. IT'S THE SAME DAMN CODE!!!!

 

I'll figure it out some day.

Link to comment
Share on other sites

Same problem with Lua and loading... first skeleton no axe all others with axe. I've tried it with a whole set of armour and the same result first nothing then others equiped. Thing is it is also like this in the Editor. I'm not sure what it is as sometimes it is a different skeleton depending on which one you are close to when you load the level. It must be a bug!

Link to comment
Share on other sites

yes i can confirm this as well... its an odd little bug... huh.png first instance of any model won't show the attached item but subsequent models will...

 

interestingly enough though, it only seems to be a problem with models with LOD's. if no LOD's, then just attaching to the model instead of the GetModelLODEntity seems to work just fine with the first instance of the model...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Don't take this the wrong way, but I'm glad you are having problems, too. tongue.png

Ditto lol. I'm glad someone else has had this problem too. I though I was going mad.

 

if no LOD's, then just attaching to the model instead of the GetModelLODEntity seems to work just fine with the first instance of the model...

 

This is a major problem for me as my characters like the skeleton require multiple LODs and the ability to attach accessories/gubbins, as the first level is 8k triangles. Having LODs is essential if you want a massive army of the undead! My human characters should be around 5k ,but that still requires LODs to work well. Maybe for a hero character you can get away with a high poly model and no LODs so then it wouldn't matter. I really hope there is a work around or bug fix for this as it is a big worry.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...