# SPostFX

**الأعضاء** 17

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

## الدوال

### CreateCommandBuffer

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

Return a new CommandBuffer.

القيم المرجعة

`SCommandBuffer`

مثال

**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/ar/scripting/client-scripting-api-reference/types/scommandbuffer.md) commandbuffer, int cameraEvent = 19)

Add the CommandBuffer to the Main Camera.

المعاملات

| الاسم         | النوع                                                                                       | القيمة الافتراضية |
| ------------- | ------------------------------------------------------------------------------------------- | ----------------- |
| commandbuffer | [SCommandBuffer](/docs/ar/scripting/client-scripting-api-reference/types/scommandbuffer.md) | –                 |
| cameraEvent   | int                                                                                         | 19                |

القيم المرجعة

`void`

مثال

**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/ar/scripting/client-scripting-api-reference/types/scommandbuffer.md) commandbuffer, int cameraEvent = 19)

Remove the CommandBuffer from the Main Camera.

المعاملات

| الاسم         | النوع                                                                                       | القيمة الافتراضية |
| ------------- | ------------------------------------------------------------------------------------------- | ----------------- |
| commandbuffer | [SCommandBuffer](/docs/ar/scripting/client-scripting-api-reference/types/scommandbuffer.md) | –                 |
| cameraEvent   | int                                                                                         | 19                |

القيم المرجعة

`void`

مثال

**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/ar/scripting/client-scripting-api-reference/types/sresource.md) customProfile)

Set a custom Space Post-Processing Profile.

المعاملات

| الاسم         | النوع                                                                             | القيمة الافتراضية |
| ------------- | --------------------------------------------------------------------------------- | ----------------- |
| customProfile | [SResource](/docs/ar/scripting/client-scripting-api-reference/types/sresource.md) | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### ClearPostProfile

void ClearPostProfile()

Clear current Post-Processing profile and restore default one.

القيم المرجعة

`void`

مثال

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

المعاملات

| الاسم          | النوع | القيمة الافتراضية |
| -------------- | ----- | ----------------- |
| on             | bool  | –                 |
| thresR         | float | –                 |
| thresG         | float | –                 |
| thresB         | float | –                 |
| colorR         | float | –                 |
| colorG         | float | –                 |
| colorB         | float | –                 |
| falloff        | float | –                 |
| blurSize       | float | –                 |
| blurIterations | int   | –                 |
| intensity      | float | –                 |

القيم المرجعة

`void`

مثال

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

المعاملات

| الاسم     | النوع | القيمة الافتراضية |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| intensity | float | –                 |
| aoOnly    | bool  | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### SetMotionBlur

void SetMotionBlur(bool on, float shutterAngle)

المعاملات

| الاسم        | النوع | القيمة الافتراضية |
| ------------ | ----- | ----------------- |
| on           | bool  | –                 |
| shutterAngle | float | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### SetBloom

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

المعاملات

| الاسم     | النوع | القيمة الافتراضية |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| threshold | float | –                 |
| intensity | float | –                 |

القيم المرجعة

`void`

مثال

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

المعاملات

| الاسم     | النوع | القيمة الافتراضية |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| r         | float | –                 |
| g         | float | –                 |
| b         | float | –                 |
| intensity | float | –                 |
| threshold | float | –                 |
| spread    | float | –                 |
| vertical  | bool  | –                 |

القيم المرجعة

`void`

مثال

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

المعاملات

| الاسم     | النوع | القيمة الافتراضية |
| --------- | ----- | ----------------- |
| on        | bool  | –                 |
| r         | float | –                 |
| g         | float | –                 |
| b         | float | –                 |
| intensity | float | –                 |

القيم المرجعة

`void`

مثال

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

المعاملات

| الاسم     | النوع     | القيمة الافتراضية |
| --------- | --------- | ----------------- |
| on        | bool      | –                 |
| threshold | float     | –                 |
| texture   | SResource | –                 |
| intensity | float     | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### SetChromaticAberrationPost

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

المعاملات

| الاسم      | النوع | القيمة الافتراضية |
| ---------- | ----- | ----------------- |
| on         | bool  | –                 |
| strength   | float | –                 |
| cornerBlur | float | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### SetFocus

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

المعاملات

| الاسم  | النوع                                                                                 | القيمة الافتراضية |
| ------ | ------------------------------------------------------------------------------------- | ----------------- |
| target | [SGameObject](/docs/ar/scripting/client-scripting-api-reference/types/sgameobject.md) | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### SupressFocus

void SupressFocus()

القيم المرجعة

`void`

مثال

**Lua**

```lua
Space.PostFX.SupressFocus()

```

### RestoreFocus

void RestoreFocus()

القيم المرجعة

`void`

مثال

**Lua**

```lua
Space.PostFX.RestoreFocus()

```

### SetLookUpTable

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

المعاملات

| الاسم | النوع                                                                             | القيمة الافتراضية |
| ----- | --------------------------------------------------------------------------------- | ----------------- |
| lut   | [SResource](/docs/ar/scripting/client-scripting-api-reference/types/sresource.md) | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```
