terminalCode Example
Post-processing and camera setup — CameraComponent, PostProcessVolume, Bloom, DoF, and Film Grain
Post-Processing and Camera Setup
CameraComponent
CSHARP
var camGo = Scene.CreateObject();
camGo.Name = "Main Camera";
var cam = camGo.Components.Create<CameraComponent>();
cam.FieldOfView = 90f;
cam.ZNear = 1f;
cam.ZFar = 10000f;
cam.IsMainCamera = true;
cam.BackgroundColor = Color.Black;Orthographic Camera
CSHARP
cam.Orthographic = true;
cam.OrthographicHeight = 512f; // world units visible verticallyMultiple Cameras (Priority)
Higher priority renders on top. Use for split-screen, minimaps, or scopes.
CSHARP
mainCam.Priority = 0;
scopeCam.Priority = 1; // renders over mainPostProcessVolume
Post-processing effects are applied via PostProcessVolume components. Add effect components (e.g. ColorAdjustments, Bloom, DepthOfField) to the same GameObject.
CSHARP
var ppGo = Scene.CreateObject();
ppGo.Name = "PostProcess";
var volume = ppGo.Components.Create<PostProcessVolume>();
volume.BlendWeight = 1f; // 0–1 blend strength
volume.Priority = 0;
volume.BlendDistance = 0f; // 0 = global (no blend edge)Bloom
CSHARP
var bloom = ppGo.Components.Create<Bloom>();
bloom.Threshold = 0.8f;
bloom.Intensity = 1.5f;
bloom.Scatter = 0.7f;Color Grading / Tonemapping
CSHARP
var tone = ppGo.Components.Create<Tonemapping>();
tone.Mode = Tonemapping.ToneMode.ACES;Depth of Field
CSHARP
var dof = ppGo.Components.Create<DepthOfField>();
dof.FocalDistance = 300f;
dof.FocalLength = 50f;
dof.FStop = 2.8f;Film Grain
CSHARP
var grain = ppGo.Components.Create<FilmGrain>();
grain.Intensity = 0.3f;
grain.Response = 0.8f;Scoped Post-Process (Local Volume)
Set BlendDistance > 0 and place the volume in the world to affect only nearby areas:
CSHARP
volume.BlendDistance = 200f; // fades in over 200 units
ppGo.WorldPosition = interiorPosition;
// Add a BoxCollider to define the volume bounds
var bounds = ppGo.Components.Create<BoxCollider>();
bounds.Size = new Vector3( 600, 600, 300 );
bounds.IsTrigger = true;
Was this helpful?