They also rotate with the camera as well.
Do I maybe have to make a new matrix for each instance to get them all to face the camera from their position, or I am doing something else wrong?
Here is the vertex shader code for the regular, non-billboard version:
Code: Select all
mat4 ModelView = viewMatrix*modelMatrix;
relativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0));
return relativeWorldPosition;
Code: Select all
mat4 ModelView = viewMatrix*modelMatrix;
ModelView[0][0] = 1;
ModelView[0][1] = 0;
ModelView[0][2] = 0;
// Column 1:
ModelView[1][0] = 0;
ModelView[1][1] = 1;
ModelView[1][2] = 0;
// Column 2:
ModelView[2][0] = 0;
ModelView[2][1] = 0;
ModelView[2][2] = 1;
relativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0));
return relativeWorldPosition;