Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: BVH-to-Prim Importer Now Available!

Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-02-2005 03:02
First off, please post any questions to this thread. Thanks.

---

Don't ever say I never did anything for you. The following is the second step in what's rapidly becoming a very long undertaking of mine.

Here's a look at where this is headed:

Milestone 1: 3D Model Importer
Status: Completed!

Milestone 2: BVH-to-Prim Importer (this here)
Status: Completed!

Milestone 3: Prim Mirroring
Status: Completed!

Milestone 4: Prim.Blender
Status: Completed!


And here, folks, is your code!
_____________________
---
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-04-2005 23:21
Original Thread:
/15/da/37403/1.html ne

Known Issues:
1) Attempting to use certain angles in the file itself may cause some frames to act strangely. For example, taking the default Poser figure and flipping the legs around to form a digitigrade animation for a mech caused a few problems, so if you want to do that... I'd advise making the file with your own joints or a different figure.
2) Occasionally, joints will not name properly. This is caused by the Listener acting too quickly. If it becomes a persisten problem, I'll fix it directly... just needs an llSleep in one point of the Heirarchial Data Reader code.
_____________________
---
Jamie Bergman
SL's Largest Distributor
Join date: 17 Feb 2005
Posts: 1,752
03-13-2005 13:21
Jeffrey, you are amazing!
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
Your scripts are indeed Amazing.
04-23-2005 14:02
Although, Im not quite sure what the bvh-to-prim is about.
Does it animate a prim figure to act out the bvh animation file?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-24-2005 20:38
From: Nucleus Baron
Although, Im not quite sure what the bvh-to-prim is about.
Does it animate a prim figure to act out the bvh animation file?

Correct.
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
Rigging
04-25-2005 14:42
Very interesting indeed.
How do you rig the prim body to work with this script?
Found it, sorry. =) ( hierarchialdatacode )
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-25-2005 18:18
Hi. It creates a series of prims that the creator can then use for "rigging" their own objects, using the data housed in a BVH. =)

Basically, all you'll want to do is grab one of the parts once it's imported and link your own prims to it. After that,s done, you can pretty much take the entire thing with you to place anywhere you'd like - since all of the information will be stored with the script buffer.

As for getting the BVH there in the first place, I like to use Blender for splitting animations up into managable bites visually. You can then follow the instructions in the script itself to bring those files into the world.

Let me know how that works for you. There are a couple "problems" I've seen with poses that use extremes for movement, so if you experience any, tell me so I can try to fix them.
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
The breakdown.
04-28-2005 19:46
Do you have a screenshot i may look at?
Also, Is there a method where the user can load a full bvh file into a rigged prim character (say the torso) and assign the pieces to work with the script? breaking it down in blender seems confusing to me. Is it possible to achive this via 3dsmax wich is what i use?
The script seems interesting, yet confusing.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-28-2005 20:33
Nucleus, I've dropped a working example on you in-world. You should be able to run that by rezzing it and clicking the box once.

As for the method you described - it'll take custom BVH animation files from any program, but the method I described is how I go from Poser to in-world with the file. An interesting caveat is this actually already works as you've described - it's just more automated for quick rigging.

To do what you want, simply name, say, the "torso" the EXACT joint name as seen in the BVH file. Once you have done this, and you have placed the BVH file into the script as I've described in the included instructions, place the "Raw Data Reader" and "List Interpreter" into the object, followed by the "Heirarchial Data Reader." If you've named it properly, it should start up and soon contain the right information.

I apologize for it not being simpler. We scripters are limited in that we can only write code that utilize the existing LSL functions and limitations of Second Life. Hopefully it'll get better over time.
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
04-28-2005 20:53
From: Jeffrey Gomez
Nucleus, I've dropped a working example on you in-world. You should be able to run that by rezzing it and clicking the box once.

As for the method you described - it'll take custom BVH animation files from any program, but the method I described is how I go from Poser to in-world with the file. An interesting caveat is this actually already works as you've described - it's just more automated for quick rigging.

To do what you want, simply name, say, the "torso" the EXACT joint name as seen in the BVH file. Once you have done this, and you have placed the BVH file into the script as I've described in the included instructions, place the "Raw Data Reader" and "List Interpreter" into the object, followed by the "Heirarchial Data Reader." If you've named it properly, it should start up and soon contain the right information.

I apologize for it not being simpler. We scripters are limited in that we can only write code that utilize the existing LSL functions and limitations of Second Life. Hopefully it'll get better over time.



OMG!
This is amazing!!!

