Skip to content
Skybox

Scene / Skybox

Skybox Class ​

Sky Box


Usage example: control the sky box real-time effect of the editor as follows Create a script called 'SkyboxExample', place it in the object bar, open the script, enter the following code, run the game, and you will be able to control the brightness of the SkyboxExample using the '+' and '-' keys, and switch presets using the '*' key.

ts
@Component
export default class SkyboxExample extends mw.Script {
    // When the script is instantiated, this function will be called before the first frame update
    protected async onStart(): Promise<void> {
        if(Util.SystemUtil.isClient())
        {
            mw.InputUtil.onKeyDown(Type.Keys.Add,()=>{
                // Keypad+Build, increase the brightness of the Sky Box by 1 unit in sequence
                Skybox.skyDomeIntensity = Skybox.skyDomeIntensity + 0.2;
                Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
            });
            mw.InputUtil.onKeyDown(Type.Keys.Subtract,()=>{
                // Keypad - Build, decrease the brightness of the Sky Box by one unit in sequence
                Skybox.skyDomeIntensity = Skybox.skyDomeIntensity - 0.2;
                Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
            });
            mw.InputUtil.onKeyDown(Type.Keys.Multiply,()=>{
                // Keypad * build, switch sky box presets
                Skybox.preset =7 % (Skybox.preset + 1);
            });
        }
    }
}
@Component
export default class SkyboxExample extends mw.Script {
    // When the script is instantiated, this function will be called before the first frame update
    protected async onStart(): Promise<void> {
        if(Util.SystemUtil.isClient())
        {
            mw.InputUtil.onKeyDown(Type.Keys.Add,()=>{
                // Keypad+Build, increase the brightness of the Sky Box by 1 unit in sequence
                Skybox.skyDomeIntensity = Skybox.skyDomeIntensity + 0.2;
                Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
            });
            mw.InputUtil.onKeyDown(Type.Keys.Subtract,()=>{
                // Keypad - Build, decrease the brightness of the Sky Box by one unit in sequence
                Skybox.skyDomeIntensity = Skybox.skyDomeIntensity - 0.2;
                Console. log ("current sky box brightness:"+Skybox. skyDomeIntensity);
            });
            mw.InputUtil.onKeyDown(Type.Keys.Multiply,()=>{
                // Keypad * build, switch sky box presets
                Skybox.preset =7 % (Skybox.preset + 1);
            });
        }
    }
}

Table of contents ​

Accessors ​

affectedByFog(): boolean other
Set whether it is affected by environmental fog
cloudColor(): LinearColor other
Obtain cloud color
cloudDensity(): number other
Obtain cloud density
cloudOpacity(): number other
Obtain the transparency of the cloud
cloudSpeed(): number other
Obtain cloud speed
cloudTextureID(): string other
Get Cloud texture ID
cloudVisible(): boolean other
Get whether cloud is enabled or not
disturbanceDensity(): number other
Obtain disturbance density
disturbanceEnabled(): boolean other
Obtain disturbance switch
disturbanceIntensity(): number other
Obtain disturbance intensity
layerDisturbanceEnabled(): boolean other
Set whether to enable layered perturbation
moonColor(): LinearColor other
Obtain the color of the moon
moonIntensity(): number other
Get the brightness of the moon
moonSize(): number other
Obtain the size of the moon
moonTextureID(): string other
Get the moon texture ID
moonVisible(): boolean other
Determine whether to activate the moon
pitchAngle(): number other
Get Sky Box texture pitch rotation (degrees)
preset(): SkyPreset other
Get preset settings
rollAngle(): number other
Get Sky Box texture roll rotation (degrees)
skyDomeBaseColor(): LinearColor other
Get Sky Box color
skyDomeBottomColor(): LinearColor other
Color of the lower layer of the sky
skyDomeGradientEnabled(): boolean other
Get whether to enable gradient effect
skyDomeHorizontalFallOff(): number other
Get the horizon fade out value
skyDomeIntensity(): number other
Get Sky Box Brightness
skyDomeMiddleColor(): LinearColor other
Middle sky color
skyDomeTextureID(): string other
Get Sky Box texture Asset ID
skyDomeTopColor(): LinearColor other
Get the top color of the sky
skyboxRotation(): Rotation other
Get Sky Ball Rotation
starDensity(): number other
Get star density
starIntensity(): number other
Obtain star brightness
starTextureID(): string other
Get star texture ID
starVisible(): boolean other
Get whether to activate stars
sunColor(): LinearColor other
Obtain the color of the sun
sunIntensity(): number other
Get brightness of sunlight
sunSize(): number other
Obtain the size of the sun
sunTextureID(): string other
Get sun texture ID
sunVisible(): boolean other
Get whether to turn on the sun
yawAngle(): number other
Get Sky Box texture yaw Rotation (degrees)

