Billboarding Rendering with Axis Constrains
- Ashwani Shahrawat
- Jun 5, 2024
- 1 min read
Introduction to Billboard
Use case and Applications
Billboard towards Position
Billboard with Fixed Axis
// Language : HLSL Shader Unity
///// Billboarding /////
inline float4 BillBoard_Y(float4 vtxPos)
{
float4x4 _ObjToWorld = GetObjectToWorldMatrix();
float3 p = float3(_ObjToWorld._m03_m13_m23);
p.y = _WorldSpaceCameraPos.y;
float3 f = normalize(_WorldSpaceCameraPos - p);
float3 u = float3(0, 1, 0);
float3 r = cross(f, u);
f = cross(u, r);
float4x4 rMtx = { r.x, u.x, f.x, 0, r.y, u.y, f.y, 0, r.z, u.z, f.z, 0, 0, 0, 0, 1 };
return mul(vtxPos, rMtx);
}



Comments