Cannot animate some b3d models w/ minib3d

BlitzMax Forums/MiniB3D Module/Cannot animate some b3d models w/ minib3d

jtfrench(Posted 2011) [#1]
Hi,

I'm still getting used to the world of animation with minib3d. Having never used Blitz3D before, I'm not exactly sure how everything is supposed to work, but I've been figuring things out little by little.

So far I've been able to load static .b3d models and their textures fine. Animated models is another issue though. I went to Psionic's website and downloaded the ninja and dwarf models. Those animated just fine in the engine when I threw them in the "anim.bmx" example that comes with minib3d.

Getting excited that I could finally do animated meshes in minib3d, I went out and purchased two animated character packs:

1. 3DRT's Female Character models (.b3d format)

2. Dexsoft's Anime Female character models (.b3d)

Neither of them work ideally when imported into BlitzMax, but they each behave differently. Here's how:

1. 3DRT

The model loads in the "anim.bmx" example but refuses to animate. Absolutely zero movement occurs, despite the fact that apparently the model is chock full of animations (also, this one causes things to load slowly . I'm not sure if its due to its poly count ~2800 or sthg else)

2. Drexsoft

This model loads in the "anim.bmx" example, looks good, until you start animating. It does indeed animate, but it completely distorts the geometry of the model, morphing her into some kind of weird stretched out looking thing. Increasing the 'anim time' makes it more messed up, decreasing it brings it back to normal.

I really don't know what is going on. The dwarf and ninja loaded just fine into the anim.bmx example, and all of their animations played back normally. The models I actually dropped money on don't work, and I don't have the 3D chops to pull it into Blender and inspect what's up (hence me buying pre-made models).

If anyone has any ideas about how to get these models working, I'd be greatly appreciative. I've included links to the .b3d files (but without the textures as my intention is not to freely distribute these commercial models---just to get some help on this animation glitch). If someone could try these out for themselves and see if it works for them, that would be really helpful. At this point I'm at a loss of what to do next. I'm not sure if its ExtractAnimSeq that I need to use, or SetAnimTime, or just plain ol' "animate".

Help?

Links:

1) http://www.cyluz.com/minib3d/female_anim.b3d
2) http://www.cyluz.com/minib3d/blondie1.b3d

a. Links to images of the distortion:




Thanks!

Last edited 2011


