Tag Info

New answers tagged

0

Apparently Unity only render one face of the quad with the default shader (you can test it by moving your camera around). By setting another shader (in your case "Sprite/Default" should do the stuff), it will render both faces. At least it solved the problem for me. The reason it work with negative z is that a negative scale will flip the quad (thus ...


0

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.


1

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 - ...


1

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 ...


1

You can use an Orthographic projection matrix to transform your vertexes. Then you can simply provide your triangle verts in terms of screen pixels, e.g.: a vertex at (0,0), one at (10, 0) and one at (5, 10). Here's another reference of OpenGL matrices, with a lot of maths. Make sure to do a search for "OpenGL orthographic projection" and "2D drawing with ...



Top 50 recent answers are included