Methods ​

refresh(): void other
Sky Box Refresh
reset(): void other
Reset to default parameters

Accessors ​

affectedByFog ​

• Static get affectedByFog(): boolean other

• Static set affectedByFog(value): void other

Set whether it is affected by environmental fog

Returns ​

booleanIs it affected by environmental fog

Set whether it is affected by environmental fog

Parameters ​

value booleanUsage: Is it affected by environmental fog

cloudColor ​

• Static get cloudColor(): LinearColor other

• Static set cloudColor(value): void other

Obtain cloud color

Returns ​

LinearColorCloud color

Set cloud color

Parameters ​

value LinearColorUsage: Cloud color

cloudDensity ​

• Static get cloudDensity(): number other

• Static set cloudDensity(value): void other

Obtain cloud density

Returns ​

numberCloud density

Set cloud density

Parameters ​

value numberUsage: Cloud density (0~1)

cloudOpacity ​

• Static get cloudOpacity(): number other

• Static set cloudOpacity(value): void other

Obtain the transparency of the cloud

Returns ​

numberTransparency of clouds

Set the transparency of the cloud

Parameters ​

value numberUsage: Cloud Transparency (0~1)

cloudSpeed ​

• Static get cloudSpeed(): number other

• Static set cloudSpeed(value): void other

Obtain cloud speed

Returns ​

numberCloud speed

Set cloud speed

Parameters ​

value numberUsage: Cloud speed (0~10)

cloudTextureID ​

• Static get cloudTextureID(): string other

• Static set cloudTextureID(value): void other

Get Cloud texture ID

Returns ​

stringCloud texture ID

Set cloud texture resource ID

Parameters ​

value stringUsage: cloud texture Asset ID

cloudVisible ​

• Static get cloudVisible(): boolean other

• Static set cloudVisible(value): void other

Get whether cloud is enabled or not

Returns ​

booleanDo you want to enable cloud

Set whether to enable cloud

Parameters ​

value booleanUsage: Do you want to enable cloud

disturbanceDensity ​

• Static get disturbanceDensity(): number other

• Static set disturbanceDensity(value): void other

Obtain disturbance density

Returns ​

numberDisturbance density

Set disturbance density

Parameters ​

value numberUsage: disturbance density

disturbanceEnabled ​

• Static get disturbanceEnabled(): boolean other

• Static set disturbanceEnabled(value): void other

Obtain disturbance switch

Returns ​

booleanDisturbance switch

Set disturbance switch

Parameters ​

value booleanUsage: Disturbance switch

disturbanceIntensity ​

• Static get disturbanceIntensity(): number other

• Static set disturbanceIntensity(value): void other

Obtain disturbance intensity

Returns ​

numberDisturbance intensity

Set disturbance intensity

Parameters ​

value numberUsage: disturbance intensity

layerDisturbanceEnabled ​

• Static get layerDisturbanceEnabled(): boolean other

• Static set layerDisturbanceEnabled(value): void other

Set whether to enable layered perturbation

Returns ​

