I am having some trouble attempting to wrap my scene wit skybox in a frustum perspective.
GLKMatrix4 projectionMatrix = GLKMatrix4MakeFrustum(-50, 50, -50, 50, 0.1, 100);
GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, -0.8f, 0.0);
baseModelViewMatrix = GLKMatrix4Scale(baseModelViewMatrix, 0.5f, 0.5f, 0.5f);
self.effect.transform.projectionMatrix = projectionMatrix;
self.effect.transform.modelviewMatrix = GLKMatrix4Multiply(camera, baseModelViewMatrix);
GLKMatrix4 camera = GLKMatrix4MakeLookAt(
self.cameraEye.x,
self.cameraEye.y,
self.cameraEye.z,
0.0,
0.0,
0.0,
0, 1, 0);
self.effect.transform.modelviewMatrix = GLKMatrix4Multiply(camera, baseModelViewMatrix);
self.skyBoxEffect.center = self.cameraEye;
self.skyBoxEffect.transform.projectionMatrix = self.effect.transform.projectionMatrix;
self.skyBoxEffect.transform.modelviewMatrix = self.effect.transform.modelviewMatrix;
The objects that I render in the scene look pretty nice with sense or depth, however the skybox simply doesn’t work nice, the images are distorted probably because of the frustum perspective. Is there any trick here? How can I make a skybox with GLKit using a frustum perspective? Thanks!
It usually takes some tweaking getting the frustum variables set in relation to the scene. I may be wrong but I think the math for your frustum currently gives you a field of view around 160 degrees. The normal fov is around 45to80 degrees. Check http://www.songho.ca/opengl/gl_projectionmatrix.html for more info on defining a proper frustum.