SDF-based tracer and bolt rendering for projectile trails, laser beams, and muzzle effects.
Rendered via the TracerSDF shader using RenderPipelineManager.endCameraRendering.
TracerManager is a self-contained MonoBehaviour that handles the spawning, pooling, updating, and GPU rendering of tracer and bolt visual effects. It operates independently from the reticle rendering pipeline, so tracers never interfere with reticle draw calls or category transitions.
Rendering is performed by the TracerSDF shader via a CommandBuffer submitted through RenderPipelineManager.endCameraRendering. This hook is part of the SRP core package and works identically in both URP and HDRP — no pipeline-specific assembly references or renderer features are required.
The system supports three visual types:
| Type | Enum | Description |
|---|---|---|
| Bolt | TracerType.Bolt | Sci-fi energy bolt. Consistent appearance per shot, configurable perspective taper, glow, and end roundness. |
| Stream | TracerType.Stream | Continuous beam effect. Persists while firing with animated sine-wave displacement, noise modulation, and optional dual-beam rendering. |
| Bullet | TracerType.Bullet | Realistic tracer ammunition. Per-shot randomization across three sub-types (Streak, Bolt, Dot) with wobble, phosphorus-burn flicker, and sputtering. |
All tracers are pooled in a fixed-size NativeArray<TracerData> (default 32, configurable up to 128) and uploaded to the GPU as a single StructuredBuffer each frame. Like the reticle system, the entire tracer pool renders in one draw call.
The origin point — where tracers appear to fly in from — is controlled by TracerOriginMode:
| Mode | Behavior |
|---|---|
| Fixed | All shots originate from a user-defined angle. |
| Scatter | Each shot comes from a completely random angle. |
| RandomStart | A random angle is chosen on mouse-down; all shots in that burst use it. |
| Animated | Origin rotates at a slow-to-medium speed with randomized direction changes. |
| Tempest | Aggressive arcade-style rotation with random pauses and sharp direction reversals. |
The tracer system uses three complementary data structures:
TracerData is a 172-byte blittable struct that represents a single active tracer on the GPU. It contains origin/target positions, progress, color, glow, perspective parameters, wobble fields (Bullet type), and beam wave fields (Stream type). The struct is uploaded to the TracerSDF shader via a StructuredBuffer.
Key fields include:
TracerConfig is the serializable configuration class that defines a tracer's appearance and behavior. It includes all visual parameters (color, width, length, glow, feather, taper, perspective) along with type-specific settings for beam waves, dual-beam rendering, and randomization profiles. TracerManager holds a reference to the active TracerConfig and uses it to spawn new tracer instances.
The class also provides static factory presets: DefaultLaserBolt, PlasmaBolt, ExtremeBeam, DefaultBeam, ArcBeam, DualArc, LightningBeam, and PlasmaBeam.
TracerPresetData wraps a TracerConfig with metadata for persistence: a GUID identifier, display name, author, description, timestamps, fire rate, and a flag indicating whether the preset is a read-only default. Presets are serialized to JSON and stored as .adstracer files.
Tracer presets provide a save/load system for tracer configurations. The preset pipeline has two layers:
TracerPresetData, including validation and schema versioning (currently v3). Files use the .adstracer extension.ITracerStorage and manages file I/O. Resolves paths through IDataPathProvider for platform-agnostic storage. Ships with 8 built-in default presets (Default Laser, Plasma Bolt, Extreme Beam, Beam, Arc Beam, Dual Arc, Lightning, Plasma Stream) that are registered in memory and cannot be overwritten. User-created presets are stored alongside defaults in the configured tracers directory.Both synchronous and async I/O methods are available (Save/SaveAsync, Load/LoadAsync). The last-used preset is persisted via PlayerPrefs and restored automatically when TracerManager initializes.
Because presets are plain JSON files with a .adstracer extension, they can be shared between users or distributed with your game. Default presets are immutable — users must duplicate a default before editing it.
The tracer system includes a full visual editor for designing and previewing tracer effects in real time. It consists of two panels: the Tracer Editor for property editing and the Tracer Browser for preset management.
The editor panel is a draggable floating modal (position persists in PlayerPrefs) that exposes all TracerConfig properties organized into collapsible sections. Changes are reflected immediately in the viewport — fire tracers while editing to see results in real time.
| Control | Description |
|---|---|
| Tracer Type | Dropdown: Bolt, Stream, or Bullet. Changes which parameter sections are visible. |
| Bolt Color | Primary fill color (opens the color picker). |
| Glow Color | Outer glow color (opens the color picker). |
| Width | Thickness of the tracer body. |
| Length | How long the tracer extends along its path. |
| Min Width | Minimum width when perspective taper is active. Prevents tracers from disappearing at distance. |
| Glow Intensity | Brightness of the outer glow halo. |
| Glow Size | Radius of the glow falloff. |
| Feather | Edge softness of the tracer body. |
| Taper | How much the tracer narrows along its length (tail to head). |
| End Roundness | Rounds the cap at each end of the tracer. 0 = flat, 1 = hemispherical. |
| Control | Description |
|---|---|
| Origin Mode | Dropdown: Fixed, Scatter, RandomStart, Animated, Tempest. Controls where tracers appear to originate from. |
| Fixed Rotation | Angle in degrees (visible only when Origin Mode = Fixed). |
| Speed | Travel speed of the tracer from origin to target. |
| Fire Rate | Shots per second when auto-firing. |
| Perspective Depth | How much the tracer scales based on simulated depth. |
| Length Perspective | How much the tracer length compresses at perspective depth. |
These controls appear in a collapsible Beam foldout when the tracer type is set to Stream:
| Control | Description |
|---|---|
| Amplitude | Magnitude of the sine-wave displacement perpendicular to the beam axis. |
| Frequency | Number of wave cycles along the beam length. |
| Speed | How fast the wave pattern scrolls along the beam. |
| Noise Amount | Perlin noise displacement for organic, lightning-like variation. |
| Noise Scale | Scale of the noise pattern. Smaller = finer detail. |
| Converge | How much the beam converges toward the target point. |
| Dual Beam | Toggle: renders a second beam with offset phase for a twin-beam look. |
| Phase Offset | Wave phase offset between dual beams (visible when Dual Beam is on). |
These controls appear in a collapsible Sub-Type Mix foldout when the tracer type is set to Bullet:
| Control | Description |
|---|---|
| Sub-Type Mix | Toggle to enable randomized bullet sub-types. |
| Streak / Bolt / Dot Weights | Relative probability of each sub-type per shot. Higher weight = more frequent. |
| Additional Variance | Extra randomization applied to width, length, and speed. |
| Wobble Amount | Lateral oscillation as the bullet travels. |
| Wobble Frequency | Speed of the wobble oscillation. |
| Sputter Chance | Probability (0–1) that a bullet "sputters" — flickering intermittently like a real phosphorus tracer burning out. |
| Flicker Amount | Intensity variation of the brightness flicker effect. |
Four randomization presets are available as starting points: Realistic, Streak Heavy, Dot Heavy, and No Mix.
| Control | Description |
|---|---|
| Impact Burn | Toggle to enable a glowing impact point where the tracer hits. |
| Burn Size | Radius of the impact glow. |
| Burn Intensity | Brightness of the impact glow. |
The tracer browser is a separate floating panel that manages the preset library:
Double-clicking a preset in the list immediately loads and applies it. The browser is draggable with position persisted in PlayerPrefs.
RCE ships with 8 default tracer presets: Default Laser, Plasma Bolt, Extreme Beam, Beam, Arc Beam, Dual Arc, Lightning, and Plasma Stream. These are read-only — duplicate one to use it as a starting point for customization.
The tracer renderer hooks into Unity's Scriptable Render Pipeline via RenderPipelineManager.endCameraRendering, a callback from the UnityEngine.Rendering namespace (SRP core). This approach has several advantages:
RCERendererFeature for URP), the tracer system only depends on SRP core, which is always available.DrawProcedural call via a CommandBuffer, regardless of how many tracers are active.The TracerSDF shader evaluates each active tracer's SDF in the fragment shader, applying perspective taper, glow, beam-wave displacement, and impact burn effects. Inactive tracers (pooled slots with isActive = 0) are skipped via early-out.
TracerManager.LowQualityMode disables glow calculations in the shader for better performance on lower-end hardware. The tracer shapes remain crisp; only the soft glow falloff is removed.
TracerManager.TracersEnabled is a master on/off switch for the entire tracer system. When set to false, all active tracers are cleared, firing stops, and the Update/Render loops early-out. The setting persists in PlayerPrefs (ADS_TracersEnabled). In the editor, the toggle appears in the tracer toolbar; disabling it dims the toolbar controls to 35% opacity as a visual indicator.
| Component | Path |
|---|---|
| TracerManager | Assets/RCE/Runtime/Tracers/TracerManager.cs |
| TracerData | Assets/RCE/Runtime/Tracers/TracerData.cs |
| TracerConfig | Assets/RCE/Runtime/Tracers/TracerConfig.cs |
| TracerPresetData | Assets/RCE/Runtime/Tracers/TracerPresetData.cs |
| TracerSerializer | Assets/RCE/Runtime/Tracers/TracerSerializer.cs |
| ITracerStorage | Assets/RCE/Runtime/Tracers/ITracerStorage.cs (interface) |
| TracerStorage | Assets/RCE/Runtime/Tracers/TracerStorage.cs |
| TracerSDF Shader | Assets/RCE/Runtime/Shaders/TracerSDF.shader |
| TracerType | Assets/RCE/Runtime/Tracers/TracerType.cs |
| TracerOriginMode | Assets/RCE/Runtime/Tracers/TracerOriginMode.cs |
| TracerRandomization | Assets/RCE/Runtime/Tracers/TracerRandomization.cs |
| TracerEditorController | Assets/RCE/Runtime/UI/TracerEditorController.cs |
| TracerBrowserController | Assets/RCE/Runtime/UI/TracerBrowserController.cs |