Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
I think you can set it to 0 in the settings of the camera, can't you? –  SwissCoder Oct 9 '12 at 12:00
    
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. –  SwissCoder Oct 9 '12 at 12:01

1 Answer 1

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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.