long_gone Posted January 18, 2022 Share Posted January 18, 2022 Hello everyone, I'm hopping to find such "body part" vertex shader just like one from @Ren_712(https://forum.multitheftauto.com/topic/105160-custom-ped-morphing-18/?do=findComment&comment=907439) Or if someone could - explain how to implement something like that(I have superficial knowledge how shaders work) @Ren_712 Link to comment
The_GTA Posted January 18, 2022 Share Posted January 18, 2022 (edited) 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 January 18, 2022 by The_GTA 1 Link to comment
long_gone Posted January 18, 2022 Author Share Posted January 18, 2022 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
MTA Anti-Cheat Team Dutchman101 Posted January 18, 2022 MTA Anti-Cheat Team Share Posted January 18, 2022 I just uploaded a ped morphing resource that makes all players fat, you can check it out as example @long_gone https://community.multitheftauto.com/?p=resources&s=details&id=18647 2 Link to comment
long_gone Posted January 18, 2022 Author Share Posted January 18, 2022 1 hour ago, Dutchman101 said: I just uploaded a ped morphing resource that makes all players fat, you can check it out as example @long_gone https://community.multitheftauto.com/?p=resources&s=details&id=18647 Good example ty, but how can I actually perform shader on some particular body part? Link to comment
The_GTA Posted January 18, 2022 Share Posted January 18, 2022 (edited) 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 January 18, 2022 by The_GTA 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now