Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actuallarspensjo

Posted 19 June 2012 - 11:52 PM

In OpenGL, I am doing as follows (support 3 bones per vertex):
uniform mat4 projectionMatrix;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 bonesMatrix[64];
in vec4 vertex;
in vec3 weights;
in vec3 joints;
void main(void){
  mat4 animationMatrix =
	weights[0] * bonesMatrix[int(joints[0])] + weights[1] * bonesMatrix[int(joints[1])] + weights[2] * bonesMatrix[int(joints[2])];
  gl_Position = projectionMatrix*viewMatrix*modelMatrix*animationMatrix*vertex;
}

Notice which ones are uniforms. These are updated every draw(), while the others are the same every time from a VBO.

bonesMatrix: Up to 64 joints can be used in a model. It is a uniform, as the same list of bones are used for all vertices.
vertex: This is a vertex from the mesh that is going to be animated by 0 to 3 bones.
joints: The index of three joints for the current vertex.
weights: The weights to be used for the three joints. There is one set of weights for each vertex.

#4larspensjo

Posted 19 June 2012 - 11:52 PM

In OpenGL, I am doing as follows (support 3 bones per vertex):
[source lang="cpp"]uniform mat4 projectionMatrix;uniform mat4 modelMatrix;uniform mat4 viewMatrix;uniform mat4 bonesMatrix[64];in vec4 vertex;in vec3 weights;in vec3 joints;void main(void){  mat4 animationMatrix =    weights[0] * bonesMatrix[int(joints[0])] + weights[1] * bonesMatrix[int(joints[1])] + weights[2] * bonesMatrix[int(joints[2])];  gl_Position = projectionMatrix*viewMatrix*modelMatrix*animationMatrix*vertex;}[/source]

Notice which ones are uniforms. These are updated every draw(), while the others are the same every time from a VBO.

bonesMatrix: Up to 64 joints can be used in a model. It is a uniform, as the same list of bones are used for all vertices.
vertex: This is a vertex from the mesh that is going to be animated by 0 to 3 bones.
joints: The index of three joints for the current vertex.
weights: The weights to be used for the three joints. There is one set of weights for each vertex.

#3larspensjo

Posted 19 June 2012 - 11:50 PM

In OpenGL, I am doing as follows (support 3 bones per vertex):
[source lang="cpp"]uniform mat4 projectionMatrix;uniform mat4 modelMatrix;uniform mat4 viewMatrix;uniform mat4 bonesMatrix[64];in vec4 vertex;in vec3 weights;in vec3 joints;void main(void){  mat4 animationMatrix = weights[0] * bonesMatrix[int(joints[0])] + weights[1] * bonesMatrix[int(joints[1])] + weights[2] * bonesMatrix[int(joints[2])];  gl_Position = projectionMatrix*viewMatrix*modelMatrix*animationMatrix*vertex;}[/source]
Notice which ones are uniforms. These are updated every draw(), while the others are the same every time from a VBO.

bonesMatrix: Up to 64 joints can be used in a model. It is a uniform, as the same list of bones are used for all vertices.
vertex: This is a vertex from the mesh that is going to be animated by 0 to 3 bones.
joints: The index of three joints for the current vertex.
weights: The weights to be used for the three joints. There is one set of weights for each vertex.

#2larspensjo

Posted 19 June 2012 - 11:49 PM

In OpenGL, I am doing as follows (support 3 bones per vertex):
uniform mat4 projectionMatrix;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 bonesMatrix[64];
in vec4 vertex;
in vec3 weights;
in vec3 joints;
void main(void){
  mat4 animationMatrix =
	weights[0] * bonesMatrix[int(joints[0])] + weights[1] * bonesMatrix[int(joints[1])] + weights[2] * bonesMatrix[int(joints[2])];
  gl_Position = projectionMatrix*viewMatrix*modelMatrix*animationMatrix*vertex;
}

Notice which ones are uniforms. These are updated every draw(), while the others are the same every time from a VBO.

bonesMatrix: Up to 64 joints can be used in a model. It is a uniform, as the same list of bones are used for all vertices.
vertex: This is a vertex from the mesh that is going to be animated by 0 to 3 bones.
joints: The index of three joints for the current vertex.
weights: The weights to be used for the three joints. There is one set of weights for each vertex.

#1larspensjo

Posted 19 June 2012 - 11:48 PM

In OpenGL, I am doing as follows (support 3 bones per vertex):

uniform mat4 projectionMatrix;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 bonesMatrix[64];
in vec4 vertex;
in vec3 weights;
in vec3 joints;
void main(void){
  mat4 animationMatrix =
    weights[0] * bonesMatrix[int(joints[0])] + weights[1] * bonesMatrix[int(joints[1])] + weights[2] * bonesMatrix[int(joints[2])];
  gl_Position = projectionMatrix*viewMatrix*modelMatrix*animationMatrix*vertex;
}
Notice which ones are uniforms. These are updated every draw(), while the others are the same every time from a VBO.

bonesMatrix: Up to 64 joints can be used in a model. It is a uniform, as the same list of bones are used for all vertices.
vertex: This is a vertex from the mesh that is going to be animated by 0 to 3 bones.
joints: The index of three joints for the current vertex.
weights: The weights to be used for the three joints. There is one set of weights for each vertex.

PARTNERS