New answers tagged linear-algebra
Test only (projected.W < 0), not (Z < 0 || W < 0). In some clip space formulations (cough OpenGL cough), the visible range includes positive and negative Z values, whereas W is always positive in front of the camera and negative behind.
Given the three vectors [camera position], [camera direction] and [object position]. Compute the dot product of [camera direction] and [object position]-[camera position]. If the result is negative, the object is behind the camera. Given that I understood your code right it would be: if((PositionX - Camera.PositionX) * Camera.LookAtX + (PositionY - ...
How about doing it a bit differently? Start as usual and render all markers within viewport. If a marker is outside of the viewport - proceed: Get positions of the marker A Get position of the camera B (maybe slightly in front of it) Calculate 3D vector AB between these two Convert and normalize that vector into 2D screen bounds (A will be in view center ...
Top 50 recent answers are included