terminalCode Example
EnvmapProbe — local reflection captures with Static, Dynamic, and OnDemand modes
EnvmapProbe — Reflection Captures in s&box
EnvmapProbe is a built-in s&box component that captures a cubemap at its world position for local specular reflections. The engine blends between nearby probes when rendering reflective surfaces.Adding a Probe
CSHARP
var go = Scene.CreateObject();
go.Name = "Reflection Probe";
go.WorldPosition = roomCenter;
var probe = go.Components.Create<EnvmapProbe>();
probe.Resolution = "256"; // "64", "128", "256", "512"Capture Modes
| Mode | Description |
|---|---|
| Static | Baked once in the editor — free at runtime |
| Dynamic | Re-captures every frame — expensive, use sparingly |
| OnDemand | Captures when probe.Capture() is called in code |
CSHARP
// Trigger a re-capture after a scene change
probe.Mode = EnvmapProbe.CaptureMode.OnDemand;
probe.Capture();Placement Tips
- One probe per distinct room or area
- Position at eye height in the center of the space
- 128–256 resolution is sufficient for most interiors
- Avoid overlapping probes — the engine blends between the nearest ones automatically
- Use Static mode for everything that doesn't change at runtime
Factory Helper
CSHARP
public static EnvmapProbe PlaceProbe( Scene scene, Vector3 position, string res = "128" )
{
var go = scene.CreateObject();
go.WorldPosition = position;
var probe = go.Components.Create<EnvmapProbe>();
probe.Resolution = res;
return probe;
}
Was this helpful?