SLotman(Posted 2011) [#2]
I couldn't animate the "female_anim.b3d" - even using original blitz3D. So there is something wrong with that file. There is animation saved on it - but something seems to be very, very wrong.

The second one, did animate correctly on blitz3D... but on miniB3D indeed it gives problems. Maybe something to do with how they were animated. MiniB3D only supports skeletal animations - so if the author moved parts of the mesh 'by hand' it won't work on miniB3D.

Unfortunately, I have no idea how to fix that :(


jtfrench(Posted 2011) [#3]
Thanks, SLotman, good to know. I got to figure out some way to fix this!


jtfrench(Posted 2011) [#4]
One of the things that makes this most problematic is now I'm not sure how to approach collecting .b3d models. When first using MiniB3D, I was a bit bummed when I noticed that it had stripped down the amount of file imports that it supports, but this now makes it even more problematic because even within the space of .b3d models there are still problems.

Is there any way to detect/identify which .b3d files will be problematic and which will work? For example, I'm not sure what made the dwarf and ninja work, but the other models I bought just not.

Any help is appreciated, thanks.


ima747(Posted 2011) [#5]
Without being able to get your hands on the file I think the only way would be to ask the creator if they have verified it works in minib3d...

You may be able to fix some of the problems with some files by putting them through a texturing program with really solid b3d export support (anyone recommend one? I just do everything in blender so I don't recall the names of the various other programs that can work with b3d files...). This could in theory be as simple as load and re-save... this also might be possible for someone to do with blitz3d. If you can open it with blitz you should be able to re-save it as a b3d from blitz, which should then (in theory) be more compliant with minib3d... someone might be able to punch up a "fixer" program...

If it's possible to contact the file's creator's you could also ask them to export again for you as it could be just problems with older versions of exporter plugins they may have been using when creating the models. If they're really nice, or you have access to other formats of the same model under your purchase license you may be able to open the models yourself in blender or another program and export, again this might help though it will depend on the model, the format, and what is happening in the animation (as slotman mentioned, they may have done something to the model in it's animation process that isn't compatible with the b3d format, or the minib3d .b3d loader etc.)


josk(Posted 2011) [#6]
I loaded the female_anim model into Ultimate Unwrap (recommended tool) and then exported it as a single mesh, all works fine.

Cant get the other to work, if you ask on the general forum someone will know, I'm not up on 3D models but I think its a simple problem.

Actually it does work but the model loads in upside for some reason.

Last edited 2011

Last edited 2011


jtfrench(Posted 2011) [#7]
@ima747:

I was thinking that maybe that approach would work, especially since I have the model in many other formats, and am now able to install plug-ins in Blender. However, I think I either don't know Blender well enough, or perhaps how to use the Exporter well enough to successfully export something that animates in minib3d. I also use a Mac, so most of the commonly used tools are off limits for me. I imported the MilkeShape 3D version and exported it B3D. Not sure if I checked the right settings (see image below):


But what it exported still didn't animate in the sample anim.bmx program. You think this could be a code-level problem, or definitely a symptom of how it was exported?

@josk:

Did you playback female_anim through minib3d or Blitz3D? And when the other one didn't work for you, did you also see the same garbled geometry?

Thanks


jtfrench(Posted 2011) [#8]
(the version of the Blender B3D exporter that I have is is 2.04 and looks like:



Not sure what the latest is.


josk(Posted 2011) [#9]
Tried both in minib3d and Blitz3D and they both worked fine after exporting them with Ultimate Unwrap.

When i thought the other one wasn't working, it was because I had not exported it as a single mesh.


josk(Posted 2011) [#10]
blondie1!

female_anim!


ima747(Posted 2011) [#11]
I believe 2.07 is the latest exporter for blender. I have windows installed through bootcamp for testing as well as access to "emergency" tools like this when I can't find or make them natively. You can also run a lot of stuff through parallels without having to reboot, should work fine for ultimate unwrap (thanks for that josk, that was the one I was thinking of) though I can't confirm that as I haven't used it in a long time.


jtfrench(Posted 2011) [#12]
@josk:

Those models worked! That's awesome! So did you have to do much in Ultimate Unwrap to get it work? Is it that kind of thing where I could buy the app, and having never used it before, import & export the models I need?


@ima747:

Great, I'll need to track down 2.07. Does someone officially maintain/host this, or would I just have to do some scavenger hunting?

And yeah, virtualization on my mac would be convenient, we're also about to buy some PC machines for my studio esp. if that makes working with B3D easier.


jtfrench(Posted 2011) [#13]
I pulled this link which I found for Blender b3D exporter 2.07:

http://www.mediafire.com/file/jznizyn5mot/b3d_export.py

Which I got from here: http://www.blitzbasic.com/Community/posts.php?topic=90329#1036839

Haven't tried out yet though


SLotman(Posted 2011) [#14]
Notice that blondie1 is still messed up... her fingers looks like razor knives!


jtfrench(Posted 2011) [#15]
Yeah, I was noticing that razor knife stuff....


josk(Posted 2011) [#16]
So did you have to do much in Ultimate Unwrap to get it work? Is it that kind of thing where I could buy the app, and having never used it before, import & export the models I need?

Yeah it as simple as loading your model then saving it again from the menu.
Its what I mainly use it for as well as to check animations. Its a good solid model converter, though it does a lot more.


Kryzon(Posted 2011) [#17]
It does export bone animations, but it collapses the mesh hierarchy. You will only have a single mesh node after converting (so for things like levels you might want to use a different tool).


AdamRedwoods(Posted 2011) [#18]
Sorry to add to this, but I was playing around with bones and was curious as to what was wrong with the original model.

I went through and compared bones:


you'll see that bone 0 has a scale factor of 100 on the non-working version.

If you switch the "f=b.n_sx" with stuff like "f=b.n_px" (...same with f2) you'll see that some of the positional numbers are off by a factor of 100. (ignore floating point discrepancies)

SO THEREFORE, after a bit of fiddle around:

If you add this code to the anim.bmx example:
ScaleMesh ent,0.01,0.01,0.01
RotateEntity ent,180,0,0
scaleentity ent,10,10,10


it displays the mesh correctly.
Note: I'm scaling the MESH, not the entity. If you also rotated the MESH, it would distort the keys, so I rotated the entity instead.

Hope that does not complicate things even more.

Last edited 2011

Last edited 2011


jtfrench(Posted 2011) [#19]
Wow, this is really interesting and I need to now go try this out myself. Can you say more about the differences in scaling a mesh vs an entity?


jtfrench(Posted 2011) [#20]
I still don't completely understand why that scaling trick did it, but it certainly did the trick.


SLotman(Posted 2011) [#21]
The bones must have a weight sum of "1". the bones had an incorrect sum of 100 or more - so scaling it down by 100, the weight is scaled down too, and it works.

That's probably what Ultimate Unrap, and even Blitz3D does - corrects the bones weight.


jtfrench(Posted 2011) [#22]
Gotcha — so then I figure the Edward Scissor hands razor thing she has going on her hands must be a glitch in the exported model itself, not the animation?


Kryzon(Posted 2011) [#23]
I don't think the weight and scale are related. Changing one shouldn't affect the other.
As Adam pointed out, the scale influences the transformations, so that's probably the culprit.

Make sure the mesh itself doesn't have the pointy fingers to begin with, if the artist made them that way. It could also be that the fingertip bones are really small, making the fingers end like that.


SLotman(Posted 2011) [#24]
Make sure the mesh itself doesn't have the pointy fingers to begin with, if the artist made them that way.

On Blitz3D it doesn't, the mesh loads 100% correctly.

I don't think the weight and scale are related. Changing one shouldn't affect the other.

I didn't look (deeply) at the source, but since he is scaling the mesh, and the biped used to animate the model is included in the mesh it will be scaled also.

And in the source, you see the VertexDeform function, where the bone weight is used to calculate the final vertex position on each frame. So I do think it's related... but I couldn't fix it just changing the source :(

Last edited 2011


Ricky Smith(Posted 2011) [#25]

Is there any way to detect/identify which .b3d files will be problematic and which will work? For example, I'm not sure what made the dwarf and ninja work, but the other models I bought just not.




some problems are caused by scaling but most of these problems are caused when the initial rotations of the bones are not normalised and the exporter/importer does not cater for this correctly.Some importers/exporters also get themselves into a state becuase they try to convert between coordinate systems.
Sometimes importing and then exporting using Fragmotion and Ulitmate Unwrap3d can cure some of the problems you can also download PaceMaker (free) which has a function to normalise a skeleton and its animations plus a lot of other very useful functions for.b3d animated models - it's written in Blitz3d and .b3d is its native format.


AdamRedwoods(Posted 2011) [#26]
FYI-- the "edward scissor hands" distortion was caused by the bones weight total not equaling 1.0.

To fix this use:
TAnimation.NormaliseWeights(mesh)



Warner(Posted 2011) [#27]
It seems that the original 'blondie' model uses too many bones. The minib3d max is 4 bones pro surface. This model uses 8 bones.
The 'female_anim' model uses also too many bones. It uses up to 6 bones for some vertices.