SceneKit Namespace

The SceneKit namespace provides high-level, scene-graph-based 3D graphics.

Classes

_SCNShaderModifiers

A dictionary of shader snippets.

SCNAccelerationConstraint
SCNAction

Performs actions on a SCNNode, including changes to appearance, geometry, animations, or arbitrary functions.

SCNActionable

Allows actions to be applied.

SCNActionable_Extensions

Extension methods to the ISCNActionable interface to support all the methods from the SCNActionable protocol.

SCNAnimatable

Allows animations to be applied.

SCNAnimatable_Extensions

Extension methods to the ISCNAnimatable interface to support all the methods from the SCNAnimatable protocol.

SCNAnimatableExtensions

Extension methods for ISCNAnimatable.

SCNAnimation
SCNAnimationEvent

Performs a function at a specific time during an animation.

SCNAnimationPlayer
SCNAudioPlayer

Holds a SCNAudioSource or AVAudioNode for use with positional audio.

SCNAudioSource

A reusable audio source for positional audio in SceneKit scenes.

SCNAvoidOccluderConstraint
SCNAvoidOccluderConstraintDelegate
SCNAvoidOccluderConstraintDelegate_Extensions

Extension methods to the ISCNAvoidOccluderConstraintDelegate interface to support all the methods from the SCNAvoidOccluderConstraintDelegate protocol.

SCNBillboardConstraint

Automatically constrains a SCNNode so that it always points to the current rendering node.

SCNBoundingVolume

Functions that define a volume in 3D space.

SCNBox

An SCNGeometry whose faces are all rectangles.

SCNCamera

Specifies a camera, with attributes such as field-of-view and depth-of-view.

SCNCameraController
SCNCameraControllerDelegate
SCNCameraControllerDelegate_Extensions

Extension methods to the ISCNCameraControllerDelegate interface to support all the methods from the SCNCameraControllerDelegate protocol.

SCNCapsule

An SCNGeometry that is a cylinder with capped ends.

SCNCone

An SCNGeometry that is a circular frustum. Or, a party hat.

SCNConstraint

Automatically adjusts the transformation of a node.

SCNCylinder

An SCNGeometry that is a right circular cylinder.

SCNDistanceConstraint
SCNErrorCodeExtensions

Extension methods for the SceneKit.SCNErrorCode enumeration.

SCNFloor

An SCNGeometry that is an infinite plane.

SCNGeometry

Base class for SceneKit geometry objects

SCNGeometryElement

Combines information about vertices and a drawing primitive. Maps to a single drawing command sent to the GPU.

SCNGeometrySource

Provides vertex data that, in conjunction with SCNGeometryElements, define a 3D object.

SCNGeometrySourceSemantic

Enumerates vertex mode attributes.

SCNGeometryTessellator
SCNHitTest

Constants for use with the options argument in HitTest(SCNVector3, SCNVector3, SCNHitTestOptions).

SCNHitTestOptions

Configuration options for hit-testing in SCNNode and SCNSceneRenderer

SCNHitTestResult

Information about the SCNNode (if any) located at a specific point or along a ray.

SCNIKConstraint

An SCNConstraint that applies inverse kinematics.

SCNJavaScript

Static class that contains a method to export JavaScript modules.

SCNLayer
SCNLevelOfDetail

Controls alternate geometries rendered at thresholds in either world-space or screen-space.

SCNLight

A light source, used for all SCNLightTypes.

SCNLightAttribute
SCNLightingModel

Constants for use with the P:SceneKit.SCNMaterial.LightingModel property, which defines the way lights and materials combine to produce a particular rendered color.

SCNLightType

Enumerates the types of SCNLight.

SCNLookAtConstraint

An SCNConstraint that orients a node to point towards another node.

SCNMaterial

Specifies the lighting and shading characteristics of the surface of an SCNGeometry.

SCNMaterialProperty

Configures the various properties (such as color and texture) of a SCNMaterial.

SCNMorpher

An animated transformation of an SCNGeometry into one or more target SCNGeometry objects.

SCNNode

A node in the scene graph.

SCNNodeRendererDelegate

Interface defining delegate object functions for adding custom OpenGL drawing code.

SCNNodeRendererDelegate_Extensions

Extension methods to the ISCNNodeRendererDelegate interface to support all the methods from the SCNNodeRendererDelegate protocol.

SCNParticleProperty
SCNParticlePropertyController

Animates a property of the particles emitted by a SCNParticleSystem.

SCNParticleSystem

Emits small sprites whose behaviors are developer-specified.

SCNPhysicsBallSocketJoint