booleanDo you want to enable layered perturbation

Set whether to enable layered perturbation

Parameters ​

value booleanUsage: Do you want to enable layered perturbation

moonColor ​

• Static get moonColor(): LinearColor other

• Static set moonColor(value): void other

Obtain the color of the moon

Returns ​

LinearColorMoon color

Set Moon Color

Parameters ​

value LinearColorUsage: Moon color

moonIntensity ​

• Static get moonIntensity(): number other

• Static set moonIntensity(value): void other

Get the brightness of the moon

Returns ​

numberMoon brightness

Set the brightness of the moon

Parameters ​

value numberUsage: Moon brightness (0-2000)

moonSize ​

• Static get moonSize(): number other

• Static set moonSize(value): void other

Obtain the size of the moon

Returns ​

numberMoon size

Set the size of the moon

Parameters ​

value numberUsage: Moon size (0~100)

moonTextureID ​

• Static get moonTextureID(): string other

• Static set moonTextureID(value): void other

Get the moon texture ID

Returns ​

stringMoon texture ID

Set Moon texture Asset ID

Parameters ​

value stringUsage: moon texture Asset ID

moonVisible ​

• Static get moonVisible(): boolean other

• Static set moonVisible(value): void other

Determine whether to activate the moon

Returns ​

booleanDo you want to turn on the moon

Set whether to turn on the moon

Parameters ​

value booleanUsage: Do you want to turn on the moon

pitchAngle ​

• Static get pitchAngle(): number other

• Static set pitchAngle(value): void other

Get Sky Box texture pitch rotation (degrees)

Returns ​

numberSky Box texture Rotation

Set Sky Box texture pitch rotation (degrees)

Parameters ​

value numberUsage: Sky box texture rotation (0~360)

preset ​

• Static get preset(): SkyPreset other

• Static set preset(NewPreset): void other

Get preset settings

Returns ​

SkyPresetReturn to preset settings

Set presets

Parameters ​

NewPreset SkyPresetUsage: preset enumeration

rollAngle ​

• Static get rollAngle(): number other

• Static set rollAngle(value): void other

Get Sky Box texture roll rotation (degrees)

Returns ​

numberSky Box texture Rotation

Set Sky Box texture roll rotation (degrees)

Parameters ​

value numberUsage: Sky box texture rotation (0~360)

skyDomeBaseColor ​

• Static get skyDomeBaseColor(): LinearColor other

• Static set skyDomeBaseColor(value): void other

Get Sky Box color

Returns ​

LinearColorSky Box Color

Set Sky Box Color

Parameters ​

value LinearColorUsage: Sky Box Color Value

skyDomeBottomColor ​

• Static get skyDomeBottomColor(): LinearColor other

• Static set skyDomeBottomColor(value): void other

Color of the lower layer of the sky

Returns ​

LinearColorColor of the lower layer of the sky

Set the color of the lower layer of the sky

Parameters ​

value LinearColorUsage: Color value of the lower layer of the sky

skyDomeGradientEnabled ​

• Static get skyDomeGradientEnabled(): boolean other

• Static set skyDomeGradientEnabled(value): void other

Get whether to enable gradient effect

Returns ​

booleanDo you want to enable gradient effect

Set whether to enable gradient effect

Parameters ​

value booleanUsage: Do you want to enable gradient effects

skyDomeHorizontalFallOff ​

• Static get skyDomeHorizontalFallOff(): number other

• Static set skyDomeHorizontalFallOff(value): void other

Get the horizon fade out value

Returns ​

numberHorizon fade out value

Set the horizon gradient value

Parameters ​

value numberUsage: Horizon gradually rising value (1-20)

skyDomeIntensity ​

• Static get skyDomeIntensity(): number other

• Static set skyDomeIntensity(value): void other

Get Sky Box Brightness

Returns ​

numberSky Box Brightness

Set Sky Box brightness

Parameters ​

