Breakroom is now Sinewave Campus. Book a meeting

SPostFX

客户端场景
在此类中CreateCommandBuffer
  1. 函数
  2. CreateCommandBuffer
  3. AddCommandBufferToCamera
  4. RemoveCommandBufferFromCamera
  5. SetPostProfile
  6. ClearPostProfile
  7. SetCrepsecularRays
  8. SetAmbientOcclusion
  9. SetMotionBlur
  10. SetBloom
  11. SetAnamorphicFlares
  12. SetVignette
  13. SetLensDirt
  14. SetChromaticAberrationPost
  15. SetFocus
  16. SupressFocus
  17. RestoreFocus
  18. SetLookUpTable
成员 17
函数CreateCommandBufferReturn a new CommandBuffer.
函数AddCommandBufferToCameraAdd the CommandBuffer to the Main Camera.
函数RemoveCommandBufferFromCameraRemove the CommandBuffer from the Main Camera.
函数SetPostProfileSet a custom Space Post-Processing Profile.
函数ClearPostProfileClear current Post-Processing profile and restore default one.
函数SetCrepsecularRays–
函数SetAmbientOcclusion–
函数SetMotionBlur–
函数SetBloom–
函数SetAnamorphicFlares–
函数SetVignette–
函数SetLensDirt–
函数SetChromaticAberrationPost–
函数SetFocus–
函数SupressFocus–
函数RestoreFocus–
函数SetLookUpTable–

函数​

CreateCommandBuffer​

SCommandBuffer CreateCommandBuffer()

Return a new CommandBuffer.

返回值

SCommandBuffer

示例

Lua
commandBuffer = Space.PostFX.CreateCommandBuffer()
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 commandbuffer, int cameraEvent = 19)

Add the CommandBuffer to the Main Camera.

参数

名称类型默认值
commandbufferSCommandBuffer–
cameraEventint19

返回值

void

示例

Lua
Space.PostFX.AddCommandBufferToCamera(ACommandBuffer)
---or
Space.PostFX.AddCommandBufferToCamera(ACommandBuffer, 18)
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 commandbuffer, int cameraEvent = 19)

Remove the CommandBuffer from the Main Camera.

参数

名称类型默认值
commandbufferSCommandBuffer–
cameraEventint19

返回值

void

示例

Lua
Space.PostFX.RemoveCommandBufferToCamera(ACommandBuffer)
---or
Space.PostFX.RemoveCommandBufferToCamera(ACommandBuffer, 18)
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 customProfile)

Set a custom Space Post-Processing Profile.

参数

名称类型默认值
customProfileSResource–

返回值

void

示例

Lua
Space.PostFX.SetPostProfile(Space.Resources[1])

ClearPostProfile​

void ClearPostProfile()

Clear current Post-Processing profile and restore default one.

返回值

void

示例

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)

参数

名称类型默认值
onbool–
thresRfloat–
thresGfloat–
thresBfloat–
colorRfloat–
colorGfloat–
colorBfloat–
fallofffloat–
blurSizefloat–
blurIterationsint–
intensityfloat–

返回值

void

示例

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)

参数

名称类型默认值
onbool–
intensityfloat–
aoOnlybool–

返回值

void

示例

Lua
Space.PostFX.SetAmbientOcclusion(true, 4.0, true)

SetMotionBlur​

void SetMotionBlur(bool on, float shutterAngle)

参数

名称类型默认值
onbool–
shutterAnglefloat–

返回值

void

示例

Lua
Space.PostFX.SetMotionBlur(true, 20.0)

SetBloom​

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

参数

名称类型默认值
onbool–
thresholdfloat–
intensityfloat–

返回值

void

示例

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)

参数

名称类型默认值
onbool–
rfloat–
gfloat–
bfloat–
intensityfloat–
thresholdfloat–
spreadfloat–
verticalbool–

返回值

void

示例

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)

参数

名称类型默认值
onbool–
rfloat–
gfloat–
bfloat–
intensityfloat–

返回值

void

示例

Lua
Space.PostFX.SetVignette(true, 255.0, 0.0, 0.0, 4.0)

SetLensDirt​

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

参数

名称类型默认值
onbool–
thresholdfloat–
textureSResource–
intensityfloat–

返回值

void

示例

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

SetChromaticAberrationPost​

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

参数

名称类型默认值
onbool–
strengthfloat–
cornerBlurfloat–

返回值

void

示例

Lua
Space.PostFX.SetChromaticAberrationPost(true, 4.0, 1.0)

SetFocus​

void SetFocus(SGameObject target)

参数

名称类型默认值
targetSGameObject–

返回值

void

示例

Lua
Space.PostFX.SetFocus(Space.Host.ExecutingObject)

SupressFocus​

void SupressFocus()

返回值

void

示例

Lua
Space.PostFX.SupressFocus()

RestoreFocus​

void RestoreFocus()

返回值

void

示例

Lua
Space.PostFX.RestoreFocus()

SetLookUpTable​

void SetLookUpTable(SResource lut)

参数

名称类型默认值
lutSResource–

返回值

void

示例

Lua
Space.PostFX.SetLookUpTable(Space.Resources[1])