Hashmat Khalil Hashmat Khalil - 8 months ago 132
iOS Question

scenekit skybox flickering on camera movement

the skybox has high resolution images of 1500x1500 for retina

SCNScene *scene = [SCNScene scene];

scene.background.contents = @[[UIImage imageNamed:@"left.png"],[UIImage imageNamed:@"left.png"],[UIImage imageNamed:@"top.png"],[UIImage imageNamed:@"botom.png"],[UIImage imageNamed:@"back.png"],[UIImage imageNamed:@"front.png"]];

and the camera is configured as:

_cameraNode = [SCNNode node];
_cameraNode.camera = [SCNCamera camera];
_cameraNode.position = SCNVector3Make(0, 0, 10000);
_cameraNode.camera.xFov = 55;
_cameraNode.camera.zFar = 2100000;
_cameraNode.camera.aperture = 1/50;

I'm moving the camera by its z value by 100 incrementally. When the camera reaches around 252000 the skybox starts to flicker as if it zooms in and out. the problem gets worse if the camera goes further until scene is black( black is the background color of the SCNView). How to avoid such flickering and being able to the camera in very bis scene? What am I doing wrong?

Answer Source

As I said in comments, I reworked my 3D scene where the measurements und object size were shrinked down. I also learned that one must not use real world object size. It would be much better to shrink down all objects proportionally. One do not need to create huge scene with real world size and measurement. Shrinking down will also need smaller texture, and that can be useful for memory optimisation. Since apply these changes, I haven't seen any flickering.