# SPostFX

**Membres** 17

|          |                                                                 |                                                                |
| -------- | --------------------------------------------------------------- | -------------------------------------------------------------- |
| Fonction | [CreateCommandBuffer](#createcommandbuffer)                     | Return a new CommandBuffer.                                    |
| Fonction | [AddCommandBufferToCamera](#addcommandbuffertocamera)           | Add the CommandBuffer to the Main Camera.                      |
| Fonction | [RemoveCommandBufferFromCamera](#removecommandbufferfromcamera) | Remove the CommandBuffer from the Main Camera.                 |
| Fonction | [SetPostProfile](#setpostprofile)                               | Set a custom Space Post-Processing Profile.                    |
| Fonction | [ClearPostProfile](#clearpostprofile)                           | Clear current Post-Processing profile and restore default one. |
| Fonction | [SetCrepsecularRays](#setcrepsecularrays)                       | –                                                              |
| Fonction | [SetAmbientOcclusion](#setambientocclusion)                     | –                                                              |
| Fonction | [SetMotionBlur](#setmotionblur)                                 | –                                                              |
| Fonction | [SetBloom](#setbloom)                                           | –                                                              |
| Fonction | [SetAnamorphicFlares](#setanamorphicflares)                     | –                                                              |
| Fonction | [SetVignette](#setvignette)                                     | –                                                              |
| Fonction | [SetLensDirt](#setlensdirt)                                     | –                                                              |
| Fonction | [SetChromaticAberrationPost](#setchromaticaberrationpost)       | –                                                              |
| Fonction | [SetFocus](#setfocus)                                           | –                                                              |
| Fonction | [SupressFocus](#supressfocus)                                   | –                                                              |
| Fonction | [RestoreFocus](#restorefocus)                                   | –                                                              |
| Fonction | [SetLookUpTable](#setlookuptable)                               | –                                                              |

## Fonctions

### CreateCommandBuffer

[SCommandBuffer](/docs/fr/scripting/client-scripting-api-reference/types/scommandbuffer.md) CreateCommandBuffer()

Return a new CommandBuffer.

Valeurs de retour

`SCommandBuffer`

Exemple

**Lua**

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

```

**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)

```

### AddCommandBufferToCamera

void AddCommandBufferToCamera([SCommandBuffer](/docs/fr/scripting/client-scripting-api-reference/types/scommandbuffer.md) commandbuffer, int cameraEvent = 19)

Add the CommandBuffer to the Main Camera.

Paramètres

| Nom           | Type                                                                                        | Valeur par défaut |
| ------------- | ------------------------------------------------------------------------------------------- | ----------------- |
| commandbuffer | [SCommandBuffer](/docs/fr/scripting/client-scripting-api-reference/types/scommandbuffer.md) | –                 |
| cameraEvent   | int                                                                                         | 19                |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

**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

```

### RemoveCommandBufferFromCamera

void RemoveCommandBufferFromCamera([SCommandBuffer](/docs/fr/scripting/client-scripting-api-reference/types/scommandbuffer.md) commandbuffer, int cameraEvent = 19)

Remove the CommandBuffer from the Main Camera.

Paramètres

| Nom           | Type                                                                                        | Valeur par défaut |
| ------------- | ------------------------------------------------------------------------------------------- | ----------------- |
| commandbuffer | [SCommandBuffer](/docs/fr/scripting/client-scripting-api-reference/types/scommandbuffer.md) | –                 |
| cameraEvent   | int                                                                                         | 19                |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

**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

```

### SetPostProfile

void SetPostProfile([SResource](/docs/fr/scripting/client-scripting-api-reference/types/sresource.md) customProfile)

Set a custom Space Post-Processing Profile.

Paramètres

| Nom           | Type                                                                              | Valeur par défaut |
| ------------- | --------------------------------------------------------------------------------- | ----------------- |
| customProfile | [SResource](/docs/fr/scripting/client-scripting-api-reference/types/sresource.md) | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### ClearPostProfile

void ClearPostProfile()

Clear current Post-Processing profile and restore default one.

Valeurs de retour

`void`

Exemple

**Lua**

```lua
Space.PostFX.ClearPostProfile()

```

### 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)

Paramètres

| Nom            | Type  | Valeur par défaut |
| -------------- | ----- | ----------------- |
| on             | bool  | –                 |
| thresR         | float | –                 |
| thresG         | float | –                 |
| thresB         | float | –                 |
| colorR         | float | –                 |
| colorG         | float | –                 |
| colorB         | float | –                 |
| falloff        | float | –                 |
| blurSize       | float | –                 |
| blurIterations | int   | –                 |
| intensity      | float | –                 |

Valeurs de retour

`void`

Exemple

**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)

```

### SetAmbientOcclusion

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

Paramètres

| Nom       | Type  | Valeur par défaut |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| intensity | float | –                 |
| aoOnly    | bool  | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetMotionBlur

void SetMotionBlur(bool on, float shutterAngle)

Paramètres

| Nom          | Type  | Valeur par défaut |
| ------------ | ----- | ----------------- |
| on           | bool  | –                 |
| shutterAngle | float | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetBloom

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

Paramètres

| Nom       | Type  | Valeur par défaut |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| threshold | float | –                 |
| intensity | float | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetAnamorphicFlares

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

Paramètres

| Nom       | Type  | Valeur par défaut |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| r         | float | –                 |
| g         | float | –                 |
| b         | float | –                 |
| intensity | float | –                 |
| threshold | float | –                 |
| spread    | float | –                 |
| vertical  | bool  | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetVignette

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

Paramètres

| Nom       | Type  | Valeur par défaut |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| r         | float | –                 |
| g         | float | –                 |
| b         | float | –                 |
| intensity | float | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetLensDirt

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

Paramètres

| Nom       | Type      | Valeur par défaut |
| --------- | --------- | ----------------- |
| on        | bool      | –                 |
| threshold | float     | –                 |
| texture   | SResource | –                 |
| intensity | float     | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetChromaticAberrationPost

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

Paramètres

| Nom        | Type  | Valeur par défaut |
| ---------- | ----- | ----------------- |
| on         | bool  | –                 |
| strength   | float | –                 |
| cornerBlur | float | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SetFocus

void SetFocus([SGameObject](/docs/fr/scripting/client-scripting-api-reference/types/sgameobject.md) target)

Paramètres

| Nom    | Type                                                                                  | Valeur par défaut |
| ------ | ------------------------------------------------------------------------------------- | ----------------- |
| target | [SGameObject](/docs/fr/scripting/client-scripting-api-reference/types/sgameobject.md) | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```

### SupressFocus

void SupressFocus()

Valeurs de retour

`void`

Exemple

**Lua**

```lua
Space.PostFX.SupressFocus()

```

### RestoreFocus

void RestoreFocus()

Valeurs de retour

`void`

Exemple

**Lua**

```lua
Space.PostFX.RestoreFocus()

```

### SetLookUpTable

void SetLookUpTable([SResource](/docs/fr/scripting/client-scripting-api-reference/types/sresource.md) lut)

Paramètres

| Nom | Type                                                                              | Valeur par défaut |
| --- | --------------------------------------------------------------------------------- | ----------------- |
| lut | [SResource](/docs/fr/scripting/client-scripting-api-reference/types/sresource.md) | –                 |

Valeurs de retour

`void`

Exemple

**Lua**

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

```