An SCNPhysicsBehavior that allows two SCNPhysicsBody objects to pivot around each other.

SCNPhysicsBehavior

Controls the behavior of one or more SCNPhysicsBody objects.

SCNPhysicsBody

Adds physics simulation to an SCNNode.

SCNPhysicsConeTwistJoint
SCNPhysicsContact

How two SCNPhysicsBody objects are in contact with each other.

SCNPhysicsContactDelegate

Delegate object functions responding to touches between SCNPhysicsBody objects..

SCNPhysicsContactDelegate_Extensions

Extension methods to the ISCNPhysicsContactDelegate interface to support all the methods from the SCNPhysicsContactDelegate protocol.

SCNPhysicsContactEventArgs

Provides data for the DidUpdateContact, E:SceneKit.SCNPhysicsContactEventArgs.DidEndContact and E:SceneKit.SCNPhysicsContactEventArgs.DidUpdateContact events.

SCNPhysicsField

Applies forces to all SCNPhysicsBody objects in a given volume.

SCNPhysicsHingeJoint

An SCNPhysicsBehavior that attaches two SCNPhysicsBody objects along a single axis.

SCNPhysicsShape

A solid volume for a SCNPhysicsBody. Used in collision detection.

SCNPhysicsShapeOptions

Valid keys for the options dictionary used with M:SceneKit.SCNPhysicsShape.Create*.

SCNPhysicsShapeOptionsKeys

Defines valid keys for use with the options dictionary passed to M:SceneKit.SCNPhysicsShape.Create*.

SCNPhysicsShapeOptionsTypes

Geometrical type associated with SCNPhysicsShapes.

SCNPhysicsSliderJoint

An SCNPhysicsBehavior that connects two SCNPhysicsBody objects, allowing them to slide and rotate around their connecting points.

SCNPhysicsTest

Valid options for use with M:SceneKit.SCNPhysicsWorld.ContactTest*.

SCNPhysicsTestKeys

Contains values that control searching, backface culling, and collision testing.

SCNPhysicsTestSearchModeKeys

Enumerates values that control which collision search results are returned.

SCNPhysicsVehicle

An SCNPhysicsBehavior that simulates the physics of a wheeled vehicle.

SCNPhysicsVehicleWheel

The appearance and physical characteristics of a wheel on a SCNPhysicsVehicle.

SCNPhysicsWorld

A physics simulation that models collisions and other physics-related properties in an SCNScene.

SCNPlane

An SCNGeometry that is a rectangular single-sided finite plane.

SCNProgram

Performs custom rendering using shaders written in OpenGL Shading Language.

SCNProgramDelegate

Delegate object for SCNProgram objects.

SCNProgramDelegate_Extensions

Extension methods to the ISCNProgramDelegate interface to support all the methods from the SCNProgramDelegate protocol.

SCNProgramSemanticOptions

Defines the MappingChannel for use with SetSemantic(NSString, String, SCNProgramSemanticOptions).

SCNPropertyControllers
SCNPyramid

An SCNGeometry that is a right rectangular pyramid.

SCNReferenceNode

A SCNNode that loads its content from a scene file.

SCNRenderer

Renders an SCNScene into an OpenGL context.

SCNRenderingArguments

Defines keys for use with Render(SCNNode, SCNRenderer, NSDictionary) and SetSemantic(NSString, String, SCNProgramSemanticOptions).

SCNRenderingOptions

A DictionaryContainer that defines options when instantiating a SCNView.

SCNReplicatorConstraint
SCNScene

The highest-level description of a 3D scene.

SCNSceneExportDelegate

Protocol that defines methods to handle exporting a scene to a file.

SCNSceneExportDelegate_Extensions

Extension methods to the ISCNSceneExportDelegate interface to support all the methods from the SCNSceneExportDelegate protocol.

SCNSceneLoadingOptions

Options for scene loading.

SCNSceneRenderer

Implementation class of the ISCNSceneRenderer interface.

SCNSceneRenderer_Extensions

Extension methods to the ISCNSceneRenderer interface to support all the methods from the SCNSceneRenderer protocol.

SCNSceneRendererDelegate

Delegate object for the SCNRenderer class, defines methods reflects rendering events.

SCNSceneRendererDelegate_Extensions

Extension methods to the ISCNSceneRendererDelegate interface to support all the methods from the SCNSceneRendererDelegate protocol.

SCNSceneSource

Reads scene-defining data from a file or NSData object.

SCNSceneSourceLoadErrors

Enumerates error types that can occur while loading SCNSceneSources.

SCNSceneSourceLoading

