Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

[ad_1]

For a while now I’ve been making an attempt to do skeleton animation utilizing Rust and OpenGL, I loaded the animation data appropriately, the bone ids and the affect weights, nonetheless I used to be unable to use the animation to the 100% right mannequin.

The screenshot under is the furthest I may get from making the animation look right, the issue is that if you happen to get shut… You’ll be able to see that between the transition from bone to bone, the joints with a higher deformation stop the lighting is ideal on the character’s pores and skin, making a slight doll-like sensation wherein the joints spotlight the skeleton:
enter image description here

This occurs as a result of the code I used within the shader is mainly this the place I solely use the primary transformation within the mannequin:

// Animation
vec4 tp = vec4(pos,1);
tp = CORRECAO[int(ossosid[0])]*tp;
tp = (ANIMACAO[int(ossosid[0])]*tp);
tp.xyz += ANIMACAO2[int(ossosid[0])];
// Neglect that half, that is simply because the animation is scaled to look on the display screen...
// It is not a part of the animation calculation.
pos = tp.xyz/50;

When I attempt to observe examples wherein I exploit affect weights… It is not working, extra particularly I can provide code examples and present the way it’s not working:

enter image description here

When I attempt to swap to calculation:

vec4 tp = vec4(pos,1);
tp = CORRECAO[int(ossosid[0])]*tp;
tp = (ANIMACAO[int(ossosid[0])]*tp)*pesos[0] + (ANIMACAO[int(ossosid[1])]*tp)*pesos[1];
tp.xyz += ANIMACAO2[int(ossosid[0])]*pesos[0] + ANIMACAO2[int(ossosid[1])]*pesos[1];
pos = tp.xyz/50;

Completely distorted when:

enter image description here

Utilizing:

vec4 tp = vec4(pos,1);
vec4 tp0 = CORRECAO[int(ossosid[0])]*tp;
tp0 = (ANIMACAO[int(ossosid[0])]*tp0)*pesos[0];
tp0.xyz += ANIMACAO2[int(ossosid[0])];
vec4 tp1 = CORRECAO[int(ossosid[1])]*tp;
tp1 = (ANIMACAO[int(ossosid[1])]*tp1)*pesos[1];
tp1.xyz += ANIMACAO2[int(ossosid[1])];
pos = tp0.xyz+tp1.xyz;
pos = pos.xyz/50;

One other:

enter image description here

vec4 tp = vec4(pos,1);
tp = (CORRECAO[int(ossosid[0])]*tp)*pesos[0];
tp = (ANIMACAO[int(ossosid[0])]*tp);
tp.xyz += ANIMACAO2[int(ossosid[0])]*pesos[0];
tp = (CORRECAO[int(ossosid[1])]*tp)*pesos[1];
tp = (ANIMACAO[int(ossosid[1])]*tp);
tp.xyz += ANIMACAO2[int(ossosid[1])]*pesos[1];
pos = tp.xyz/50;

Only one extra:

enter image description here

vec4 tp = vec4(pos,1);
tp = (CORRECAO[int(ossosid[0])]*tp);
tp = (ANIMACAO[int(ossosid[0])]*tp)*pesos[0]+(ANIMACAO[int(ossosid[1])]*tp)*pesos[1];
tp.xyz += ANIMACAO2[int(ossosid[0])];
pos = tp.xyz/50;

In different phrases… I can not make elbows, knees, shoulders, leg connections and hips as easy as I can do every little thing else… Particularly, know that: CORRECAO is the inverse bind matrix, ANIMACAO is the variable that rotates the purpose and ANIMACAO2 is the place of the purpose within the animation.

My query is how do I make the joints on the mannequin look easy? How do I apply this within the vertex shader?

P.S.: For all intents and functions, the animated mannequin is right here: hyperlink

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *