How to adjust max render distance in SceneKit

Viewed 25

Currently in my SceneKit scene for a game in iOS using Swift the render distance is very limited, there is a noticeable cutoff in the terrain

infront

of the players perspective, i cant find a "max render distance" setting anywhere and the only option ive seen so far is to just cover it with fog, im clearly missing something as ive seen plenty of games with larger render distances but after searching across google, documentation and stack overflow i cant seem to get an answer, can anyone help?

Images showing ingame at spawn and the scene edit view

2 Answers

Im a dingdong and figured out what i was missing.

What i was looking for was a setting in the camera that your scene is using as the point of view, theres a setting called 'Z clipping" which clips out anything closer then the "near" value or further then the "far" value, and by default far is set to 100 units. just adjust that setting either in code or within XCODE and set it to a higher value to view the entire scene.

enter image description here

Camera Far Clipping Plane

To adjust a max distance between the camera and a visible surface, use zFar instance property. If a 3D object's surface is farther from the camera than this distance, the surface is clipped and does not appear. The default value in SceneKit is 100.0 meters.

arscnView.pointOfView?.camera?.zFar = 500.0
Related