Options for creating and loading SCNScene objects.

SCNSceneSourceProperties

Metadata keys associated with a scene file. Used with GetProperty(NSString).

SCNShadable

Implementation of ISCNShadable.

SCNShadable_Extensions

Extension methods to the ISCNShadable interface to support all the methods from the SCNShadable protocol.

SCNShaderModifiers

A DictionaryContainer containing options for shaders.

SCNShape

An SCNGeometry created from a 2D path, optionally extruded into three dimensions.

SCNSkinner

Accesses the scene graph in support of skeletal animation.

SCNSliderConstraint
SCNSphere

An SCNGeometry that is a sphere.

SCNTechnique

Provides additional drawing passes, each of which applies a shader.

SCNTechniqueSupport

Implementation of ISCNTechniqueSupport that simply holds a reference to the SCNTechnique.

SCNText

An SCNGeometry based on a string, optionally extruded into three dimensions.

SCNTimingFunction
SCNTorus

An SCNGeometry that is a ring-shaped solid.

SCNTransaction

Allows a set of modifications to be applied atomically.

SCNTransformConstraint

An SCNConstraint that executes a function specifying a change in transformation (position, rotation, and scale) to a node or nodes.

SCNTube

An SCNGeometry that is a cylinder with a hole along its central axis.

SCNView

A UIView that renders SCNScenes.

SCNView.SCNViewAppearance

Appearance class for objects of type SCNView.

Structs

SCNMatrix4

A 4x4 matrix.

SCNQuaternion

Represents a quaternion and contains methods that operate on them.

SCNVector3

A 3-component vector.

SCNVector4

A 4-component vector.

Interfaces

ISCNActionable

Interface representing the required methods (if any) of the protocol SCNActionable.

ISCNAnimatable

Interface representing the required methods (if any) of the protocol SCNAnimatable.

ISCNAnimationProtocol
ISCNAvoidOccluderConstraintDelegate

Interface representing the required methods (if any) of the protocol SCNAvoidOccluderConstraintDelegate.

ISCNBoundingVolume

Interface representing the required methods (if any) of the protocol SCNBoundingVolume.

ISCNBufferStream

Interface for managing a custom shader's Metal buffer.

ISCNCameraControlConfiguration
ISCNCameraControllerDelegate

Interface representing the required methods (if any) of the protocol SCNCameraControllerDelegate.

ISCNNodeRendererDelegate

Interface representing the required methods (if any) of the protocol SCNNodeRendererDelegate.

ISCNPhysicsContactDelegate

Interface representing the required methods (if any) of the protocol SCNPhysicsContactDelegate.

ISCNProgramDelegate

Interface representing the required methods (if any) of the protocol SCNProgramDelegate.

ISCNSceneExportDelegate

Interface representing the required methods (if any) of the protocol SCNSceneExportDelegate.

ISCNSceneRenderer

Interface representing the required methods (if any) of the protocol SCNSceneRenderer.

ISCNSceneRendererDelegate

Interface representing the required methods (if any) of the protocol SCNSceneRendererDelegate.

ISCNShadable

Interface representing the required methods (if any) of the protocol SCNShadable.

ISCNTechniqueSupport

Interface representing the required methods (if any) of the protocol SCNTechniqueSupport.

Enums

SCNActionTimingMode

Enumerates rate curves for use with SCNAction objects.

SCNAnimationImportPolicy

Enumerates animation import policies.

SCNAntialiasingMode

Enumerates values that control antialiasing behavior.

SCNBillboardAxis

Enumeration of axes' locks available to nodes constrained by SCNBillboardConstraint.

SCNBlendMode

Enumeration of the ways SceneKit can blend colors from a material with colors that already exist in the render target.

SCNBufferFrequency

Enumerates values that control whether handlers are invoked per frame, per node per frame, or per node per frame per shaded renderable.

SCNCameraProjectionDirection
SCNChamferMode

Enumerates the ways a SCNShape can be chamfered; on its front, back, or both sides.

SCNColorMask
SCNCullMode

Enumeration determining which faces of a surface SCNMaterial are rendered.

SCNDebugOptions

Enumerates debug overlay options.

SCNErrorCode
SCNFillMode
SCNFilterMode

Enumeration of texture filtering modes.

SCNGeometryPrimitiveType

Enumeration of 2D geometry primitives.

SCNGeometrySourceSemantics

Enumerates semantics for geometry data.

SCNHitTestSearchMode
SCNInteractionMode
SCNMorpherCalculationMode

Enumeration of valid interpolation formulae for CalculationMode.

SCNMovabilityHint

