Skip to content

SgSky

Renders the sky background. Sets the atmospheric backdrop for the scene and can be customized to simulate day/night cycles or different environments.

Inherits from

SceneObject

Usage

To use this class, add the following require at the top of your script:

local SgSky = require 'engine/sceneobjects/sgsky'

Reference

create

static create(self, options, parent)

Create a new sky object in the scenegraph.

Parameters

  • self
  • options (table): A table of options to fill the parameters
  • parent (SceneObject): The parent scene object to add this to

Returns

  • Promise: promise which will resolve to the created object

Example

-- Options can be omitted. This example shows the defaults,
-- only specify the ones you want different.
SgSky.create({
    active = true,
    name = "",
    transform = Transform.new(),
    layers = {0},
    tags = {},
    receiveShadow = false,
    castShadow = false,
    size = 1000,
    turbidity = 10,
    rayleigh = 2,
    mieCoefficient = 0.005,
    mieDirectionalG = 0.8,
    inclination = 0.49
    azimuth = 0.25
})

Properties

You can access these properties directly on the object or through :get("propertyName") or :set("propertyName", value) methods.

Property Type Default Description
active Boolean true
layers Layers [0]
tags Tags []
size Float 1000
turbidity Float 10
rayleigh Float 2
mieCoefficient Float 0.005
mieDirectionalG Float 0.8
inclination Float 0.49
azimuth Float 0.25