value numberUsage: Sky Box Brightness Value (0~100)

skyDomeMiddleColor ​

• Static get skyDomeMiddleColor(): LinearColor other

• Static set skyDomeMiddleColor(value): void other

Middle sky color

Returns ​

LinearColorMiddle sky color

Set the color of the middle layer of the sky

Parameters ​

value LinearColorUsage: Color values in the middle layer of the sky

skyDomeTextureID ​

• Static get skyDomeTextureID(): string other

• Static set skyDomeTextureID(value): void other

Get Sky Box texture Asset ID

Returns ​

stringTexture Asset ID

Set Sky Box texture Asset ID

Parameters ​

value stringUsage: Texture Resource ID

skyDomeTopColor ​

• Static get skyDomeTopColor(): LinearColor other

• Static set skyDomeTopColor(value): void other

Get the top color of the sky

Returns ​

LinearColorTop color of the sky

Set the top color of the sky

Parameters ​

value LinearColorUsage: Top color value of the sky

skyboxRotation ​

• Static get skyboxRotation(): Rotation other

• Static set skyboxRotation(value): void other

Get Sky Ball Rotation

Returns ​

RotationSky ball rotation value

Set sky ball rotation

Parameters ​

value RotationUsage: skybox rotation value

starDensity ​

• Static get starDensity(): number other

• Static set starDensity(value): void other

Get star density

Returns ​

numberStar density

Set star density

Parameters ​

value numberUsage: star density (0~100)

starIntensity ​

• Static get starIntensity(): number other

• Static set starIntensity(value): void other

Obtain star brightness

Returns ​

numberStar brightness

Set star brightness

Parameters ​

value numberUsage: Star brightness (0~1)

starTextureID ​

• Static get starTextureID(): string other

• Static set starTextureID(value): void other

Get star texture ID

Returns ​

stringStar texture ID

Set Star texture Asset ID

Parameters ​

value stringUsage: star texture Asset ID

starVisible ​

• Static get starVisible(): boolean other

• Static set starVisible(value): void other

Get whether to activate stars

Returns ​

booleanDo you want to turn on the stars

Set whether to enable stars

Parameters ​

value booleanUsage: Do you want to turn on stars

sunColor ​

• Static get sunColor(): LinearColor other

• Static set sunColor(value): void other

Obtain the color of the sun

Returns ​

LinearColorSun color

Set the color of the sun

Parameters ​

value LinearColorUsage: Sun color

sunIntensity ​

• Static get sunIntensity(): number other

• Static set sunIntensity(value): void other

Get brightness of sunlight

Returns ​

numberSunlight brightness

Set the brightness of sunlight

Parameters ​

value numberUsage: Brightness of sunlight (0-2000)

sunSize ​

• Static get sunSize(): number other

• Static set sunSize(value): void other

Obtain the size of the sun

Returns ​

numberSun size

Set the size of the sun

Parameters ​

value numberUsage: Sun size (0~100)

sunTextureID ​

• Static get sunTextureID(): string other

• Static set sunTextureID(value): void other

Get sun texture ID

Returns ​

stringSun texture ID

Set sun texture Asset ID

Parameters ​

value stringUsage: sun texture Asset ID

sunVisible ​

• Static get sunVisible(): boolean other

• Static set sunVisible(value): void other

Get whether to turn on the sun

Returns ​

booleanDo you want to turn on the sun

Set whether to turn on the sun

Parameters ​

value booleanUsage: Do you want to turn on the sun

yawAngle ​

• Static get yawAngle(): number other

• Static set yawAngle(value): void other

Get Sky Box texture yaw Rotation (degrees)

Returns ​

numberSky Box texture Rotation

Set Sky Box texture yaw rotation (degrees)

Parameters ​

value numberUsage: sky box texture yaw rotation (0~360)

Methods ​

refresh ​

• Static refresh(): void other

Sky Box Refresh


reset ​

• Static reset(): void other

Reset to default parameters