public final class SceneKit
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
SCNConsistencyElementIDErrorKey()
[@constant] SCNConsistencyElementIDErrorKey
|
static java.lang.String |
SCNConsistencyElementTypeErrorKey()
[@constant] SCNConsistencyElementTypeErrorKey
|
static java.lang.String |
SCNConsistencyLineNumberErrorKey()
[@constant] SCNConsistencyLineNumberErrorKey
|
static java.lang.String |
SCNDetailedErrorsKey()
[@constant] SCNDetailedErrorsKey
|
static java.lang.String |
SCNErrorDomain()
domain for errors from SceneKit API.
|
static void |
SCNExportJavaScriptModule(JSContext context)
[@function] SCNExportJavaScriptModule
|
static java.lang.String |
SCNGeometrySourceSemanticBoneIndices() |
static java.lang.String |
SCNGeometrySourceSemanticBoneWeights() |
static java.lang.String |
SCNGeometrySourceSemanticColor() |
static java.lang.String |
SCNGeometrySourceSemanticEdgeCrease() |
static java.lang.String |
SCNGeometrySourceSemanticNormal() |
static java.lang.String |
SCNGeometrySourceSemanticTangent() |
static java.lang.String |
SCNGeometrySourceSemanticTexcoord() |
static java.lang.String |
SCNGeometrySourceSemanticVertex() |
static java.lang.String |
SCNGeometrySourceSemanticVertexCrease() |
static java.lang.String |
SCNHitTestBackFaceCullingKey()
If set to YES ignores the faces not facing to the camera.
|
static java.lang.String |
SCNHitTestBoundingBoxOnlyKey()
If set to YES only tests the bounding boxes of the 3D objects.
|
static java.lang.String |
SCNHitTestClipToZRangeKey()
If set to YES ignores the objects clipped by the zNear/zFar range of the current point of view.
|
static java.lang.String |
SCNHitTestFirstFoundOnlyKey()
Deprecated, use SCNHitTestSearchModeAny for the SCNHitTestOptionSearchMode option instead
|
static java.lang.String |
SCNHitTestIgnoreChildNodesKey()
Determines whether the child nodes are ignored.
|
static java.lang.String |
SCNHitTestIgnoreHiddenNodesKey()
Determines whether hidden nodes should be ignored.
|
static java.lang.String |
SCNHitTestOptionCategoryBitMask()
Determines the node categories to test.
|
static java.lang.String |
SCNHitTestOptionIgnoreLightArea()
Determines whether the shape of an area light should not be taken into account.
|
static java.lang.String |
SCNHitTestOptionSearchMode()
Determines whether the search should be exhaustive.
|
static java.lang.String |
SCNHitTestRootNodeKey()
Specifies the root node to use for the hit test.
|
static java.lang.String |
SCNHitTestSortResultsKey()
Deprecated, use SCNHitTestSearchModeAll for the SCNHitTestOptionSearchMode option instead
|
static java.lang.String |
SCNLightingModelBlinn() |
static java.lang.String |
SCNLightingModelConstant() |
static java.lang.String |
SCNLightingModelLambert() |
static java.lang.String |
SCNLightingModelPhong() |
static java.lang.String |
SCNLightingModelPhysicallyBased() |
static java.lang.String |
SCNLightingModelShadowOnly() |
static java.lang.String |
SCNLightTypeAmbient()
Ambient light
|
static java.lang.String |
SCNLightTypeArea()
Area light
|
static java.lang.String |
SCNLightTypeDirectional()
Directional light
|
static java.lang.String |
SCNLightTypeIES()
IES light
|
static java.lang.String |
SCNLightTypeOmni()
Omnidirectional light
|
static java.lang.String |
SCNLightTypeProbe()
Light probe
|
static java.lang.String |
SCNLightTypeSpot()
Spot light
|
static boolean |
SCNMatrix4EqualToMatrix4(SCNMatrix4 a,
SCNMatrix4 b)
Returns true if 'a' is exactly equal to 'b'.
|
static SCNMatrix4 |
SCNMatrix4FromGLKMatrix4(GLKMatrix4 mat) |
static SCNMatrix4 |
SCNMatrix4Identity()
The identity matrix: [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1].
|
static SCNMatrix4 |
SCNMatrix4Invert(SCNMatrix4 m)
Invert 'm' and return the result.
|
static boolean |
SCNMatrix4IsIdentity(SCNMatrix4 m)
Returns true if 'm' is the identity matrix.
|
static SCNMatrix4 |
SCNMatrix4MakeRotation(float angle,
float x,
float y,
float z)
Returns a matrix that rotates by 'angle' radians about the vector '(x, y, z)'.
|
static SCNMatrix4 |
SCNMatrix4MakeScale(float sx,
float sy,
float sz)
Returns a transform that scales by '(sx, sy, sz)':
m' = [sx 0 0 0; 0 sy 0 0; 0 0 sz 0; 0 0 0 1].
|
static SCNMatrix4 |
SCNMatrix4MakeTranslation(float tx,
float ty,
float tz)
Returns a transform that translates by '(tx, ty, tz)':
m' = [1 0 0 0; 0 1 0 0; 0 0 1 0; tx ty tz 1].
|
static SCNMatrix4 |
SCNMatrix4Mult(SCNMatrix4 a,
SCNMatrix4 b)
Concatenate 'b' to 'a' and return the result: m' = a * b.
|
static SCNMatrix4 |
SCNMatrix4Rotate(SCNMatrix4 m,
float angle,
float x,
float y,
float z)
Rotate 'm' by 'angle' radians about the vector '(x, y, z)' and return the result:
* m' = rotation(angle, x, y, z) * m.
|
static SCNMatrix4 |
SCNMatrix4Scale(SCNMatrix4 m,
float sx,
float sy,
float sz)
Scale 'm' by '(sx, sy, sz)' and return the result:
m' = scale(sx, sy, sz) * m.
|
static GLKMatrix4 |
SCNMatrix4ToGLKMatrix4(SCNMatrix4 mat) |
static SCNMatrix4 |
SCNMatrix4Translate(SCNMatrix4 m,
float tx,
float ty,
float tz)
Translate 'm' by '(tx, ty, tz)' and return the result:
m' = translate(tx, ty, tz) * m.
|
static java.lang.String |
SCNModelTransform()
[@group] Rendering arguments
|
static java.lang.String |
SCNModelViewProjectionTransform() |
static java.lang.String |
SCNModelViewTransform() |
static java.lang.String |
SCNNormalTransform() |
static java.lang.String |
SCNParticlePropertyAngle()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyAngularVelocity()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyBounce()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyCharge()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyColor()
float4 : {r,g,b,a} controller animation type : {UIColor}
|
static java.lang.String |
SCNParticlePropertyContactNormal()
float3 not controllable
|
static java.lang.String |
SCNParticlePropertyContactPoint()
float3 not controllable
|
static java.lang.String |
SCNParticlePropertyFrame()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyFrameRate()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyFriction()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyLife()
float not controllable
|
static java.lang.String |
SCNParticlePropertyOpacity()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyPosition()
float3 : {x,y,z} controller animation type : {NSValue(SCNVector3)}
|
static java.lang.String |
SCNParticlePropertyRotationAxis()
float3 : {x,y,z} controller animation type : {NSValue(SCNVector3)}
|
static java.lang.String |
SCNParticlePropertySize()
float controller animation type : {NSNumber}
|
static java.lang.String |
SCNParticlePropertyVelocity()
float3 : {x,y,z} controller animation type : {NSValue(SCNVector3)}
|
static java.lang.String |
SCNPhysicsShapeKeepAsCompoundKey()
A boolean to decide if a hierarchy is kept as a compound of shapes or flattened as one single volume.
|
static java.lang.String |
SCNPhysicsShapeOptionCollisionMargin()
Collision margin of the physics shape (as an NSNumber)
|
static java.lang.String |
SCNPhysicsShapeScaleKey()
Local scaling of the physics shape (as an SCNVector3 wrapped in a NSValue)
|
static java.lang.String |
SCNPhysicsShapeTypeBoundingBox() |
static java.lang.String |
SCNPhysicsShapeTypeConcavePolyhedron() |
static java.lang.String |
SCNPhysicsShapeTypeConvexHull() |
static java.lang.String |
SCNPhysicsShapeTypeKey()
Type of the physics shape.
|
static java.lang.String |
SCNPhysicsTestBackfaceCullingKey()
Specifies whether the back faces should be ignored or not.
|
static java.lang.String |
SCNPhysicsTestCollisionBitMaskKey()
Allows to filter the objects tested by rayTest, contactTest and convexSweep.
|
static java.lang.String |
SCNPhysicsTestSearchModeAll()
All contacts are returned.
|
static java.lang.String |
SCNPhysicsTestSearchModeAny()
Returns the first contact found.
|
static java.lang.String |
SCNPhysicsTestSearchModeClosest()
Returns the nearest contact found only.
|
static java.lang.String |
SCNPhysicsTestSearchModeKey()
Specifies how to perform the ray/contact/sweep test.
|
static java.lang.String |
SCNPreferLowPowerDeviceKey()
[@constant] SCNViewOptionPreferLowPowerDevice Specifies if the renderer should prefer a low power Metal device.
|
static java.lang.String |
SCNPreferredDeviceKey()
[@constant] SCNViewOptionPreferredDevice Specifies the preferred Metal device to be used by the renderer.
|
static java.lang.String |
SCNPreferredRenderingAPIKey()
[@constant] SCNViewOptionPreferredRenderingAPI Specifies the preferred rendering API to be used by the renderer.
|
static java.lang.String |
SCNProgramMappingChannelKey()
This key is optional and may be used in association with the SCNGeometrySourceSemanticTexcoord semantic.
|
static java.lang.String |
SCNProjectionTransform() |
static java.lang.String |
SCNSceneEndTimeAttributeKey()
A floating point value, encapsulated in a NSNumber, containing the end time of the scene.
|
static java.lang.String |
SCNSceneExportDestinationURL()
[@constant] SCNSceneExportDestinationURL
|
static java.lang.String |
SCNSceneFrameRateAttributeKey()
A floating point value, encapsulated in a NSNumber, containing the framerate of the scene.
|
static java.lang.String |
SCNSceneSourceAnimationImportPolicyDoNotPlay()
[@constant] SCNSceneSourceAnimationImportPolicyDoNotPlay
|
static java.lang.String |
SCNSceneSourceAnimationImportPolicyKey()
[@constant] SCNSceneSourceAnimationImportPolicyKey
|
static java.lang.String |
SCNSceneSourceAnimationImportPolicyPlay()
[@constant] SCNSceneSourceAnimationImportPolicyPlay
|
static java.lang.String |
SCNSceneSourceAnimationImportPolicyPlayRepeatedly()
[@constant] SCNSceneSourceAnimationImportPolicyPlayRepeatedly
|
static java.lang.String |
SCNSceneSourceAnimationImportPolicyPlayUsingSceneTimeBase()
[@constant] SCNSceneSourceAnimationImportPolicyPlayUsingSceneTimeBase
|
static java.lang.String |
SCNSceneSourceAssetAuthoringToolKey()
[@group] Contributor dictionary keys
Authoring tool used to create the file.
|
static java.lang.String |
SCNSceneSourceAssetAuthorKey()
The file's author.
|
static java.lang.String |
SCNSceneSourceAssetContributorsKey()
[@group] Scene source properties
File contributors.
|
static java.lang.String |
SCNSceneSourceAssetCreatedDateKey()
When the file was created.
|
static java.lang.String |
SCNSceneSourceAssetDirectoryURLsKey()
[@constant] SCNSceneSourceAssetDirectoryURLsKey
|
static java.lang.String |
SCNSceneSourceAssetModifiedDateKey()
When the file was last modified.
|
static java.lang.String |
SCNSceneSourceAssetUnitKey()
The unit used in the file.
|
static java.lang.String |
SCNSceneSourceAssetUnitMeterKey()
A NSNumber encapsulating a floating-point value indicating how many meters the unit is.
|
static java.lang.String |
SCNSceneSourceAssetUnitNameKey()
[@group] Unit dictionary keys
The name (NSString) of the unit
|
static java.lang.String |
SCNSceneSourceAssetUpAxisKey()
The up axis of the file.
|
static java.lang.String |
SCNSceneSourceCheckConsistencyKey()
[@constant] SCNSceneSourceCheckConsistencyKey
|
static java.lang.String |
SCNSceneSourceConvertToYUpKey()
[@constant] SCNSceneSourceConvertToYUpKey
|
static java.lang.String |
SCNSceneSourceConvertUnitsToMetersKey()
[@constant] SCNSceneSourceConvertUnitsToMetersKey
|
static java.lang.String |
SCNSceneSourceCreateNormalsIfAbsentKey()
[@constant] SCNSceneSourceCreateNormalsIfAbsentKey
|
static java.lang.String |
SCNSceneSourceFlattenSceneKey()
[@constant] SCNSceneSourceFlattenSceneKey
|
static java.lang.String |
SCNSceneSourceLoadingOptionPreserveOriginalTopology()
[@constant] SCNSceneSourceLoadingOptionPreserveOriginalTopology
|
static java.lang.String |
SCNSceneSourceOverrideAssetURLsKey()
[@constant] SCNSceneSourceOverrideAssetURLsKey
|
static java.lang.String |
SCNSceneSourceStrictConformanceKey()
[@constant] SCNSceneSourceStrictConformanceKey
|
static java.lang.String |
SCNSceneSourceUseSafeModeKey()
[@constant] SCNSceneSourceUseSafeModeKey
|
static java.lang.String |
SCNSceneStartTimeAttributeKey()
A floating point value, encapsulated in a NSNumber, containing the start time of the scene.
|
static java.lang.String |
SCNSceneUpAxisAttributeKey()
A vector3 value, encapsulated in a NSValue, containing the up axis of the scene.
|
static java.lang.String |
SCNShaderModifierEntryPointFragment()
[@constant] SCNShaderModifierEntryPointFragment
|
static java.lang.String |
SCNShaderModifierEntryPointGeometry()
[@constant] SCNShaderModifierEntryPointGeometry
|
static java.lang.String |
SCNShaderModifierEntryPointLightingModel()
[@constant] SCNShaderModifierEntryPointLightingModel
|
static java.lang.String |
SCNShaderModifierEntryPointSurface()
[@constant] SCNShaderModifierEntryPointSurface
|
static boolean |
SCNVector3EqualToVector3(SCNVector3 a,
SCNVector3 b)
Returns true if 'a' is exactly equal to 'b'.
|
static SCNVector3 |
SCNVector3FromGLKVector3(GLKVector3 vector) |
static SCNVector3 |
SCNVector3Make(float x,
float y,
float z)
Returns an initialized SCNVector3
|
static GLKVector3 |
SCNVector3ToGLKVector3(SCNVector3 vector) |
static SCNVector3 |
SCNVector3Zero()
The null vector: [0 0 0].
|
static boolean |
SCNVector4EqualToVector4(SCNVector4 a,
SCNVector4 b)
Returns true if 'a' is exactly equal to 'b'.
|
static SCNVector4 |
SCNVector4FromGLKVector4(GLKVector4 vector) |
static SCNVector4 |
SCNVector4Make(float x,
float y,
float z,
float w)
Returns an initialized SCNVector4
|
static GLKVector4 |
SCNVector4ToGLKVector4(SCNVector4 vector) |
static SCNVector4 |
SCNVector4Zero()
The null vector: [0 0 0 0].
|
static java.lang.String |
SCNViewTransform() |
public static boolean SCNVector3EqualToVector3(SCNVector3 a, SCNVector3 b)
public static boolean SCNVector4EqualToVector4(SCNVector4 a, SCNVector4 b)
public static SCNVector3 SCNVector3Make(float x, float y, float z)
public static SCNVector4 SCNVector4Make(float x, float y, float z, float w)
public static boolean SCNMatrix4IsIdentity(SCNMatrix4 m)
public static boolean SCNMatrix4EqualToMatrix4(SCNMatrix4 a, SCNMatrix4 b)
public static SCNMatrix4 SCNMatrix4MakeTranslation(float tx, float ty, float tz)
public static SCNMatrix4 SCNMatrix4MakeScale(float sx, float sy, float sz)
public static SCNMatrix4 SCNMatrix4MakeRotation(float angle, float x, float y, float z)
public static SCNMatrix4 SCNMatrix4Translate(SCNMatrix4 m, float tx, float ty, float tz)
public static SCNMatrix4 SCNMatrix4Scale(SCNMatrix4 m, float sx, float sy, float sz)
public static SCNMatrix4 SCNMatrix4Rotate(SCNMatrix4 m, float angle, float x, float y, float z)
public static SCNMatrix4 SCNMatrix4Invert(SCNMatrix4 m)
public static SCNMatrix4 SCNMatrix4Mult(SCNMatrix4 a, SCNMatrix4 b)
public static SCNVector3 SCNVector3FromGLKVector3(GLKVector3 vector)
public static GLKVector3 SCNVector3ToGLKVector3(SCNVector3 vector)
public static SCNVector4 SCNVector4FromGLKVector4(GLKVector4 vector)
public static GLKVector4 SCNVector4ToGLKVector4(SCNVector4 vector)
public static GLKMatrix4 SCNMatrix4ToGLKMatrix4(SCNMatrix4 mat)
public static SCNMatrix4 SCNMatrix4FromGLKMatrix4(GLKMatrix4 mat)
public static void SCNExportJavaScriptModule(JSContext context)
Exports SceneKit's symbols (constants and class definition) into the specified JavaScript context.
SceneKit's classes, properties and constants are exported as global object with their original name. Selectors are exported using the rules defined in JavaScriptCore's JSExport.h.
For example to instanciate a node in JavaScript:
var aNode = SCNNode.node();
to change its opacity:
aNode.opacity = 0.5;
to remove from its parent node:
aNode.removeFromParentNode();
to animate a node opacity:
SCNTransaction.begin(); SCNTransaction.setAnimationDuration(1.0); aNode.opacity = 0.5; SCNTransaction.commit();
The following special objects are also exported:
class name constructor Objective-C class SCNColor SCNColor.color(r,g,b,a) NSColor CATimingFunction CATimingFunction.functionWithName(name) CATimingFunction CABasicAnimation CABasicAnimation.animationWithKeyPath(aPath) CABasicAnimation CAAnimationGroup new CAAnimationGroup() CAAnimationGroup CAKeyframeAnimation CAKeyframeAnimation.animationWithKeyPath(aPath) CAKeyframeAnimation SCNImage SCNImage.imageWithURL(aURL) NSImage / UIImage SCNImage.imageWithPath(aPath)
Vectors use this syntax: aNode.scale = {x:2, y:2, z:2};
Matrices use this syntax: aNode.transform = {m11:1, m12:0, m13:0 ... m44:1};
public static SCNVector3 SCNVector3Zero()
public static SCNVector4 SCNVector4Zero()
public static SCNMatrix4 SCNMatrix4Identity()
public static java.lang.String SCNErrorDomain()
public static java.lang.String SCNHitTestFirstFoundOnlyKey()
public static java.lang.String SCNHitTestSortResultsKey()
public static java.lang.String SCNHitTestClipToZRangeKey()
public static java.lang.String SCNHitTestBackFaceCullingKey()
public static java.lang.String SCNHitTestBoundingBoxOnlyKey()
public static java.lang.String SCNHitTestIgnoreChildNodesKey()
public static java.lang.String SCNHitTestRootNodeKey()
public static java.lang.String SCNHitTestIgnoreHiddenNodesKey()
public static java.lang.String SCNHitTestOptionCategoryBitMask()
public static java.lang.String SCNProgramMappingChannelKey()
public static java.lang.String SCNShaderModifierEntryPointGeometry()
This is the entry point to operate on the geometry vertices, for example deforming them.
It operates entirely in the vertex shader stage. It's input is the geometry structure:
Structures available from the SCNShaderModifierEntryPointGeometry entry point:
| struct SCNShaderGeometry { | float4 position; | float3 normal; | float4 tangent; | float4 color; | float2 texcoords[kSCNTexcoordCount]; | } _geometry; | | Access: ReadWrite | Stages: Vertex shader only
kSCNTexcoordCount is a constant integer set to the number of texture coordinates used.
All the geometric fields (position, normal and tangent) are in model space. You can use one of the provided automatic uniforms such as u_modelTransform or u_modelViewTransform if you want to operate in another space (but the results must stay in the model space, otherwise remaining computations won't be correct). The texture coordinates are the raw values found in the mesh, they have not been transformed yet by their optional contentsTransform. The contentsTransform if any is applied after the geometry shader modifier.
Example: Simple sinusoidal deformation
GLSL | uniform float Amplitude = 0.1; | | _geometry.position.xyz += _geometry.normal * (Amplitude * _geometry.position.y * _geometry.position.x) * sin(u_time);
Metal Shading Language | #pragma arguments | float Amplitude; | | _geometry.position.xyz += _geometry.normal * (Amplitude * _geometry.position.y * _geometry.position.x) * sin(scn_frame.time);
public static java.lang.String SCNShaderModifierEntryPointSurface()
This is the entry point to alter the surface representation of the material, before the lighting has taken place.
Structures available from the SCNShaderModifierEntryPointSurface entry point:
| struct SCNShaderSurface { | float3 view; // Direction from the point on the surface toward the camera (V) | float3 position; // Position of the fragment | float3 normal; // Normal of the fragment (N) | float3 geometryNormal; // Geometric normal of the fragment (normal map is ignored) | float3 tangent; // Tangent of the fragment | float3 bitangent; // Bitangent of the fragment | float4 ambient; // Ambient property of the fragment | float2 ambientTexcoord; // Ambient texture coordinates | float4 diffuse; // Diffuse property of the fragment. Alpha contains the opacity. | float2 diffuseTexcoord; // Diffuse texture coordinates | float4 specular; // Specular property of the fragment | float2 specularTexcoord; // Specular texture coordinates | float4 emission; // Emission property of the fragment | float2 emissionTexcoord; // Emission texture coordinates | float4 multiply; // Multiply property of the fragment | float2 multiplyTexcoord; // Multiply texture coordinates | float4 transparent; // Transparent property of the fragment | float2 transparentTexcoord; // Transparent texture coordinates | float4 reflective; // Reflective property of the fragment | float metalness; // Metalness property of the fragment | float2 metalnessTexcoord; // Metalness texture coordinates | float roughness; // Roughness property of the fragment | float2 roughnessTexcoord; // Roughness texture coordinates | float clearCoat; // Clear Coat property of the fragment. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float2 clearCoatTexcoord; // Clear Coat texture coordinates. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float clearCoatRoughness; // Clear Coat Roughness property of the fragment. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float2 clearCoatRoughnessTexcoord; // Clear Coat Roughness texture coordinates. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float3 clearCoatNormal; // Clear Coat Normal property of the fragment. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float2 clearCoatNormalTexcoord; // Clear Coat Normnal texture coordinates. Available since macOS 10.15, iOS 13, tvOS 13 and watchOS 6. | float4 selfIllumination; // Self Illumination property of the fragment. Available since macOS 10.13, iOS 11, tvOS 11 and watchOS 4. Available as `emission` in previous versions. | float2 selfIlluminationTexcoord; // Self Illumination texture coordinates. Available since macOS 10.13, iOS 11, tvOS 11 and watchOS 4. Available as `emissionTexcoord` in previous versions. | float ambientOcclusion; // Ambient Occlusion property of the fragment. Available since macOS 10.13, iOS 11, tvOS 11 and watchOS 4. Available as `multiply` in previous versions. | float2 ambientOcclusionTexcoord; // Ambient Occlusion texture coordinates. Available since macOS 10.13, iOS 11, tvOS 11 and watchOS 4. Available as `multiplyTexcoord` in previous versions. | float shininess; // Shininess property of the fragment | float fresnel; // Fresnel property of the fragment | } _surface; | | Access: ReadWrite | Stages: Fragment shader only
All geometric fields are in view space.
All the other properties will be colors (texture have already been sampled at this stage) or floats. You can however do an extra sampling of standard textures if you want.
In this case the naming pattern is u_
Example: Procedural black and white stripes
GLSL
| uniform float Scale = 12.0;
| uniform float Width = 0.25;
| uniform float Blend = 0.3;
|
| vec2 position = fract(_surface.diffuseTexcoord * Scale);
| float f1 = clamp(position.y / Blend, 0.0, 1.0);
| float f2 = clamp((position.y - Width) / Blend, 0.0, 1.0);
| f1 = f1 * (1.0 - f2);
| f1 = f1 * f1 * 2.0 * (3. * 2. * f1);
| _surface.diffuse = mix(vec4(1.0), vec4(0.0), f1);
Metal Shading Language
| #pragma arguments
| float Scale;
| float Width;
| float Blend;
|
| float2 position = fract(_surface.diffuseTexcoord * Scale);
| float f1 = clamp(position.y / Blend, 0.0, 1.0);
| float f2 = clamp((position.y - Width) / Blend, 0.0, 1.0);
| f1 = f1 * (1.0 - f2);
| f1 = f1 * f1 * 2.0 * (3. * 2. * f1);
| _surface.diffuse = mix(float4(1.0), float4(0.0), f1);
public static java.lang.String SCNShaderModifierEntryPointLightingModel()
This is the entry point to provide custom lighting equation. The fragment will be called for each active light of the scene and will need to accumulate lighting contribution for the vertex or the fragment in the _lightingContribution structure, using the light structure given.
Structures available from the SCNShaderModifierEntryPointLightingModel entry point:
| All the structures available from the SCNShaderModifierEntryPointSurface entry point | | Access: ReadOnly | Stages: Vertex shader and fragment shader
| struct SCNShaderLightingContribution { | float3 ambient; | float3 diffuse; | float3 specular; | } _lightingContribution; | | Access: ReadWrite | Stages: Vertex shader and fragment shader
| struct SCNShaderLight { | float4 intensity; | float3 direction; // Direction from the point on the surface toward the light (L) | } _light; | | Access: ReadOnly | Stages: Vertex shader and fragment shader
Example: Wrap diffuse lighting
GLSL | uniform float WrapFactor = 0.5; | | float dotProduct = (WrapFactor + max(0.0, dot(_surface.normal,_light.direction))) / (1 + WrapFactor); | _lightingContribution.diffuse += (dotProduct * _light.intensity.rgb); | vec3 halfVector = normalize(_light.direction + _surface.view); | dotProduct = max(0.0, pow(max(0.0, dot(_surface.normal, halfVector)), _surface.shininess)); | _lightingContribution.specular += (dotProduct * _light.intensity.rgb);
Metal Shading Language | #pragma arguments | float WrapFactor; | | float dotProduct = (WrapFactor + max(0.0, dot(_surface.normal,_light.direction))) / (1 + WrapFactor); | _lightingContribution.diffuse += (dotProduct * _light.intensity.rgb); | float3 halfVector = normalize(_light.direction + _surface.view); | dotProduct = max(0.0, pow(max(0.0, dot(_surface.normal, halfVector)), _surface.shininess)); | _lightingContribution.specular += (dotProduct * _light.intensity.rgb);
public static java.lang.String SCNShaderModifierEntryPointFragment()
This is the last entry point in the fragment shader, where you can alter the final color returned by the shader.
You can alter the final color by reading and writing to the output color via the output structure below.
Structures available from the SCNShaderModifierEntryPointFragment entry point:
| All the structures available from the SCNShaderModifierEntryPointSurface entry point | | Access: ReadOnly | Stages: Fragment shader only
| struct SCNShaderOutput { | float4 color; | } _output; | | Access: ReadWrite | Stages: Fragment shader only
Example: Inverse final color
GLSL | _output.color.rgb = vec3(1.0) - _output.color.rgb;
Metal Shading Language | _output.color.rgb = 1.0 - _output.color.rgb;
public static java.lang.String SCNPreferredRenderingAPIKey()
Pass it as the key in the options dictionary given to initWithFrame:options:. The value is a NSNumber wrapping a SCNRenderingAPI. You can also select the preferred rendering API directly from the SCNView inspector in InterfaceBuilder.
public static java.lang.String SCNPreferredDeviceKey()
The value is directly a id
public static java.lang.String SCNPreferLowPowerDeviceKey()
The value is a NSNumber wrapping a BOOL. Defaults to NO.
public static java.lang.String SCNSceneSourceAssetContributorsKey()
public static java.lang.String SCNSceneSourceAssetCreatedDateKey()
public static java.lang.String SCNSceneSourceAssetModifiedDateKey()
public static java.lang.String SCNSceneSourceAssetUpAxisKey()
public static java.lang.String SCNSceneSourceAssetUnitKey()
public static java.lang.String SCNSceneSourceAssetAuthoringToolKey()
public static java.lang.String SCNSceneSourceAssetAuthorKey()
public static java.lang.String SCNSceneSourceAssetUnitNameKey()
public static java.lang.String SCNSceneSourceAssetUnitMeterKey()
public static java.lang.String SCNSceneSourceCreateNormalsIfAbsentKey()
Enable to try to guess acceptable normals for the vertices if none are given in the file
Use this with a boolean value encapsulated in a NSNumber. The default value is NO.
public static java.lang.String SCNSceneSourceCheckConsistencyKey()
Pass YES in order to perform the document validation.
This option can be set in the options dictionary of the SCNScene and SCNSceneSource loading methods. The value for this option should be a boolean NSNumber. If its boolean value is YES (the default is NO), SceneKit will attempt to check the document for consistency. If the document doesn't pass the consistency check it is then not loaded and an error is returned. This is slower, but for security reasons it should be set to YES if you are not sure the files you load are valid and have not been tampered with.
public static java.lang.String SCNSceneSourceFlattenSceneKey()
Pass YES to flatten the scene graph when possible.
This option can be set in the options dictionary of the SCNScene and SCNSceneSource loading methods. The value for this option should be a boolean NSNumber. If its boolean value is YES (the default is NO), SceneKit will attempt to reduce the scene graph by merging the geometries. This option is suitable to preview a 3D scene efficiently and when manipulating the scene graph is not needed.
public static java.lang.String SCNSceneSourceUseSafeModeKey()
Pass YES in order to enable the safe mode.
This option can be set in the options dictionary of the SCNScene and SCNSceneSource loading methods. The value for this option should be a boolean NSNumber. If its boolean value is YES (the default is NO), SceneKit will forbid network accesses, prevent the loading of resources from arbitrary directories, and will not execute any code present in the loaded files.
public static java.lang.String SCNSceneSourceAssetDirectoryURLsKey()
Pass an array of directory URLs where SceneKit should look for resources
By default, SceneKit will look for the external resources it cannot find in the parent directory of the imported file. You can add additional directories by setting an array of URLs for this key when calling sceneWithOptions:error:. This is recommended if you want to construct your scene source from a data object, not from an URL, and need to load resources whose paths are not absolute.
public static java.lang.String SCNSceneSourceOverrideAssetURLsKey()
Pass YES in order to override assets URLs with the directory URLs passed via SCNSceneSourceAssetDirectoryURLsKey.
By default, SceneKit will look for the external resources using the paths/urls as described in the imported file. You can force SceneKit to only search for extern resources within the directories specified by the SCNSceneSourceAssetDirectoryURLsKey key. This can be useful to load a file and its resources from a specific bundle for instance.
public static java.lang.String SCNSceneSourceStrictConformanceKey()
Pass YES to interpret the 3D format of the file in a strict way.
This option defaults to NO. In this case SceneKit will try to read any additional metadata present in the file to enable additional features and make the rendering as close as possible to the original intent. If you pass YES, SceneKit will instead only consider features which are part of the file format specification.
public static java.lang.String SCNSceneSourceAnimationImportPolicyKey()
Pass one of the value below to specify what to do with loaded animations.
See below for the description of each individual key. Defaults to SCNSceneSourceAnimationImportPolicyPlayRepeatedly. On 10.9 and before the behavior is SCNSceneSourceAnimationImportPolicyPlayUsingSceneTimeBase. For compatibility reason if the application was built on 10.9 or before the default behavior is SCNSceneSourceAnimationImportPolicyPlayUsingSceneTimeBase.
public static java.lang.String SCNSceneSourceLoadingOptionPreserveOriginalTopology()
Pass YES to make SceneKit preserve the original topology instead of triangulating at load time. This can be useful to get better results when subdividing a geometry.
Defaults to YES starting macOS 10.15, iOS 13, tvOS 13 and watchOS 6. Defaults to NO in previous versions.
public static java.lang.String SCNSceneSourceAnimationImportPolicyPlay()
Add animations to the scene and play them once (repeatCount set to 1).
public static java.lang.String SCNSceneSourceAnimationImportPolicyPlayRepeatedly()
Add animations to the scene and play them repeatedly (repeatCount set to infinity).
public static java.lang.String SCNSceneSourceAnimationImportPolicyDoNotPlay()
Only keep animations in the SCNSceneSource and don't add to the animatable elements of the scene.
public static java.lang.String SCNSceneSourceAnimationImportPolicyPlayUsingSceneTimeBase()
Add animations to the scene and play them using the SCNView/SCNRenderer's scene time (usesSceneTimeBase set to YES)
public static java.lang.String SCNDetailedErrorsKey()
Key to access the detailed validation errors.
This key will be present in the user info dictionary of errors created by the various sceneWithOptions: methods. When present, the value associated with it is an array of detailed errors found by the consistency checker which represent consistency errors in the 3D file. Some metadata about these detailed errors is available in their user info dictionary using the other keys (SCNConsistency*) defined in this file.
public static java.lang.String SCNConsistencyElementIDErrorKey()
For XML-based formats, the ID of the element where the error occurred.
When the element does not have an ID, the ID of the closest parent element which has one is returned.
public static java.lang.String SCNConsistencyElementTypeErrorKey()
For XML-based formats, the tag name of the element where the error occurred.
public static java.lang.String SCNConsistencyLineNumberErrorKey()
For text-based formats, the line number where an error occurred.
public static java.lang.String SCNSceneExportDestinationURL()
Specifies the final destination (as a NSURL) of the scene being exported.
The destination URL is required if the scene is exported to a temporary directory and then moved to a final destination. This enables the exported document to get correct relative paths to referenced images.
public static java.lang.String SCNSceneStartTimeAttributeKey()
public static java.lang.String SCNSceneEndTimeAttributeKey()
public static java.lang.String SCNSceneFrameRateAttributeKey()
public static java.lang.String SCNSceneUpAxisAttributeKey()
public static java.lang.String SCNModelTransform()
These keys are used for the 'semantic' argument of -[SCNProgram setSemantic:forSymbol:options:] Transforms are SCNMatrix4 wrapped in NSValues.
public static java.lang.String SCNViewTransform()
public static java.lang.String SCNProjectionTransform()
public static java.lang.String SCNNormalTransform()
public static java.lang.String SCNModelViewTransform()
public static java.lang.String SCNModelViewProjectionTransform()
public static java.lang.String SCNLightTypeAmbient()
public static java.lang.String SCNLightTypeOmni()
public static java.lang.String SCNLightTypeDirectional()
public static java.lang.String SCNLightTypeSpot()
public static java.lang.String SCNLightTypeIES()
public static java.lang.String SCNLightTypeProbe()
public static java.lang.String SCNLightingModelPhong()
public static java.lang.String SCNLightingModelBlinn()
public static java.lang.String SCNLightingModelLambert()
public static java.lang.String SCNLightingModelConstant()
public static java.lang.String SCNLightingModelPhysicallyBased()
public static java.lang.String SCNGeometrySourceSemanticVertex()
public static java.lang.String SCNGeometrySourceSemanticNormal()
public static java.lang.String SCNGeometrySourceSemanticColor()
public static java.lang.String SCNGeometrySourceSemanticTexcoord()
public static java.lang.String SCNGeometrySourceSemanticTangent()
public static java.lang.String SCNGeometrySourceSemanticVertexCrease()
public static java.lang.String SCNGeometrySourceSemanticEdgeCrease()
public static java.lang.String SCNGeometrySourceSemanticBoneWeights()
public static java.lang.String SCNGeometrySourceSemanticBoneIndices()
public static java.lang.String SCNParticlePropertyPosition()
public static java.lang.String SCNParticlePropertyAngle()
public static java.lang.String SCNParticlePropertyRotationAxis()
public static java.lang.String SCNParticlePropertyVelocity()
public static java.lang.String SCNParticlePropertyAngularVelocity()
public static java.lang.String SCNParticlePropertyLife()
public static java.lang.String SCNParticlePropertyColor()
public static java.lang.String SCNParticlePropertyOpacity()
public static java.lang.String SCNParticlePropertySize()
public static java.lang.String SCNParticlePropertyFrame()
public static java.lang.String SCNParticlePropertyFrameRate()
public static java.lang.String SCNParticlePropertyBounce()
public static java.lang.String SCNParticlePropertyCharge()
public static java.lang.String SCNParticlePropertyFriction()
public static java.lang.String SCNParticlePropertyContactPoint()
public static java.lang.String SCNParticlePropertyContactNormal()
public static java.lang.String SCNPhysicsShapeTypeKey()
public static java.lang.String SCNPhysicsShapeKeepAsCompoundKey()
public static java.lang.String SCNPhysicsShapeScaleKey()
public static java.lang.String SCNPhysicsShapeOptionCollisionMargin()
public static java.lang.String SCNPhysicsShapeTypeBoundingBox()
public static java.lang.String SCNPhysicsShapeTypeConvexHull()
public static java.lang.String SCNPhysicsShapeTypeConcavePolyhedron()
public static java.lang.String SCNPhysicsTestCollisionBitMaskKey()
public static java.lang.String SCNPhysicsTestSearchModeKey()
public static java.lang.String SCNPhysicsTestBackfaceCullingKey()
public static java.lang.String SCNPhysicsTestSearchModeAny()
public static java.lang.String SCNPhysicsTestSearchModeClosest()
public static java.lang.String SCNPhysicsTestSearchModeAll()
public static java.lang.String SCNHitTestOptionSearchMode()
public static java.lang.String SCNSceneSourceConvertUnitsToMetersKey()
Pass the units you want the scene to be converted to (in meter).
Use this with a floating value encapsulated in a NSNumber. The default value is nil which means no conversion done. Passing a non-zero value will convert the scene coordinates so that 1 unit corresponds to N meters. For example pass 0.01 for 1 unit == 1 centimeter, pass 0.3048 for 1 unit == 1 foot... For better physics simulation it is recommended to use 1 unit equals to 1 meter. This option has no effect for SCN files or if the asset is already compressed by Xcode (use the compression options instead).
public static java.lang.String SCNSceneSourceConvertToYUpKey()
Pass YES if a scene should be converted to Y up if it currently has a different up axis.
Use this with a boolean value encapsulated in a NSNumber. The default value is NO. This option has no effect for SCN files or if the asset is already compressed by Xcode (use the compression options instead).
public static java.lang.String SCNHitTestOptionIgnoreLightArea()
public static java.lang.String SCNLightTypeArea()
public static java.lang.String SCNLightingModelShadowOnly()