# SPostFX

## Index

### Functions Index

| Function Name                                                                                                                                                                                                        |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SCommandBuffer [**CreateCommandBuffer** ](#createcommandbuffer)()                                                                                                                                                    |
| void [**AddCommandBufferToCamera** ](#addcommandbuffertocamera)(SCommandBuffer commandbuffer, int cameraEvent=19)                                                                                                    |
| void [**RemoveCommandBufferFromCamera** ](#removecommandbufferfromcamera)(SCommandBuffer commandbuffer, int cameraEvent=19)                                                                                          |
| void [**SetPostProfile** ](#setpostprofile)(SResource customProfile)                                                                                                                                                 |
| void [**ClearPostProfile** ](#clearpostprofile)()                                                                                                                                                                    |
| void [**SetCrepsecularRays** ](#setcrepsecularrays)(bool on, float thresR, float thresG, float thresB, float colorR, float colorG, float colorB, float falloff, float blurSize, int blurIterations, float intensity) |
| void [**SetAmbientOcclusion** ](#setambientocclusion)(bool on, float intensity, bool aoOnly)                                                                                                                         |
| void [**SetMotionBlur** ](#setmotionblur)(bool on, float shutterAngle)                                                                                                                                               |
| void [**SetBloom** ](#setbloom)(bool on, float threshold, float intensity)                                                                                                                                           |
| void [**SetAnamorphicFlares** ](#setanamorphicflares)(bool on, float r, float g, float b, float intensity, float threshold, float spread, bool vertical)                                                             |
| void [**SetVignette** ](#setvignette)(bool on, float r, float g, float b, float intensity)                                                                                                                           |
| void [**SetLensDirt** ](#setlensdirt)(bool on, float threshold, SResource texture, float intensity)                                                                                                                  |
| void [**SetChromaticAberrationPost** ](#setchromaticaberrationpost)(bool on, float strength, float cornerBlur)                                                                                                       |
| void [**SetFocus** ](#setfocus)(SGameObject target)                                                                                                                                                                  |
| void [**SupressFocus** ](#supressfocus)()                                                                                                                                                                            |
| void [**RestoreFocus** ](#restorefocus)()                                                                                                                                                                            |
| void [**SetLookUpTable** ](#setlookuptable)(SResource lut)                                                                                                                                                           |

## Functions

### CreateCommandBuffer

[SCommandBuffer](https://docs.sine.space/scripting/client-scripting-api-reference/types/scommandbuffer) **CreateCommandBuffer** ()

*Return a new CommandBuffer.*

{% tabs %}
{% tab title="Lua" %}

```lua
commandBuffer = Space.PostFX.CreateCommandBuffer()
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
local commandbuffer=Space.PostFX.CreateCommandBuffer()
local mat=Space.Resources[1]
local cube=Space.Host.GetReference("Cube")
commandbuffer.DrawRenderer(cube.Renderer,mat.AsMaterial)
Space.PostFX.AddCommandBufferToCamera(commandbuffer)
```

{% endtab %}
{% endtabs %}

### AddCommandBufferToCamera

void **AddCommandBufferToCamera** ([SCommandBuffer](https://docs.sine.space/scripting/client-scripting-api-reference/types/scommandbuffer) commandbuffer, int cameraEvent=19)

*Add the CommandBuffer to the Main Camera.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.AddCommandBufferToCamera(ACommandBuffer)
---or
Space.PostFX.AddCommandBufferToCamera(ACommandBuffer, 18)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
local commandbuffer=Space.PostFX.CreateCommandBuffer()
local mat=Space.Resources[1]
local cube=Space.Host.GetReference("Cube")
commandbuffer.DrawRenderer(cube.Renderer,mat.AsMaterial)
Space.PostFX.AddCommandBufferToCamera(commandbuffer)
function RemoveCommandBuffer()
--Bind this function to a button and then click it in playing.
    Space.PostFX.RemoveCommandBufferFromCamera(commandbuffer)
end
```

{% endtab %}
{% endtabs %}

### RemoveCommandBufferFromCamera

void **RemoveCommandBufferFromCamera** ([SCommandBuffer](https://docs.sine.space/scripting/client-scripting-api-reference/types/scommandbuffer) commandbuffer, int cameraEvent=19)

*Remove the CommandBuffer from the Main Camera.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.RemoveCommandBufferToCamera(ACommandBuffer)
---or
Space.PostFX.RemoveCommandBufferToCamera(ACommandBuffer, 18)
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Lua" %}

```lua
local commandbuffer=Space.PostFX.CreateCommandBuffer()
local mat=Space.Resources[1]
local cube=Space.Host.GetReference("Cube")
commandbuffer.DrawRenderer(cube.Renderer,mat.AsMaterial)
Space.PostFX.AddCommandBufferToCamera(commandbuffer)
function RemoveCommandBuffer()
--Bind this function to a button and then click it in playing.
    Space.PostFX.RemoveCommandBufferFromCamera(commandbuffer)
end
```

{% endtab %}
{% endtabs %}

### SetPostProfile

void **SetPostProfile** ([SResource](https://docs.sine.space/scripting/client-scripting-api-reference/types/sresource) customProfile)

*Set a custom Space Post-Processing Profile.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetPostProfile(Space.Resources[1])
```

{% endtab %}
{% endtabs %}

### ClearPostProfile

void **ClearPostProfile** ()

*Clear current Post-Processing profile and restore default one.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.ClearPostProfile()
```

{% endtab %}
{% endtabs %}

### SetCrepsecularRays

void **SetCrepsecularRays** (bool on, float thresR, float thresG, float thresB, float colorR, float colorG, float colorB, float falloff, float blurSize, int blurIterations, float intensity)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetCrepsecularRays(true, 255.0, 0.0, 0.0, 0.0,0.0, 255.0, 1.0, 1.0, 2, 4.0)
```

{% endtab %}
{% endtabs %}

### SetAmbientOcclusion

void **SetAmbientOcclusion** (bool on, float intensity, bool aoOnly)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetAmbientOcclusion(true, 4.0, true)
```

{% endtab %}
{% endtabs %}

### SetMotionBlur

void **SetMotionBlur** (bool on, float shutterAngle)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetMotionBlur(true, 20.0)
```

{% endtab %}
{% endtabs %}

### SetBloom

void **SetBloom** (bool on, float threshold, float intensity)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetBloom(true, 2.0, 4.0)
```

{% endtab %}
{% endtabs %}

### SetAnamorphicFlares

void **SetAnamorphicFlares** (bool on, float r, float g, float b, float intensity, float threshold, float spread, bool vertical)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetBloom(true, 255.0, 0.0, 0.0, 4.0, 2.0, 3.0, true)
```

{% endtab %}
{% endtabs %}

### SetVignette

void **SetVignette** (bool on, float r, float g, float b, float intensity)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetVignette(true, 255.0, 0.0, 0.0, 4.0)
```

{% endtab %}
{% endtabs %}

### SetLensDirt

void **SetLensDirt** (bool on, float threshold, SResource texture, float intensity)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetLensDirt(true, 4.0, Space.Resources[1], 4.0)
```

{% endtab %}
{% endtabs %}

### SetChromaticAberrationPost

void **SetChromaticAberrationPost** (bool on, float strength, float cornerBlur)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetChromaticAberrationPost(true, 4.0, 1.0)
```

{% endtab %}
{% endtabs %}

### SetFocus

void **SetFocus** ([SGameObject](https://docs.sine.space/scripting/client-scripting-api-reference/types/sgameobject) target)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetFocus(Space.Host.ExecutingObject)
```

{% endtab %}
{% endtabs %}

### SupressFocus

void **SupressFocus** ()

*Function Description*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SupressFocus()
```

{% endtab %}
{% endtabs %}

### RestoreFocus

void **RestoreFocus** ()

*Function Description*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.RestoreFocus()
```

{% endtab %}
{% endtabs %}

### SetLookUpTable

void **SetLookUpTable** ([SResource](https://docs.sine.space/scripting/client-scripting-api-reference/types/sresource) lut)

*Function Description*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.PostFX.SetLookUpTable(Space.Resources[1])
```

{% endtab %}
{% endtabs %}
