RenderableModel

Inherits Renderable

Members

Name

Documentation

Type

Description

Optional

GeometryFile

The file or files that should be loaded in this RenderableModel. The file can contain filesystem tokens. This specifies the model that is rendered by the Renderable.

File

Value of type ‘File’

No

AmbientIntensity

A multiplier for ambient lighting.

Double

Value of type ‘Double’

Yes

AnimationMode

The mode of how the animation should be played back. Default is that the animation is played back once at the start time.

String

In list { Once, LoopFromStart, LoopInfinitely, BounceFromStart, BounceInfinitely }

Yes

AnimationStartTime

The date and time that the model animation should start. In format 'YYYY MM DD hh:mm:ss'.

Date and time

Value of type ‘Date and time’

Yes

AnimationTimeScale

The time scale for the animation relative to seconds. For example, if the animation is in milliseconds then AnimationTimeScale = 0.001 or AnimationTimeScale = "Millisecond".

String, or Double

In list { Nanosecond, Microsecond, Millisecond, Second, Minute }, or Value of type ‘Double’

Yes

BlendingOption

Controls the blending function used to calculate the colors of the model with respect to the opacity.

String

Value of type ‘String’

Yes

DiffuseIntensity

A multiplier for diffuse lighting.

Double

Value of type ‘Double’

Yes

EnableAnimation

Enable or disable the animation for the model if it has any.

Boolean

Value of type ‘Boolean’

Yes

EnableDepthTest

If true, depth testing is enabled for the model. This means that parts of the model that are occluded by other parts will not be rendered. If disabled, the depth of the model part will not be taken into account in rendering and some parts that should be hidden behind a model might be rendered in front.

Boolean

Value of type ‘Boolean’

Yes

EnableFaceCulling

Enable OpenGL automatic face culling optimization.

Boolean

Value of type ‘Boolean’

Yes

ForceRenderInvisible

Set if invisible parts (parts with no textures or materials) of the model should be forced to render or not.

Boolean

Value of type ‘Boolean’

Yes

FragmentShader

The path to a fragment shader program to use instead of the default shader.

File

Value of type ‘File’

Yes

InvertModelScale

By default the given ModelScale is used to scale down the model. By setting this setting to true the scaling is inverted to that the model is instead scaled up with the given ModelScale.

Boolean

Value of type ‘Boolean’

Yes

LightSources

A list of light sources that this model should accept light from.

Table

Table parameters

Yes

ModelScale

The scale of the model. For example, if the model is in centimeters then ModelScale = 'Centimeter' or ModelScale = 0.01. The value that this needs to be in order for the model to be in the correct scale relative to the rest of OpenSpace can be tricky to find. Essentially, it depends on the model software that the model was created with and the original intention of the modeler.

String, or Double

In list { Nanometer, Micrometer, Millimeter, Centimeter, Decimeter, Meter, Kilometer, Thou, Inch, Foot, Yard, Chain, Furlong, Mile }, or Value of type ‘Double’

Yes

ModelTransform

An extra model transform matrix that is applied to the model before all other transformations are applied.

Matrix4x4<double>

Value of type ‘Matrix4x4

Yes

PerformShading

Determines whether shading should be applied to this model, based on the provided list of light sources. If false, the model will be fully illuminated.

Boolean

Value of type ‘Boolean’

Yes

Pivot

A vector that moves the place of origin for the model.

Vector3<double>

Value of type ‘Vector3

Yes

RotationVector

A rotation vector with Euler angles, specified in degrees.

Vector3<double>

Value of type ‘Vector3

Yes

SpecularIntensity

A multiplier for specular lighting.

Double

Value of type ‘Double’

Yes

VertexShader

The path to a vertex shader program to use instead of the default shader.

File

Value of type ‘File’

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent

Double

In range: ( 0,1 )

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, PostDeferredTransparent, Overlay }

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

Table parameters for LightSources

A list of light sources that this model should accept light from.

  • Optional: Yes

Name

Documentation

Type

Description

Optional

*

Table

LightSource

Yes

Asset Examples

Basic

This example loads a model.

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17  },
18  GUI = {
19    Name = "RenderableModel - Basic",
20    Path = "/Examples"
21  }
22}
23
24asset.onInitialize(function()
25  openspace.addSceneGraphNode(Node)
26end)
27
28asset.onDeinitialize(function()
29  openspace.removeSceneGraphNode(Node)
30end)
31
32
33-- Model credit
34--[[
35  Author = Cesium, https://cesium.com/
36  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
37  License =
38    Creative Commons Attribution 4.0 International License,
39    https://creativecommons.org/licenses/by/4.0/
40]]
Lighting

This example loads a model and load the Sun to illuminate it.

 1-- Load the asset of the Sun to illuminate the model
 2local sun = asset.require("scene/solarsystem/sun/transforms")
 3
 4-- Load the example model from OpenSpace servers
 5-- If you want to use your own model, this block of code can be safely deleted
 6local model = asset.resource({
 7  Name = "Animated Box",
 8  Type = "HttpSynchronization",
 9  Identifier = "animated_box",
10  Version = 1
11})
12
13local Node = {
14  Identifier = "RenderableModel_Example_Lighting",
15  Renderable = {
16    Type = "RenderableModel",
17    GeometryFile = model .. "BoxAnimated.glb",
18    -- Use the line below insted of the one above if you want to use your own model
19    --GeometryFile = "C:/path/to/model.fbx",
20
21    -- Add the Sun as a light source to illuminate the model
22    LightSources = {
23      sun.LightSource
24    }
25  },
26  GUI = {
27    Name = "RenderableModel - Lighting",
28    Path = "/Examples"
29  }
30}
31
32asset.onInitialize(function()
33  openspace.addSceneGraphNode(Node)
34end)
35
36asset.onDeinitialize(function()
37  openspace.removeSceneGraphNode(Node)
38end)
39
40
41-- Model credit
42--[[
43  Author = Cesium, https://cesium.com/
44  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
45  License =
46    Creative Commons Attribution 4.0 International License,
47    https://creativecommons.org/licenses/by/4.0/
48]]
Vertex Colors

This example loads a model with vertex colors as material.

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Vertex Colors Test Model",
 5  Type = "HttpSynchronization",
 6  Identifier = "model_vertex_color_test",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Vertex_Colors",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "VertexColorTest.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17  },
18  GUI = {
19    Name = "RenderableModel - Vertex Colors",
20    Path = "/Examples"
21  }
22}
23
24asset.onInitialize(function()
25  openspace.addSceneGraphNode(Node)
26end)
27
28asset.onDeinitialize(function()
29  openspace.removeSceneGraphNode(Node)
30end)
31
32
33-- Model credit
34--[[
35  Author = Ed Mackey
36  URL = "https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/VertexColorTest"
37  License =
38    Creative Commons Attribution 4.0 International License,
39    https://creativecommons.org/licenses/by/4.0/
40]]
Animation Loop Infinitely

This example loads a model with an animation. The animation starts at a set time, in this case “2024 07 09 12:00:00” and is set to loop both before and after that time.

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Animation_Loop_Infinitely",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17
18    -- Animation Parameters:
19    EnableAnimation = true,
20    -- Start the animation and play it once at this time
21    AnimationStartTime = "2024 07 09 12:00:00",
22    -- Loop the animation both before and after the set start time
23    AnimationMode = "LoopInfinitely",
24  },
25  GUI = {
26    Name = "RenderableModel - Animation Loop Infinitely",
27    Path = "/Examples"
28  }
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node)
33end)
34
35asset.onDeinitialize(function()
36  openspace.removeSceneGraphNode(Node)
37end)
38
39
40-- Model credit
41--[[
42  Author = Cesium, https://cesium.com/
43  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
44  License =
45    Creative Commons Attribution 4.0 International License,
46    https://creativecommons.org/licenses/by/4.0/
47]]
Animation Loop From Start

This example loads a model with an animation. The animation starts at a set time, in this case “2024 07 09 12:00:00” and is set to loop after that time.

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Animation_Loop",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17
18    -- Animation Parameters:
19    EnableAnimation = true,
20    -- Start the animation and play it once at this time
21    AnimationStartTime = "2024 07 09 12:00:00",
22    -- Loop the animation after the set start time
23    AnimationMode = "LoopFromStart",
24  },
25  GUI = {
26    Name = "RenderableModel - Animation Loop From Start",
27    Path = "/Examples"
28  }
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node)
33end)
34
35asset.onDeinitialize(function()
36  openspace.removeSceneGraphNode(Node)
37end)
38
39
40-- Model credit
41--[[
42  Author = Cesium, https://cesium.com/
43  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
44  License =
45    Creative Commons Attribution 4.0 International License,
46    https://creativecommons.org/licenses/by/4.0/
47]]
Animation Bounce From Start

This example loads a model with an animation. The animation starts at a set time, in this case “2024 07 09 12:00:00” and is set to bounce after that time (bounce is similar to a boomerang for videos).

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Animation_Bounce",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17
18    -- Animation Parameters:
19    EnableAnimation = true,
20    -- Start the animation and play it once at this time
21    AnimationStartTime = "2024 07 09 12:00:00",
22    -- Bounce the animation after the set start time
23    AnimationMode = "BounceFromStart",
24  },
25  GUI = {
26    Name = "RenderableModel - Animation Bounce From Start",
27    Path = "/Examples"
28  }
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node)
33end)
34
35asset.onDeinitialize(function()
36  openspace.removeSceneGraphNode(Node)
37end)
38
39
40-- Model credit
41--[[
42  Author = Cesium, https://cesium.com/
43  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
44  License =
45    Creative Commons Attribution 4.0 International License,
46    https://creativecommons.org/licenses/by/4.0/
47]]
Animation Bounce Infinitely

This example loads a model with an animation. The animation starts at a set time, in this case “2024 07 09 12:00:00” and is set to bounce both before and after that time (bounce is similar to a boomerang for videos).

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Animation_Bounce_Infinitely",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17
18    -- Animation Parameters:
19    EnableAnimation = true,
20    -- Start the animation and play it once at this time
21    AnimationStartTime = "2024 07 09 12:00:00",
22    -- Bounce the animation both before and after the set start time
23    AnimationMode = "BounceInfinitely",
24  },
25  GUI = {
26    Name = "RenderableModel - Animation Bounce Infinitely",
27    Path = "/Examples"
28  }
29}
30
31asset.onInitialize(function()
32  openspace.addSceneGraphNode(Node)
33end)
34
35asset.onDeinitialize(function()
36  openspace.removeSceneGraphNode(Node)
37end)
38
39
40-- Model credit
41--[[
42  Author = Cesium, https://cesium.com/
43  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
44  License =
45    Creative Commons Attribution 4.0 International License,
46    https://creativecommons.org/licenses/by/4.0/
47]]
Animation

This example loads a model with an animation. The animation starts at a set time, in this case “2024 07 09 12:00:00”.

 1-- Load the example model from OpenSpace servers
 2-- If you want to use your own model, this block of code can be safely deleted
 3local model = asset.resource({
 4  Name = "Animated Box",
 5  Type = "HttpSynchronization",
 6  Identifier = "animated_box",
 7  Version = 1
 8})
 9
10local Node = {
11  Identifier = "RenderableModel_Example_Animation",
12  Renderable = {
13    Type = "RenderableModel",
14    GeometryFile = model .. "BoxAnimated.glb",
15    -- Use the line below insted of the one above if you want to use your own model
16    --GeometryFile = "C:/path/to/model.fbx",
17
18    -- Animation Parameters:
19    EnableAnimation = true,
20    -- Start the animation and play it once at this time
21    AnimationStartTime = "2024 07 09 12:00:00",
22  },
23  GUI = {
24    Name = "RenderableModel - Basic Animation",
25    Path = "/Examples"
26  }
27}
28
29asset.onInitialize(function()
30  openspace.addSceneGraphNode(Node)
31end)
32
33asset.onDeinitialize(function()
34  openspace.removeSceneGraphNode(Node)
35end)
36
37
38-- Model credit
39--[[
40  Author = Cesium, https://cesium.com/
41  URL = https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
42  License =
43    Creative Commons Attribution 4.0 International License,
44    https://creativecommons.org/licenses/by/4.0/
45]]