SceneKit, sometimes rendered Scene Kit, is a
3D graphics
3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for th ...
application programming interface (API) for
Apple Inc.
Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
platforms written in
Objective-C
Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its N ...
. It is a high-level framework designed to provide an easy-to-use layer over the lower level APIs like
OpenGL
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
and
Metal
A metal (from Greek μέταλλον ''métallon'', "mine, quarry, metal") is a material that, when freshly prepared, polished, or fractured, shows a lustrous appearance, and conducts electricity and heat relatively well. Metals are typi ...
.
SceneKit maintains an
object based scene graph
Scene (from Greek σκηνή ''skēnḗ'') may refer to:
Arts, entertainment, and media Music
*Scene (subculture), a youth subculture from the early 2000s characterized by a distinct music and style. Groups and performers
* The Scene who recor ...
, along with a
physics engine
A physics engine is computer software that provides an approximate simulation of certain physical systems, such as rigid body dynamics (including collision detection), soft body dynamics, and fluid dynamics, of use in the domains of computer ...
,
particle system
A particle system is a technique in game physics, motion graphics, and computer graphics that uses many minute sprites, 3D models, or other graphic objects to simulate certain kinds of "fuzzy" phenomena, which are otherwise very hard to rep ...
, and links to
Core Animation and other frameworks to easily animate that display. SceneKit views can be mixed with other views, for instance, allowing a
SpriteKit 2D display to be mapped onto the surface of an object in SceneKit, or a UIBezierPath from
Core Graphics
In Apple's macOS operating system, Quartz is the Quartz 2D and Quartz Compositor part of the Core Graphics framework. Quartz includes both a 2D renderer in Core Graphics and the composition engine that sends instructions to the graphics card. ...
to define the geometry of a SceneKit object. SceneKit also supports import and export of 3D scenes using the
COLLADA
COLLADA (for ''COLLA''borative ''D''esign ''A''ctivity) is an interchange file format for interactive 3D applications. It is managed by the nonprofit technology consortium, the Khronos Group, and has been adopted by ISO as a publicly available ...
format. SceneKit was first released for
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
in 2012, and
iOS
iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company's mobile devices, including the iPhone; the term also include ...
in 2014.
Basic concepts
SceneKit maintains a
scene graph
Scene (from Greek σκηνή ''skēnḗ'') may refer to:
Arts, entertainment, and media Music
*Scene (subculture), a youth subculture from the early 2000s characterized by a distinct music and style. Groups and performers
* The Scene who recor ...
based on a root object, an instance of the class SCNScene. The SCNScene object is roughly equivalent to the view objects found in most 2D libraries, and is intended to be embedded in a display container like a window or another view object. The only major content of the SCNScene is a link to the rootNode, which points to an SCNNode object.
SCNNodes are the primary contents of the SceneKit hierarchy. Each Node has a Name, and pointers to optional Camera, Light and Geometry objects, as well as an array of childNodes and a pointer to its own parent. A typical scene will contain a single Scene object pointed to a conveniently named Node (often "root") whose primary purpose is to hold a collection of children Nodes. The children nodes can be used to represent cameras, lights, or the various geometry objects in the Scene.
A simple Scene can be created by making a single SCNGeometry object, typically with one of the constructor classes like SCNBox, a single SCNCamera, one or more SCNLights, and then assigning all of these objects to separate Nodes. A single additional generic Node is then created and assigned to the SCNScene object's rootNode, and then all of the objects are added as children of that rootNode.
Nevertheless the number of lights is limited to 8.
SCNScenes also contain a number of built-in
user interface
In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
controls and input/output libraries to greatly ease implementing simple viewers and similar tasks. For instance, setting the Scene's autoenablesDefaultLighting and allowsCameraControl to true, and then adding an object tree read from a COLLADA file will produce viewable content of arbitrary complexity with a few lines of code. The integration with
Xcode
Xcode is Apple's integrated development environment (IDE) for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS. It was initially released in late 2003; the latest stable release is version 14.2, released on December 13, ...
allows the Scene itself to be placed in a window in
Interface Builder
Interface Builder is a software development application for Apple's macOS operating system. It is part of Xcode (formerly Project Builder), the Apple Developer developer's toolset. Interface Builder allows Cocoa and Carbon developers to cre ...
, without any code at all.
There is a Scenekit archive file format, using the filename extension .
References
*
*
{{compu-stub
3D graphics APIs