Suppose there are two cameras in the scene, one is a Ngui camera and the other is a projection camera.
The projection camera looks at the 3D model, depth is larger than the Ngui camera, and the Clear flags set depth only.
Now you want to clip the 3D model between the two Ngui controls.
Try it: Set the depth and set the Rendererqueue to no use.
Have no, had to put to 3D model above the Uisprite also use 3D camera to see forget.
Now the question is, how to let the original position in the Ngui has been adjusted to the size of the thing, when it is viewed by a 3D camera is still the same?
If there is a Ngui object Msprite, Ngui's camera is camera2d, and the 3D camera is camera3d.
Note: The msprite position has been adjusted in Ngui, but it is behind the 3D model.
Get the screen coordinates of Msprite first
Screenpos = Camera2d.worldoscreenpoint (mSprite.transform.position);
Calculate the distance from the 3D camera
float distance = 1.0f/mathf.tan (Camera3d.fieldofview * 0.5f * Mathf.deg2rad);
The distance between the Msprite and the 3D camera is based on the screen coordinates of the msprite. To figure out where msprite should be.
Vector3 pos = m_3dcamera.screentoworldpoint (New Vector3 (Screenpos. x, Screenpos. Y, distance));
MSprite.transform.position = pos;
How to get Ngui objects on top of a 3D model