Enumerates values that tell SceneKit whether nodes are expected to move over time.

SCNNodeFocusBehavior

Enumerates the focusable states of a SCNNode.

SCNParticleBirthDirection

Enumerates the initial direction of particles emitted by a SCNParticleSystem.

SCNParticleBirthLocation

Enumeration of the initial location of particles emitted by a SCNParticleSystem.

SCNParticleBlendMode

Enumeration of the ways in which overlapping particles emitted by a SCNParticleSystem will be rendered.

SCNParticleEvent

Enumeration of lifecycle events for particles emitted by a SCNParticleSystem. Used with HandleEvent(SCNParticleEvent, NSString[], SCNParticleEventHandler).

SCNParticleImageSequenceAnimationMode

Enumeration of playing modes for SCNParticleSystem's whose particles are rendered as a sequence of images.

SCNParticleInputMode

Enumerates how a particle property is animated (over the lifetime of the particle, as the particle travels over a distance, or based on another property). Used with InputMode.

SCNParticleModifierStage

Enumerates moments when the modifier specified in AddModifier(NSString[], SCNParticleModifierStage, SCNParticleModifierHandler) should be applied.

SCNParticleOrientationMode

Enumerates the alignment of particles emitted by a SCNParticleSystem. Used with OrientationMode.

SCNParticleSortingMode

Enumeration specifying the order in which particles emitted by a T:SceneKit.SCNParticleScene are rendered.

SCNPhysicsBodyType

An enumeration specifying whether the SCNPhysicsBody is dynamic, kinematic, or static. Used with CreateBody(SCNPhysicsBodyType, SCNPhysicsShape).

SCNPhysicsCollisionCategory

Defaults for the collision properties of a SCNPhysicsBody.

SCNPhysicsFieldScope

Enumerates values specifying whether an SCNPhysicsField affects objects inside or outside its border.

SCNPhysicsSearchMode

Enumerates values that control which physics search results are returned.

SCNPhysicsShapeType

Enumeration of categories for SCNPhysicsShapes.

SCNReferenceLoadingPolicy

Enumerates possible loading policies for SCNReferenceNode objects.

SCNRenderingApi

Enumerates values that signify the Metal or OpenGLES2 APIs.

SCNSceneSourceStatus

Enumerates the states of an SCNSceneSource.

SCNShadowMode

Enumeration controlling when shadows are calculated.

SCNTessellationSmoothingMode
SCNTransparencyMode

Enumerates techniques for calculating transparency.

SCNWrapMode

Enumerates texture-wrapping techniques.

Delegates

SCNActionNodeWithElapsedTimeHandler

Completion handler used with CustomAction(Double, SCNActionNodeWithElapsedTimeHandler).

SCNAnimationDidStartHandler
SCNAnimationDidStopHandler
SCNAnimationEventHandler

Completion handler for use with Create(nfloat, SCNAnimationEventHandler).

SCNBindingHandler

Completion handler used with HandleBinding(String, SCNBindingHandler).

SCNBufferBindingHandler
SCNFieldForceEvaluator

Delegate for the CustomField(SCNFieldForceEvaluator) method.

SCNNodeHandler
SCNNodePredicate

Delegate for use with EnumerateChildNodes(SCNNodePredicate).

SCNParticleEventHandler

Completion handler for use with HandleEvent(SCNParticleEvent, NSString[], SCNParticleEventHandler).

SCNParticleModifierHandler

Delegate used as the handler in AddModifier(NSString[], SCNParticleModifierStage, SCNParticleModifierHandler).

SCNSceneExportProgressHandler

Continuation handler that SceneKit repeatedly calls when exporting a scene.

SCNSceneSourceFilter

Delegate that tests objects in the scene for inclusion.

SCNSceneSourceStatusHandler

Callback used to reflect progress during execution of SceneFromOptions(SCNSceneLoadingOptions, SCNSceneSourceStatusHandler).

SCNTransformConstraintHandler

Delegate used in calls to Create(Boolean, SCNTransformConstraintHandler).

Remarks

Scene Kit is a framework for 3D graphics, based on hierarchical scene-graphs.

The fundamental classes in Scene Kit are SCNScene, which holds all content, and T:CoreGraphics.SceneKit.SCNView, a UIView that renders an SCNScene.

An SCNScene has a RootNode property of type SCNNode. SCNNode's have P:SceneKit.SCNNode.ChildNodes and implement System.Collections.Generic.IEnumerable`1<class MonoTouch.SceneKit.SCNNode>. Properties of SCNNode include Camera, of type SCNCamera, Geometry, of type SCNGeometry, and Light, of type SCNLight.

