# Face Camera, A bit different

This topic is 3801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all ^^ I have a rather specific problem I cannot seem to solve. Basically inside a mesh I have several planes (a quad). Mind, these are all one mesh. I basically want to align all the quads to face the camera in the vertex shader. My problem is, each vertex must be aligned - and each vertex only has information about itself, not the quad as a whole, so how can I achieve this camera-facing technique without having to write a special program to generate the specifically-designed model? Thanks, Adoado

##### Share on other sites
Assuming your quads are already "facing forward" in object space, all you need to do is ensure that the vertices get to view space without ever being rotated. Doing this is easy: just get the translation component from your combined worldView transform (or modelView transform, in OpenGL lingo) and add it to the vertex position. This will position the quad in the right place, but it will always be facing forward. So in DX HLSL it would look something like this in the vertex shader...

float4x4 matWorldView = mul(matWorld, matView);float3 vPositionVS = vPositionOS + float4(matWorldView._41, matWorldView._42, matWorldView._43);float4 vPositionCS = mul(float4(vPositionVS, 1.0f), matProjection);

There are other variations on this technique as well, which you should be able to find if you search around for "billboarding"

1. 1
2. 2
3. 3
Rutin
20
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633656
• Total Posts
3013190
×