|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||SceneKit||MBS Mac64bit Plugin||18.5||Yes||No||No||Yes, macOS only||No|
You illuminate your scene by attaching lights to SCNNode objects using their light property.
You set a light’s type using its type property. Depending on a light’s type, its position and direction may affect its behavior—you control the light’s position and direction through the node that the light is attached to. The direction of a light, if applicable to its type, is along the negative z-axis of its node’s local coordinate system.
A light’s other properties affect how it illuminates a scene. All lights have a color property, which interacts with SCNMaterial objects to produce the pixel colors in a rendered scene. Other properties, such as attenuation, shadowing, and spot angle, can affect the behavior of certain types of lights.
The number and type of lights in a scene is a key factor in SceneKit’s rendering performance. For efficient rendering, follow these tips:
- Use SceneKit lights only for dynamic light sources or lights that affect moving objects. For statically lit portions of your scene, create a light map texture in an external 3D authoring tool (also known as baked lighting) and apply it to objects in the scene using the multiply material property.
- Minimize the number of lights on each element of the scene. You can achieve most common lighting effects using no more than three lights, and you only need a single ambient light source. SceneKit only uses up to eight light sources per node when rendering, ignoring any additional lights. If you set the attenuationEndDistance property on a spotlight or omnidirectional light to limit its area of effect, SceneKit ignores the light (and its performance cost) when rendering objects outside that area. You can also use the categoryBitMask property to choose which nodes are illuminated by a light.
Requires MacOS 10.8 or newer.
- 27 properties
- property attenuationEndDistance as Double
- property attenuationFalloffExponent as Double
- property attenuationStartDistance as Double
- property automaticallyAdjustsShadowProjection as Boolean
- property CastsShadow as Boolean
- property Color as NSColorMBS
- property ForcesBackFaceCasters as Boolean
- property gobo as SCNMaterialPropertyMBS
- property Handle as Integer
- property Intensity as Double
- property maximumShadowDistance as Double
- property Name as String
- property OrthographicScale as Double
- property SampleDistributedShadowMaps as Boolean
- property ShadowBias as Double
- property ShadowCascadeCount as Integer
- property ShadowCascadeSplittingFactor as Double
- property shadowColor as NSColorMBS
- property ShadowMode as Integer
- property ShadowRadius as Double
- property ShadowSampleCount as Integer
- property spotInnerAngle as Double
- property spotOuterAngle as Double
- property Temperature as Double
- property Type as String
- property zFar as Double
- property zNear as Double
- 2 methods
- 7 shared methods
- 3 constants
SceneKit renders shadows in a postprocessing pass.
In the mode, SceneKit blends shadows into the final image after the main rendering pass, so shadows can be of any color.
SceneKit renders shadows during lighting computations.
In this mode, the color components of the light’s shadowColor property do not apply. The color’s alpha component determines the intensity of shadows.
SceneKit renders shadows by projecting the light’s gobo image. The light does not illuminate the scene.
Typically, you use this mode to create a low-accuracy, high-performance shadow under a game character or similar scene element: Use an image of a radial gradient (black to white) for the light’s gobo property, and use categoryBitMask properties to prevent the shadow image from appearing on the character.
This class has no sub classes.
Some properties using for this class:
- SCNNodeMBS.Light as SCNLightMBS
Some examples which use this class:
The items on this page are in the following plugins: MBS Mac64bit Plugin.
MBS Xojo Plugins