Additionally, every SCNNode has a Position property that defines a location in space relative to the SCNNode's ParentNode and P:SceneKit.SCNNode.FirstMaterial and P:SceneKit.SCNNode.Materials that create the SCNNode's appearance.

The following example shows a minimal Scene Kit view:

public MySceneView (RectangleF frame) : base(frame)
{
	BackgroundColor = UIColor.Blue;
	this.Scene = new SCNScene ();

	var material = new SCNMaterial ();
	material.Diffuse.Contents = UIImage.FromFile("textureX.png");
	material.Specular.Contents = UIColor.Gray;
	material.LocksAmbientWithDiffuse = true;

	Scene.RootNode.Geometry = new SCNBox {
		Width = 1,
		Height = 1,
		Length = 1,
		ChamferRadius = 0.2f,
		FirstMaterial = material
	};

	Scene.RootNode.Light = new SCNLight {
		LightType = SCNLightType.Ambient,
		Color = UIColor.Gray,
	};

	var camera = new SCNCamera ();
	var cameraNode = new SCNNode () {
		Camera = camera,
		Position = new SCNVector3 (3, 3, 3),
		Constraints = new SCNConstraint[] { SCNLookAtConstraint.Create(Scene.RootNode) }
	};
	Scene.RootNode.AddChildNode (cameraNode);
}          

Geometry

All geometry in SceneKit is described by subclasses of SCNGeometry:

SCNCapsule A pill-shaped capsule with adjustable end caps
SCNCone A cone whose top can be truncated
SCNBox A rectangular box.
SCNCylinder A cylinder.
SCNFloor An infinite plane with the ability to reflect the geometry above it.
SCNPlane A one-sided rectangle.
SCNPyramid A tetrahedron.
SCNShape A 2D shape that has been extruded into the 3rd dimension.
SCNSphere A ball.
SCNText Extruded text.
SCNTorus A donut shape.
SCNTube An uncapped cylinder.

In addition, SceneKit can load entire scenes from .DAE files with the FromFile method.

Finally, developers can create custom geometry using the M:SceneKit.SCNGeometry.Create(SceneKit.SCNGeometrySource[], SceneKit.SCNGeometryElement[]* method with arrays of appropriate SCNGeometrySource and SCNGeometryElement objects. The following shows the creation of a custom pyramid:

//Lower-left
var a = new SCNVector3(-1, -1, 0);
//Upper-right
var b = new SCNVector3(1, 1, 0);

var halfX = (c.X + a.X) / 2;
var halfY = (c.Y + a.Y) / 2;
var halfZ = (c.Z + a.Z) / 2;

var b = new SCNVector3(a.X, c.Y, halfZ);
var d = new SCNVector3(c.X, a.Y, halfZ);
//Elevate the midpoint so that it's clearly a pyramid
var midPoint = new SCNVector3(halfX, halfY, halfZ + 1.0);

//The vertices of the geometry
var locs = new [] {
	a, b, c, d, midPoint
};
var locSource = SCNGeometrySource.FromVertices(locs);

//Note that this relies on the ordering of locs above
//and it defines triangles (could be triangle strips, etc.)
var indices = new [] {
	//Triangles are defined counter-clockwise!
	4, 1, 0,
	1, 4, 2,
	2, 4, 3,
	3, 4, 0
};


var idxArray = new byte[indices.Length][];
for(int i = 0; i < idxArray.Length; i++)
{
	idxArray[i] = BitConverter.GetBytes(indices[i]);
}
var idxData = NSData.FromArray(idxArray.SelectMany(id => id).ToArray());

//Note that this relies on indices defining triangles
var element = SCNGeometryElement.FromData(idxData, SCNGeometryPrimitiveType.Triangles, indices.Length / 3, sizeof(int));

//Normals are relative to geometry
var normals = new [] {
	new SCNVector3(0, 0, 1),
	new SCNVector3(0, 0, 1),
	new SCNVector3(0, 0, 1),
	new SCNVector3(0, 0, 1),
	new SCNVector3(0, 0, 1),
};;
var normSource = SCNGeometrySource.FromNormals(normals);

//These texture coords will cause the texture to wrap 
var txCoords = new [] {
	new CGPoint(-1, -1),
	new CGPoint(-1, 1),
	new CGPoint(1, 1),
	new CGPoint(1, -1)
};

var txCoordsSource = SCNGeometrySource.FromTextureCoordinates(txCoords);

var geometry = SCNGeometry.Create(new [] { locSource, normSource, txCoordsSource }, new [] { element });