4
\$\begingroup\$

I'm creating a game that utilizes off center projection. I've got my game set up in a CAVE being rendered in a cluster, over 8 PC's with 4 of these PC's being used for each eye (this creates a stereoscopic effect). To help with alignment in the CAVE I've implemented an off center projection class.

This class simply tells the camera what its top left, bottom left & bottom right corners are. From here, it creates a new projection matrix showing the the player the left and right of their world. However, inside Unity's editor, the camera is still facing forwards and, as a result the culling inside Unity isn't rendering half of the image that appears on the left and right screens.

Does anyone know of a way to to either turn off the culling in Unity, or find a way to fix the projection matrix issue?

\$\endgroup\$
3
  • \$\begingroup\$ I think you can set it to 0 in the settings of the camera, can't you? \$\endgroup\$
    – SwissCoder
    Oct 9, 2012 at 12:00
  • \$\begingroup\$ by the way, do you know about answers.unity3d.com ? It has more active users, and when I was still developing with Unity I frequently checked that out. \$\endgroup\$
    – SwissCoder
    Oct 9, 2012 at 12:01
  • \$\begingroup\$ screenshot please \$\endgroup\$ Aug 17, 2014 at 10:42

1 Answer 1

1
\$\begingroup\$

I just made a blog post on how to disable frustum culling on a game object in unity:

http://allenwp.com/blog/2013/12/19/disabling-frustum-culling-on-a-game-object-in-unity/

// boundsTarget is the center of the camera's frustum, in world coordinates:
Vector3 camPosition = camera.transform.position;
Vector3 normCamForward = Vector3.Normalize(camera.transform.forward);
float boundsDistance = (camera.farClipPlane - camera.nearClipPlane) / 2 + camera.nearClipPlane;
Vector3 boundsTarget = camPosition + (normCamForward * boundsDistance);

// The game object's transform will be applied to the mesh's bounds for frustum culling checking.
// We need to "undo" this transform by making the boundsTarget relative to the game object's transform:
Vector3 realtiveBoundsTarget = this.transform.InverseTransformPoint(boundsTarget);

// Set the bounds of the mesh to be a 1x1x1 cube (actually doesn't matter what the size is)
Mesh mesh = GetComponent<MeshFilter>().mesh;
mesh.bounds = new Bounds(realtiveBoundsTarget, Vector3.one);
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .