top of page

Billboarding Rendering with Axis Constrains

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);
}

Recent Posts

See All
Height Map and Parallax Mapping

In this blog, I will explain Adjust UV using HeightMap RayTrace HeightMap to find Occlusions. o.Height = SAMPLE_TEXTURE2D(_PKDMAP,...

 
 
 

Comments


bottom of page