# Assimp skeletal animation and normal map in shader code

Ok so I know that Assimp upscales the vertices that are attached to bones by 100. So I made a scaling matrix of .01 as a uniform to the shader. The thing is would I apply this to the normal as well and how do I get it from the bones.

``````#version 430 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 uv;
layout (location = 3) in uint mesh;
layout (location = 4) in vec3 tangent;
layout (location = 5) in vec3 bitangent;
layout (location = 6) in ivec4 boneIds;
layout (location = 7) in vec4 weights;

out vec2 TexCoords;
flat out uint Mesh;
flat out uint darken;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform mat4 uscale;

const int MAX_BONES = 100;
const int MAX_BONE_INFLUENCE = 4;
uniform mat4 finalBonesMatrices[MAX_BONES];

void main(){
bool nhasDef = true;
vec4 totalPosition = vec4(0.0f);
vec3 totalNormal = vec3(0.0f);
for(int i = 0 ; i < MAX_BONE_INFLUENCE ; i++)
{
if(boneIds[i] == -1)
continue;
if(boneIds[i] >=MAX_BONES)
{
totalPosition = vec4(position,1.0f);
break;
}

vec4 localPosition = finalBonesMatrices[boneIds[i]] * vec4(position,1.0f);
totalPosition += localPosition * weights[i];
vec3 localNormal = mat3(finalBonesMatrices[boneIds[i]]) * normal;
totalNormal += localNormal // ??? is this right
nhasDef = false;
}
mat3 modelVector = transpose(inverse(mat3(model)));
vec3 T = normalize(modelVector * tangent);
vec3 B = normalize(modelVector * bitangent);
vec3 N = normalize(modelVector * totalNormal); // ??? is this right
TBN = mat3(T, B, N);
if (nhasDef) totalPosition = vec4(position,1.0f);
mat4 viewModel = view * model;
if (!nhasDef) viewModel = view * model * uscale;
gl_Position =  projection * viewModel * totalPosition;
TexCoords = uv;
Mesh = mesh;

}
``````