Search code examples
swiftscenekit

How to adjust max render distance in SceneKit


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


Solution

  • 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