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 animation is played back once at the start time. For a more detailed description see: http://wiki.openspaceproject.com/docs/builders/model-animation

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. Ex, if animation is in milliseconds then AnimationTimeScale = 0.001 or AnimationTimeScale = Millisecond, default is Second

String, or Double

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

Yes

BlendingOption

Changes 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

Enable Depth Testing for the Model

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 the fragment shader program that is used instead of the default shader.

File

Value of type ‘File’

Yes

InvertModelScale

By default the given ModelScale is used to scale the model down, by setting this setting to true 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. For more information see our wiki page for this parameter: http://wiki.openspaceproject.com/docs/builders/models/model-scale.html

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

This value specifies the model transform that is applied to the model before all other transformations are applied

Matrix4x4<double>

Value of type ‘Matrix4x4

Yes

PerformShading

This value determines whether this model should be shaded by using the position of the Sun

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

Rotation Vector using degrees

Vector3<double>

Value of type ‘Vector3

Yes

SpecularIntensity

A multiplier for specular lighting

Double

Value of type ‘Double’

Yes

VertexShader

The path to the vertex shader program that is used instead of the default shader.

File

Value of type ‘File’

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Enables/Disables if the object should be dimmed when the camera is in the sunny part of an atmosphere

Boolean

Value of type ‘Boolean’

Yes

Enabled

This setting 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

This value specifies if the renderable should be rendered in the Background,Opaque, Pre/PostDeferredTransparency, or Overlay 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

This tells 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

 1local sun = asset.require("scene/solarsystem/sun/sun")
 2local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
 3
 4
 5
 6local model = asset.resource({
 7  Name = "Animated Box",
 8  Type = "HttpSynchronization",
 9  Identifier = "animated_box",
10  Version = 1
11})
12
13
14local Model = {
15  Identifier = "ModelShader",
16  Parent = transforms.EarthCenter.Identifier,
17  Transform = {
18    Translation = {
19      Type = "StaticTranslation",
20      Position = { -11E7, 0.0, 0.0 }
21    }
22  },
23  Renderable = {
24    Type = "RenderableModel",
25    GeometryFile = model .. "BoxAnimated.glb",
26    ModelScale = 3E7,
27    -- (malej 2023-MAY-22) Note that PerformShading should be false in this example,
28    -- these example shaders dont't contain any light calculations
29    PerformShading = false,
30    VertexShader = asset.resource("model_vs.glsl"),
31    FragmentShader = asset.resource("model_fs.glsl"),
32    EnableAnimation = true,
33    AnimationStartTime = "2023 05 11 00:00:00",
34    AnimationTimeScale = "Second",
35    AnimationMode = "LoopInfinitely"
36  },
37  GUI = {
38    Name = "Model Shader",
39    Path = "/Example",
40    Description = "Simple box model with a custom shader"
41  }
42}
43
44
45asset.onInitialize(function()
46  openspace.addSceneGraphNode(Model)
47end)
48
49asset.onDeinitialize(function()
50  openspace.removeSceneGraphNode(Model)
51end)
52
53asset.export(Model)