University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

How to update a mesh when the simulation manager swings into action? | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How to update a mesh when the simulation manager swings into action?
November 11, 2015
5:12 am
Avatar
Member
Members
Forum Posts: 28
Member Since:
November 5, 2015
sp_UserOfflineSmall Offline

Hello Ari,

When the joints are updated, I need to update the skinned mesh correspondingly,

and I load the skinned mesh in a vertex buffer of Direct3D, so I am not using the OpenGL API for the time being.

I have 4 submeshes in my scene, one character.

They are the upperbody, lowerbody, shirt, and pants meshes.

I think I got the skeleton loaded along with the dae file, so do I need to attach a separate sk file?

Then it gets updated, In my thinking, I just get the positions and orientations of the bone after update

and reflect them into the actual meshes. Now my meshes are contained in 4 D3D vertex buffers, I think they are

continuous meshes. I think I need to cater for the skin weights etc. So after executing the BML and update the

simulation manager, how do I update the meshes in Direct3D, sorry keeping doing that (asking Direct3D questions)

Would you mind shedding some lights on this? I mean where should I start to look at tackling this problem?

Thanks

Jack

November 11, 2015
6:17 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

THe .sk file is a skeleton definition, while the .dae can include a skeleton as well as a mesh and skinning information. You don't need both.

 

There's a DeformableMesh->update() function that should be called at each time step to update the skinning information.

 

The code itself contains numerous examples of rendering with software as well as with the GPU via shaders although you might have to dig around a bit to find them.

 

Ari

November 13, 2015
11:23 am
Avatar
Member
Members
Forum Posts: 28
Member Since:
November 5, 2015
sp_UserOfflineSmall Offline

With the infJointName, do I absolutely have to fill that in, because in my model (yes, I am building a .X loader),

sometimes doesn't have a bone name. Will it affect the overall integrity of the library?

Secondly, what is the bindShapeMat used for?

Third question is how do I setup the position, orientation and scale of a submesh.

When I first test out SmartBody, I get the model correctly rendered by retrieving its position, orientation and scale.

But I don't explicitly set the position, orientation and scale in my .X loader.

Let me know

Thansk

Jack

[code]

class SkinWeight
{
public:
    std::vector<std::string>    infJointName;    // name array
    std::vector<SkJoint*>        infJoint;         // corresponding joint for each infJointName
    std::vector<float>            bindWeight;        // weight array
    std::vector<SrMat>            bindPoseMat;    // each joint, binding pose transformation matrix
    SrMat                        bindShapeMat;    // overall bind shape transformation matrix
    std::string                    sourceMesh;        // skin Source Name
    std::vector<unsigned int>    numInfJoints;    // number of influenced joints for every vertex
    std::vector<unsigned int>    weightIndex;    // looking up the weight according to this index
    std::vector<unsigned int>    jointNameIndex;    // looking up the joint name according to this index

[/code]

November 14, 2015
4:38 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

1) You don't need an influence joint for all vertices if you don't want them skinned, although that means that the vertex will stay in one place and will not be controlled by the bones.

2) The bind shape matrix is the binding pose of the skeleton where the skinning is calculated (say, a t-pose or a-pose of a skeleton)

3) You can't individually transform a submesh, only the entire mesh.

 

Ari

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online: mondayneedle1, andersen19eaton, kristensen00leblanc, worriedutopia9579, eric506784, t9rrzpi307
108 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 51

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 65

Members: 52460

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 427

Posts: 2343