Vertex Shader help

Okay, so currently i have 3 attributes being used by the vertex shader. Position, Normal and texture cords. Recently i’ve added a Rig object to each rawmodel object. If i have these attributes,

List<Matrix4f> boneMatrixs;
ArrayList<ArrayList<Integer>> boneChains;
private float vertexWeights[];
private int vertexBoneCount[];
private float BoneVertexAttatch[][][];

How would i go about adding these attributes to effect each vertex? Thanks in advance!

Vertex Shader:

in vec3 position;
in vec2 textureCoords;
in vec3 normal;

out vec2 pass_textureCoords;
out vec3 surfaceNormal;
out vec3 toLightVector;
out vec3 toCameraVector;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform vec3 lightPosition;

void main(void){

vec4 worldPosition = (transformationMatrix * vec4(position,1.0));
gl_Position = projectionMatrix * viewMatrix * worldPosition; 
pass_textureCoords = textureCoords;
surfaceNormal = (transformationMatrix * vec4(normal,0.0)).xyz;
toLightVector = lightPosition - worldPosition.xyz;
toCameraVector = (inverse(viewMatrix) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz;

}

Loader:

in vec3 position;
in vec2 textureCoords;
in vec3 normal;

out vec2 pass_textureCoords;
out vec3 surfaceNormal;
out vec3 toLightVector;
out vec3 toCameraVector;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform vec3 lightPosition;

void main(void){

vec4 worldPosition = (transformationMatrix * vec4(position,1.0));
gl_Position = projectionMatrix * viewMatrix * worldPosition; 
pass_textureCoords = textureCoords;
surfaceNormal = (transformationMatrix * vec4(normal,0.0)).xyz;
toLightVector = lightPosition - worldPosition.xyz;
toCameraVector = (inverse(viewMatrix) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz;

}

Please ask if more information is needed.

I answered your identical post in the beginners forum

Please don’t cross-post.

1- bondeindex and bonweight are attributes in other world max bone each vertex will be 4
each vertex most has 0-4 bone effect on it

2- to do it in vertex shader

in vec3 position;
in vec2 textureCoords;
in vec3 normal;
in vec4 BoneIndex;
in vec4 Weights;
uniform mat4 bones[10];

void main()
{
vec4 newvertex;
vev3 newNormal;
new newvertex += bones[int(BoneIndex.x)]gl_VertexWeights.x;
new newNormal+= mat3(bones[int(BoneIndex.x)])gl_NormalWeights.x;

 new newvertex += bones[int(BoneIndex.y)]*gl_Vertex*Weights.y;
 new newNormal+= mat3(bones[int(BoneIndex.y)])*gl_Normal*Weights.y;

 new newvertex += bones[int(BoneIndex.z)]*gl_Vertex*Weights.z;
 new newNormal+= mat3(bones[int(BoneIndex.z)])*gl_Normal*Weights.z;

 new newvertex += bones[int(BoneIndex.w)]*gl_Vertex*Weights.w;
 new newNormal+= mat3(bones[int(BoneIndex.w)])*gl_Normal*Weights.w;

gl_Position = Projection*View*Transform*newvertex ;
newNormal = mat4(Transform)*newNormal ;

}