Has anyone ever done ragdolls with a soft skinning shader?

This topic is 3615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Has anyone ever done ragdolls with a soft skinning shader? I'm desperate, I'll take any information I can get, please help me! Anyone who has done this in any form please post source, I don't care what language you wrote the code in, I'll figure it out and I don't care what Physics API or Graphics API you used. I've been having a problem getting my ragdolls to work with my soft skinning shader, I've been working on it for 2 weeks with little to no success and it seems so simple yet I can't figure it out! I basically need to convert the world matrices that I get from the physics engine in to local matrices that would effect the vertices in the correct way. I've not just been working on this part time I've been working on it for 10 hours a day, every day and some times longer without a break! There is only so much I can take, help me please!!!

Share on other sites
int bone_parents[NUM_BONES] = {-1, 0, 0, 1 ..... };Matrix world_tms[NUM_BONES] = { /* from physics */ };Matrix local_tms[NUM_BONES] = {};for(int i=0;i<NUM_BONES;++i){  if(bone_parents==-1)  {    local_tms = world_tms;  }  else  {    Matrix parent_inverse = world_tms[ bone_parents ];    parent_inverse.Invert();    local_tms = world_tms * parent_inverse;  }}

Share on other sites
/**     * Updates the world transforms for this bone.     */    void updateWorldVectors(){        if (parent != null){            // worldRot = localRot * parentWorldRot            worldRot = parent.worldRot.mult(localRot);                        // worldPos = parentWorldPos + (parentWorldRot * localPos)            worldPos = parent.worldRot.mult(localPos);            worldPos.addLocal(parent.worldPos);        }else{            worldRot.set(localRot);            worldPos.set(localPos);        }    }

This computes the worldBindInverse transforms
/**     * Saves the current bone state as it's binding pose, including it's children.     */    void setBindingPose(){        initialPos.set(localPos);        initialRot.set(localRot);                // Save inverse derived position/scale/orientation, used for calculate offset transform later        worldBindInversePos.set(worldPos);        worldBindInversePos.negateLocal();                worldBindInverseRot.set(worldRot);        worldBindInverseRot.inverseLocal();                for (Bone b : children)            b.setBindingPose();    }

And this computes the matrix you should multiply your verticies by in the shader.
/**     * Stores the skinning transform in the specified Matrix4f.     * The skinning transform applies the animation of the bone to a vertex.     * @param m     */    void getOffsetTransform(Matrix4f m){        Quaternion rotate = worldRot.mult(worldBindInverseRot);        Vector3f translate = worldPos.add(rotate.mult(worldBindInversePos));                m.loadIdentity();        m.setTranslation(translate);        m.setRotationQuaternion(rotate);    }

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
A4L
12

• 11
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×