(HLSL)
//face cam
float4x4 worldViewMatrix = mul(matWorld, matView);
float3 positionVS = input.Position + float3(worldViewMatrix._41, worldViewMatrix._42, worldViewMatrix._43);
output.Position = mul(float4(positionVS, 1.0f), matProjection);
But, I need to do it per quad/vertex - I’m having some issues with the concept.
I’ve read several different posts but the solutions offered aren’t complete or explained. My current vertex format is position - normal - textured. Do I need to pass in a “center” position or can the vertex shader calculate the position with my existing data?
The world matrix in the code above (matWorld) is transformed on the CPU with scale, rotation then position.
To convolute matters, I’d like to still be able to scale and move the entire mesh as a whole and still have each quad face the camera. I would think this would be as simple as creating the world matrix in the vertex shader per vertex prior to executing my existing code but is that the proper way to handle my issue?
EDIT: Solution here: http://www.gamedev.net/topic/154890-billboarding-with-vertex-shaders/