How is LOD calculated in game engines? I guess a simple Vector Distance Calculation would be bad for performance. How do game engines calculate that?

You can figure out a vector distance pretty fast if you use the dot product. The dot product of two vectors A and B is the Length(A) x Length(B) x Cos (angle between them). If you dot a vector with itself, then you get Length(A) x Length(A) x Cos(0). Cosine of zero is one, so any vector A dotted with itself is Length(A) squared. If we're doing a comparison, we can take the distance threshold, square it, and compare it to the dot product of the vector from the camera to the object and itself.

[Join us on Discord] and/or [Support us on Patreon]

Got a burning question you want answered?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *