RenderableModel
Inherits Renderable
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
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. |
|
Value of type ‘File’ |
No |
|
A multiplier for ambient lighting. |
|
Value of type ‘Double’ |
Yes |
|
The mode of how the animation should be played back. Default is that the animation is played back once at the start time. |
|
In list { Once, LoopFromStart, LoopInfinitely, BounceFromStart, BounceInfinitely } |
Yes |
|
The date and time that the model animation should start. In format |
|
Value of type ‘Date and time’ |
Yes |
|
The time scale for the animation relative to seconds. For example, if the animation is in milliseconds then |
|
In list { Nanosecond, Microsecond, Millisecond, Second, Minute }, or Value of type ‘Double’ |
Yes |
|
Controls the blending function used to calculate the colors of the model with respect to the opacity. |
|
Value of type ‘String’ |
Yes |
|
A multiplier for diffuse lighting. |
|
Value of type ‘Double’ |
Yes |
|
Enable or disable the animation for the model if it has any. |
|
Value of type ‘Boolean’ |
Yes |
|
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. |
|
Value of type ‘Boolean’ |
Yes |
|
Enable OpenGL automatic face culling optimization. |
|
Value of type ‘Boolean’ |
Yes |
|
Set if invisible parts (parts with no textures or materials) of the model should be forced to render or not. |
|
Value of type ‘Boolean’ |
Yes |
|
The path to a fragment shader program to use instead of the default shader. |
|
Value of type ‘File’ |
Yes |
|
By default the given |
|
Value of type ‘Boolean’ |
Yes |
|
A list of light sources that this model should accept light from. |
|
Yes |
|
|
The scale of the model. For example, if the model is in centimeters then |
|
In list { Nanometer, Micrometer, Millimeter, Centimeter, Decimeter, Meter, Kilometer, Thou, Inch, Foot, Yard, Chain, Furlong, Mile }, or Value of type ‘Double’ |
Yes |
|
An extra model transform matrix that is applied to the model before all other transformations are applied. |
|
Value of type ‘Matrix4x4 |
Yes |
|
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. |
|
Value of type ‘Boolean’ |
Yes |
|
A vector that moves the place of origin for the model. |
|
Value of type ‘Vector3 |
Yes |
|
A rotation vector with Euler angles, specified in degrees. |
|
Value of type ‘Vector3 |
Yes |
|
A multiplier for specular lighting. |
|
Value of type ‘Double’ |
Yes |
|
The path to a vertex shader program to use instead of the default shader. |
|
Value of type ‘File’ |
Yes |
Inherited members from Renderable
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere. |
|
Value of type ‘Boolean’ |
Yes |
|
Determines whether this object will be visible or not. |
|
Value of type ‘Boolean’ |
Yes |
|
This value determines the opacity of this renderable. A value of 0 means completely transparent |
|
In range: ( 0,1 ) |
Yes |
|
A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step. |
|
In list { Background, Opaque, PreDeferredTransparent, PostDeferredTransparent, Overlay } |
Yes |
|
A single tag or a list of tags that this renderable will respond to when setting properties |
|
Value of type ‘Table’, or Value of type ‘String’ |
Yes |
|
The type of the renderable. |
|
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 |
---|---|---|---|---|
|
|
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]]