I can already visualize the many uses this can be put to!
Congrats. I hope you continue working on this. It looks quite promising.
It will take some reasearch in my part, but i think i may be able to do it.
Im gunna try something out with that file. I'll post a screenshot.
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
04-28-2005 21:32
So basically every animatable bodypart can be incorporated into this simulation?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-28-2005 21:43
Provided you can get it into the script and get it to compile... that's the catch.

That's why I split stuff up in Blender. :D

But yes. If it's in BVH form, and the file is small enough, chances are it'll run. If it doesn't, send me an IM and I'll try to fix it.
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
Bootleg Vectorman
04-29-2005 06:25
Hehehe... Bootleg Vectorman!

I manually changed the objects upon assembly. am I able to do that within the script so it comes out with varying sizes and shapes?

This would look hot for a Rock Giant that assembles itself out of a pile of rocks and then can have a follow script and walk animation added to begin to chase you. It can futher be enhanced with a "sweeping of the arms" animation and a push script on each hand to smack the player around as the player attempts to bring it down. (DarkLife... hint hint ;] )

Or a more interactive companion as Ive seen already in SL (a dummy avatar) exept this one will be able to walk around and do gestures, giving it more realism.
These are just a few that just popped in my head. There are soo many uses for this script its nuts.

Best of luck in it. you have hot script going!



PS: I wish this allowed me to post short clips. still images just dont cut it.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-29-2005 07:14
From: Nucleus Baron
I manually changed the objects upon assembly. am I able to do that within the script so it comes out with varying sizes and shapes?

Yes. Somewhere in there is a "size" vector, which allows you to scale the size of the resulting animation. I have it set pretty small... 0.3 or something - which is still twice the size of an avatar.

Anyway, you can toy with that, as well as various channels to run the scripts on... etc. Such is the fun of open-source. :D
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
Motion.
05-02-2005 16:43
So far Its been fun to experiment and quite educational. I have a few questions though.

We discussed overal shape. what about individual shape? say for example I wanted to construct an avatar and wanted each piece to rez the way I shaped it. would that be configurable within the script?

Also, Is or will the script be able to be mounted onto an animation overrider so as to be controlled by your avatars movement sort of like a telemetry device where a giant avatar can be controlled by the movements of the actual avatar inside? the latter is probably beyond the scope of your project but I thought it was worth mentioning.
It would be interesting to see how far this may go.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
05-02-2005 16:53
From: Nucleus Baron
We discussed overal shape... what about individual shape? say for example I wanted to construct an avatar and wanted each piece to rez the way I shaped them. would that be configurable within the script?

Since there are no "rez" events, all you'd need to do is take up the entire thing in one fell swoop... and it should rez just fine the next time.

From: Nucleus Baron
Also, Is the script able to be mounted onto an animation overrider so as to be able to contruct giant avatars that behaved like the actual avatar? the latter is probably beyond the scope of your project but I thought it was worth mentioning.

Unfortunately.. attachments don't work this way. Any attempts to get the position/offset of an actual avatar's limbs return the center of the avatar. I assume this is to keep lag down, but it can be frustrating.

Had it been possible to do it this way, I wouldn't have needed to build this monstrosity in the first place. :D

Anyway, your best bet is to use this as its own "animation overrider." Since you can still get the list of animations the avatar is performing, you can use that to "trigger" animations you've stored in the script itself. It wouldn't perform like the actual avatar... but it would allow you to trigger the right animations at will.

Clear as mud? :)
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
Its all in the legs.
05-02-2005 19:57
Semi-clear... Murky water clear. =)

So the pieces of animation can be triggered by a overrider? So if I attached the torso emmiter to my av's torso and include leg animation to the whole thing, would it suspend my av in the air to compensate for the scripted av's size or would I need to add an additional animation to do this?

*Assumes "The Thinker" Position.*
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
05-02-2005 20:02
To be honest, if that's all you want to do, try one of the giant mech scripts. They should be around here somewhere. ;)

And yes, you would need a separate animation unless you "sat" on the torso.
_____________________
---
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
05-02-2005 20:55
Not in the least.

I took notice on the script because it allowed you to animate prims as you would an avatar. I already have a Walker script for mechs and can pretty much achieve the same result using a bvh file. Now what your doing is completely different.
Id build a giant humanoid figure with it instead of a robot. building giant humaniods using bvh files or walker scripts allow motion of the legs but no bending at the knee.
Your script does a better job since full body motion can be attained.
Also because delegate characters can be created that can follow an av with natural motion instead of swapping alphas to simulate it.
Nucleus Baron
Nucleus Baron
Join date: 24 Dec 2004
Posts: 34
script trouble.
05-03-2005 07:54
I tried copying the animation info onto your script. but it gives me a syntax every time.
what am I doing wrong?