# SRenderSettings

**成员** 26

|      |                                                             |                                                                    |
| ---- | ----------------------------------------------------------- | ------------------------------------------------------------------ |
| 函数 | [SetGlobalShaderTexture](#setglobalshadertexture)           | Set a global texture property.                                     |
| 函数 | [SetGlobalShaderFloat](#setglobalshaderfloat)               | Set a global float property for all shaders.                       |
| 函数 | [SetGlobalShaderColor](#setglobalshadercolor)               | Set a global color property for all shaders.                       |
| 函数 | [SetGlobalShaderVector](#setglobalshadervector)             | Set a global color property for all shaders.                       |
| 属性 | [DefaultReflectionResolution](#defaultreflectionresolution) | Cubemap resolution for default reflection.                         |
| 属性 | [Skybox](#skybox)                                           | The global skybox to use.                                          |
| 属性 | [FlareFadeSpeed](#flarefadespeed)                           | The fade speed of all flares in the Scene.                         |
| 属性 | [FlareStrength](#flarestrength)                             | The intensity of all flares in the Scene.                          |
| 属性 | [HaloStrength](#halostrength)                               | Size of the light halos.                                           |
| 属性 | [ReflectionBounces](#reflectionbounces)                     | The number of times a reflection includes other reflections.       |
| 属性 | [ReflectionIntensity](#reflectionintensity)                 | How much the skybox / custom cubemap reflection affects the Scene. |
| 属性 | [SubtractiveShadowColor](#subtractiveshadowcolor)           | The color used for the sun shadows in the Subtractive lightmode.   |
| 属性 | [AmbientIntensity](#ambientintensity)                       | How much the light from the Ambient Source affects the Scene.      |
| 属性 | [AmbientLight](#ambientlight)                               | Flat ambient lighting color.                                       |
| 属性 | [AmbientGroundColor](#ambientgroundcolor)                   | Ambient lighting coming from below.                                |
| 属性 | [AmbientEquatorColor](#ambientequatorcolor)                 | Ambient lighting coming from the sides.                            |
| 属性 | [AmbientSkyColor](#ambientskycolor)                         | Ambient lighting coming from above.                                |
| 属性 | [AmbientMode](#ambientmode)                                 | Ambient lighting mode.                                             |
| 属性 | [FogEndDistance](#fogenddistance)                           | The ending distance of linear fog.                                 |
| 属性 | [FogStartDistance](#fogstartdistance)                       | The starting distance of linear fog.                               |
| 属性 | [FogDensity](#fogdensity)                                   | The density of the exponential fog.                                |
| 属性 | [FogColor](#fogcolor)                                       | The color of the fog.                                              |
| 属性 | [FogMode](#fogmode)                                         | Ambient lighting mode.                                             |
| 属性 | [Fog](#fog)                                                 | Whether Fog is enabled                                             |
| 属性 | [AmbientSkyboxAmount](#ambientskyboxamount)                 | How much the light from the Ambient Source affects the Scene.      |
| 属性 | [DefaultReflectionMode](#defaultreflectionmode)             | Ambient lighting mode.                                             |

## 函数

### SetGlobalShaderTexture

void SetGlobalShaderTexture(string name, [SResource](/docs/zh-Hans/scripting/client-scripting-api-reference/types/sresource.md) dir)

Set a global texture property.

参数

| 名称 | 类型                                                                                   | 默认值 |
| ---- | -------------------------------------------------------------------------------------- | ------ |
| name | string                                                                                 | –      |
| dir  | [SResource](/docs/zh-Hans/scripting/client-scripting-api-reference/types/sresource.md) | –      |

返回值

`void`

示例

**Lua**

```lua
Space.RenderSettings.SetGlobalShaderTexture("_TestTex",Space.Resources[1])

```

### SetGlobalShaderFloat

void SetGlobalShaderFloat(string name, float dir)

Set a global float property for all shaders.

参数

| 名称 | 类型   | 默认值 |
| ---- | ------ | ------ |
| name | string | –      |
| dir  | float  | –      |

返回值

`void`

示例

**Lua**

```lua
Space.RenderSettings.SetGlobalShaderFloat("_Mult",1)

```

### SetGlobalShaderColor

void SetGlobalShaderColor(string name, [SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) dir)

Set a global color property for all shaders.

参数

| 名称 | 类型                                                                             | 默认值 |
| ---- | -------------------------------------------------------------------------------- | ------ |
| name | string                                                                           | –      |
| dir  | [SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) | –      |

返回值

`void`

示例

**Lua**

```lua
Space.RenderSettings.SetGlobalShaderFloat("_TestColor",Color.Red)

```

### SetGlobalShaderVector

void SetGlobalShaderVector(string name, [SVector](/docs/zh-Hans/scripting/client-scripting-api-reference/types/svector.md) dir)

Set a global color property for all shaders.

参数

| 名称 | 类型                                                                               | 默认值 |
| ---- | ---------------------------------------------------------------------------------- | ------ |
| name | string                                                                             | –      |
| dir  | [SVector](/docs/zh-Hans/scripting/client-scripting-api-reference/types/svector.md) | –      |

返回值

`void`

示例

**Lua**

```lua
Space.RenderSettings.SetGlobalShaderFloat("_TestVector",Vector.One)

```

## 属性

### DefaultReflectionResolution

int DefaultReflectionResolution {get; set; }

Cubemap resolution for default reflection.

示例

**Lua**

```lua
Space.RenderSettings.DefaultReflectionResolution=256

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Cube Map Resolution

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.DefaultReflectionResolution = slider.Value * 4096 -- from 0 to 40906
end

slider.OnValueChanged(OVC)

```

### Skybox

[SMaterial](/docs/zh-Hans/scripting/client-scripting-api-reference/types/smaterial.md) Skybox {get; set; }

The global skybox to use.

示例

**Lua**

```lua
Space.RenderSettings.Skybox=Space.Resources[1].AsMaterial

```

**Lua**

```lua
--clicking this object will toggle between two Skyboxes
--[Add 2 materials to the first two Resource slots in Scripting Runtime component]
thisGameObject = Space.Host.ExecutingObject

OnClick = function()
  if Space.RenderSettings.Skybox==Space.Resources[1].AsMaterial then
    Space.RenderSettings.Skybox=Space.Resources[2].AsMaterial
  else 
    Space.RenderSettings.Skybox=Space.Resources[1].AsMaterial
  end
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### FlareFadeSpeed

float FlareFadeSpeed {get; set; }

The fade speed of all flares in the Scene.

示例

**Lua**

```lua
Space.RenderSettings.FlareFadeSpeed=5

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Flare Fade Speed

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.FlareFadeSpeed = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### FlareStrength

float FlareStrength {get; set; }

The intensity of all flares in the Scene.

示例

**Lua**

```lua
Space.RenderSettings.FlareStrength=1

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Flare Strength

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.FlareStrength = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### HaloStrength

float HaloStrength {get; set; }

Size of the light halos.

示例

**Lua**

```lua
Space.RenderSettings.HaloStrength=1

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Halo Strength

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.HaloStrength = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### ReflectionBounces

int ReflectionBounces {get; set; }

The number of times a reflection includes other reflections.

示例

**Lua**

```lua
Space.RenderSettings.ReflectionBounces=5

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Reflection Bounces

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.ReflectionBounces = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### ReflectionIntensity

float ReflectionIntensity {get; set; }

How much the skybox / custom cubemap reflection affects the Scene.

示例

**Lua**

```lua
Space.RenderSettings.ReflectionIntensity=1

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Reflection Intensity

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.ReflectionIntensity = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### SubtractiveShadowColor

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) SubtractiveShadowColor {get; set; }

The color used for the sun shadows in the Subtractive lightmode.

示例

**Lua**

```lua
Space.RenderSettings.SubtractiveShadowColor=Color.Red

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Subtractive Shadow Color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.SubtractiveShadowColor

OnChange = function(SColor) 
 Space.RenderSettings.SubtractiveShadowColor = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.SubtractiveShadowColor = SColor
end

OnCancel = function()
 Space.RenderSettings.SubtractiveShadowColor = originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientIntensity

float AmbientIntensity {get; set; }

How much the light from the Ambient Source affects the Scene.

示例

**Lua**

```lua
Space.RenderSettings.AmbientIntensity = 1

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Ambient Intensity

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.AmbientIntensity = slider.Value * 5 -- from 0 to 5
end

slider.OnValueChanged(OVC)

```

### AmbientLight

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) AmbientLight {get; set; }

Flat ambient lighting color.

示例

**Lua**

```lua
Space.RenderSettings.AmbientLight=Color.Blue

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Ambient Light Color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.AmbientLight

OnChange = function(SColor) 
 Space.RenderSettings.AmbientLight = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.AmbientLight = SColor
end

OnCancel = function()
 Space.RenderSettings.AmbientLight = originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientGroundColor

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) AmbientGroundColor {get; set; }

Ambient lighting coming from below.

示例

**Lua**

```lua
Space.RenderSettings.AmbientGroundColor=Color.Green

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Ambient Ground Color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.AmbientGroundColor

OnChange = function(SColor) 
 Space.RenderSettings.AmbientGroundColor = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.AmbientGroundColor = SColor
end

OnCancel = function()
 Space.RenderSettings.AmbientGroundColor = originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientEquatorColor

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) AmbientEquatorColor {get; set; }

Ambient lighting coming from the sides.

示例

**Lua**

```lua
Space.RenderSettings.AmbientEquatorColor=Color.Green

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Ambient Equator Color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.AmbientEquatorColor

OnChange = function(SColor) 
 Space.RenderSettings.AmbientEquatorColor = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.AmbientEquatorColor = SColor
end

OnCancel = function()
 Space.RenderSettings.AmbientEquatorColor= originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientSkyColor

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) AmbientSkyColor {get; set; }

Ambient lighting coming from above.

示例

**Lua**

```lua
Space.RenderSettings.AmbientSkyColor=Color.White

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Ambient Sky Color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.AmbientSkyColor

OnChange = function(SColor) 
 Space.RenderSettings.AmbientSkyColor = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.AmbientSkyColor = SColor
end

OnCancel = function()
 Space.RenderSettings.AmbientSkyColor = originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientMode

int AmbientMode {get; set; }

Ambient lighting mode. Skybox = 1. Trilight = 2. Flat = 3. Custom = 4.

示例

**Lua**

```lua
Space.RenderSettings.AmbientMode=1

```

**Lua**

```lua
--clicking this object will toggle between 4 Ambient Modes

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
  if Space.RenderSettings.AmbientMode==4 then
    Space.RenderSettings.AmbientMode=1
  else 
    Space.RenderSettings.AmbientMode = Space.RenderSettings.AmbientMode + 1
  end
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### FogEndDistance

float FogEndDistance {get; set; }

The ending distance of linear fog.

示例

**Lua**

```lua
Space.RenderSettings.FogEndDistance=300

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Fog End Distance

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.FogEndDistance = (slider.Value * 170) + 30-- from 30 to 200
end

slider.OnValueChanged(OVC)

```

### FogStartDistance

float FogStartDistance {get; set; }

The starting distance of linear fog.

示例

**Lua**

```lua
Space.RenderSettings.FogStartDistance=10

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Fog Start Distance

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.FogStartDistance = (slider.Value * 10) -- from 0 to 10
end

slider.OnValueChanged(OVC)

```

### FogDensity

float FogDensity {get; set; }

The density of the exponential fog.

示例

**Lua**

```lua
Space.RenderSettings.FogDensity=10

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Fog Density

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.FogDensity = (slider.Value * 10) -- from 0 to 10
end

slider.OnValueChanged(OVC)

```

### FogColor

[SColor](/docs/zh-Hans/scripting/client-scripting-api-reference/types/scolor.md) FogColor {get; set; }

The color of the fog.

示例

**Lua**

```lua
Space.RenderSettings.FogColor = Color.Red

```

**Lua**

```lua
--clicking the object will open a color picker that changes the Fog color
thisGameObject = Space.Host.ExecutingObject
originalColor = Space.RenderSettings.FogColor

OnChange = function(SColor) 
 Space.RenderSettings.FogColor = SColor
end

OnSelect = function(SColor)
 Space.RenderSettings.FogColor = SColor
end

OnCancel = function()
 Space.RenderSettings.FogColor = originalColor
end

OnClick = function()
Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### FogMode

int FogMode {get; set; }

Ambient lighting mode. Linear = 1. Exponential = 2. ExponentialSquared = 3.

示例

**Lua**

```lua
Space.RenderSettings.FogMode=2

```

**Lua**

```lua
--clicking this object will toggle between 3 Fog Modes

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
  if Space.RenderSettings.FogMode==3 then
    Space.RenderSettings.FogMode=1
  else 
    Space.RenderSettings.FogMode = Space.RenderSettings.FogMode + 1
  end
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### Fog

bool Fog {get; set; }

Whether Fog is enabled

示例

**Lua**

```lua
Space.RenderSettings.Fog=true

```

**Lua**

```lua
--clicking this object will toggle enable/disable Fog

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
Space.RenderSettings.Fog = not Space.RenderSettings.Fog
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```

### AmbientSkyboxAmount

float AmbientSkyboxAmount {get; set; }

How much the light from the Ambient Source affects the Scene.

示例

**Lua**

```lua
Space.RenderSettings.AmbientSkyboxAmount=10

```

**Lua**

```lua
--the below script will make a slider change the Render Setting's Ambient Skybox Amount

thisGameObject = Space.Host.ExecutingObject

slider = Space.Host.GetReference("slider").UISlider --add reference to Scripting Runtime

OVC = function()
Space.RenderSettings.AmbientSkyboxAmount = (slider.Value * 10) -- from 0 to 10
end

slider.OnValueChanged(OVC)

```

### DefaultReflectionMode

int DefaultReflectionMode {get; set; }

Ambient lighting mode. Skybox = 0. Custom = 1.

示例

**Lua**

```lua
Space.RenderSettings.DefaultReflectionMode = 1

```

**Lua**

```lua
--clicking this object will toggle between two Default Reflection Modes

thisGameObject = Space.Host.ExecutingObject

OnClick = function()
  if Space.RenderSettings.DefaultReflectionMode==1 then
    Space.RenderSettings.DefaultReflectionMode=0
  else 
    Space.RenderSettings.DefaultReflectionMode=1
  end
end


thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)

```
