Rotating a sphere causes it to clip

Hi, I have a sphere which I wish to zoom in on and fly around. If I zoom in and then attempt to "fly" around the edge of the sphere, the middle of the sphere clips and is replaced with a grey circle.


The camera is setup as follows: -



SCNCamera *camera = [SCNCamera camera];

self.cameraNode = [SCNNode node];

camera.usesOrthographicProjection = YES;

camera.orthographicScale = 12;

camera.zNear = 0.00001;

camera.zFar = 600;

camera.xFov = 80;

camera.yFov = 80;

self.cameraNode.camera = camera;

self.cameraNode.position = SCNVector3Make(0, 0, 10);

[self.scene.rootNode addChildNode:self.cameraNode];



The Sphere is setup as follows: -

SCNSphere *sphere = [SCNSphere sphereWithRadius:kRadius];

sphere.segmentCount = 256;

self.sphereNode = [SCNNode nodeWithGeometry:sphere];

self.sphereNode.geometry = sphere;

self.sphereNode.position = SCNVector3Make(0, 0, 0);

self.sphereNode.geometry.firstMaterial.diffuse.contents = [NSImage imageNamed:@"Earth.png"];

self.sphereNode.geometry.firstMaterial.specular.contents = [NSImage imageNamed:@"specular.png"];

self.sphereNode.geometry.firstMaterial.emission.contents = [NSImage imageNamed:@"boundaries.png"];

self.sphereNode.geometry.firstMaterial.doubleSided = NO;

[scene.rootNode addChildNode:self.sphereNode];



Also, I don't seem able to zoom very close into the sphere. I'm clearly doing something wrong - any advice would be welcomed. Thank you 🙂

Accepted Reply

If you are using orthographic projection, then "zooming" is acheived by changing the orthographic scale parameter.

Or perhaps by physically scaling the object.


If you are using a perspective projection then zoom by narrowing the field of view. Or possibly reducing the distance to the object.

Replies

Unfortunately, I do not seem to be able to include a screenshot.

The most likely reason..


The POV is getting close to the sphere so that its middle is passing through the near-plane.

With an orthographic projection, you can safely set that value to something negative. Or take more care not to get the POV too close to the sphere.

Thank you for your answer - that has helped a great deal. Do you have any thoughts on zooming? If for example I zoom in over the uk, the closest I can get is seeing the whole uk instead of just London for example. I must be able to zoom in closer?

How do you handle zooming ? Do you simply use SCNView.allowsCameraControl ? Check whether it changes the yFov. 80° is a wide angle.

If you are using orthographic projection, then "zooming" is acheived by changing the orthographic scale parameter.

Or perhaps by physically scaling the object.


If you are using a perspective projection then zoom by narrowing the field of view. Or possibly reducing the distance to the object.

Hi yes I am just using SCNView.allowsCameraControl - I'm guessing I would be wise to switch to fully handling the camera myself?

It is orthographic that I am using. I'll try adjusting the scale manually. Thank you.