Jump to content

ped morphing


long_gone

Recommended Posts

I am interested in the mathematics behind ped "skinning". I know that a ped skin is defined as a map, where vertices are keys and a set of bones with a weight-number are the values. From what I'd imagine the weight-number should be a value between 0..1, the sum of all the weight-numbers for a single vertex should equal 1. So is my assumption correct that the skinned position of each vertex is the sum of all relative-to-bone positions of each vertex multiplied with the corresponding vertex bone-weight? (weight = 0 for no weight of a bone)

We need to get this definition straight so that the mathematics can be correctly applied in the vertex shader!

Edited by The_GTA
  • Like 1
Link to comment
3 hours ago, The_GTA said:

I am interested in the mathematics behind ped "skinning". I know that a ped skin is defined as a map, where vertices are keys and a set of bones with a weight-number are the values. From what I'd imagine the weight-number should be a value between 0..1, the sum of all the weight-numbers for a single vertex should equal 1. So is my assumption correct that the skinned position of each vertex is the sum of all relative-to-bone positions of each vertex multiplied with the corresponding vertex bone-weight? (weight = 0 for no weight of a bone)

We need to get this definition straight so that the mathematics can be correctly applied in the vertex shader!

I don't really know how exactly define 'mathematics ' I want to perform, but 'aight , for instance , I want to 'expand' a pedestrian' neck. I'd appreciate any sample how to do that ❤️   

Link to comment
13 minutes ago, long_gone said:

Good example ty, but how can I actually perform shader on some particular body part?

You could try modifying the vertex diffuse colors of the ped model so that you embed a "morph weight" for each vertex into the alpha channel. This would require modification of the ped model file. I am not sure how RenderWare does treat those ped colors. Then you can read the alpha channel value in the morph vertex shader. If the alpha channel is zero, then no morphing is performed on the vertex. Otherwise you can scale the morphing by ( alpha * GLOBAL_MORPH_SCALE ) where alpha is color value inside of the shader ranging from 0 (no opacity) to 1 (full opacity).

Try setting the alpha channel values for body parts that you do not want to be morphed to zero. Then apply a non-zero alpha channel value to body part vertices that you do want morphed.

Inside of the shader pass 1 as real alpha value to the pixel shader. I don't think that peds use alpha values in vertex colors anyway.

Edited by The_GTA
  • Confused 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...