Hi, i am using this method for my billboarding.

But it seems that i can only set my billboards at position(0,0,0)

otherwise it displays incorrcect.

I have tried to translate before and after but nothing works.

How can i set any other position than origin?

this is my method:

[source lang="cpp"]void CreateBillboardMatrix(const D3DXVECTOR3& particlePos, const D3DXVECTOR3& cameraPos, D3DXMATRIX& out) { // compute billboard basis D3DXVECTOR3 look = particlePos; look = look - cameraPos; D3DXVec3Normalize(&look,&look); const D3DXVECTOR3 CAMERA_UP_VECTOR(0, 1, 0); D3DXVECTOR3 camUp = CAMERA_UP_VECTOR; D3DXVec3Normalize(&camUp,&camUp); D3DXVECTOR3 right; D3DXVec3Cross(&right,&camUp,&look); D3DXVec3Normalize(&right,&right); D3DXVECTOR3 up; D3DXVec3Cross(&up,&look,&right); D3DXVec3Normalize(&up,&up); // set matrix values D3DXMatrixIdentity(&out); out._11 = right.x; out._12 = right.y; out._13 = right.z; out._21 = up.x; out._22 = up.y; out._23 = up.z; out._31 = look.x; out._32 = look.y; out._33 = look.z; out._41 = particlePos.x; out._42 = particlePos.y; out._43 = particlePos.z; }[/source]

I see an error in your code, the look vector is CameraPos-billboardPos (not the other way around). Take into acount that if you have two positions A and B the vector B-A is facing B.