Trinity renderer

From Valve Developer Community
Jump to navigation Jump to search

Template:Engine Nav

Developer(s)
Andrew "CastleBravo / Highlander" Lucas
GoldSrc Community contributors
Status
Active / Open-source
Platform(s)
Engine

Trinity Renderer is a custom, open-source replacement renderer designed for the GoldSrc engine. Originally conceived and developed by Andrew "CastleBravo / Highlander" Lucas, with additional features and maintenance contributed by various members of the GoldSrc modding community.<ref>Community contributions and project history documented via development repositories and community showcases.</ref>

It completely overhauls the aging fixed-function OpenGL pipeline of classic GoldSrc-driven games like Template:HL and Template:CS in favor of a modern, programmable shader architecture. By replacing the native `hw.dll` or intercepting standard rendering pipelines, Trinity Renderer enables advanced graphical features typically reserved for modern engines while strictly maintaining compatibility with existing GoldSrc assets, maps (`.bsp`), models (`.mdl`), and network protocols.

History

The project was started by Andrew Lucas (known in the community as CastleBravo or Highlander) to push the boundaries of what the GoldSrc engine could visually achieve without moving projects entirely to Source. Recognizing the structural limitations of the original engine's immediate-mode OpenGL architecture, Lucas designed Trinity to completely intercept or replace the original rendering DLLs.

Over time, the project evolved into a collaborative effort, with various programmers and graphics engineers from the Half-Life modding community contributing optimizations, bug fixes, and expanded material pipeline features.

Features

Modern Rendering Pipeline

  • Programmable Shaders: Fully transitions the engine from the fixed-function pipeline to GLSL (OpenGL Shading Language) or HLSL-equivalent modern shaders.
  • Dynamic Lighting & Shadows: Implements real-time dynamic per-pixel lighting, allowing moving light sources to cast accurate, soft, or hard shadows instead of relying solely on static lightmaps.
  • Physically Based Rendering (PBR): Support for PBR materials, utilizing Albedo, Normal, Roughness, and Metallic maps alongside traditional GoldSrc textures.

Advanced Visual Effects

  • High Dynamic Range (HDR): Adds true HDR rendering alongside tone mapping, bloom, and screen-glare effects.
  • Screen-Space Effects: Implements modern post-processing techniques such as Screen Space Ambient Occlusion (SSAO), Screen Space Reflections (SSR), and depth of field.
  • Improved Water Shaders: Replaces classic flat water textures with real-time reflections, refractions, and depth-based murkiness/fresnel effects.
  • Normal and Parallax Mapping: Adds depth to standard flat world and model textures through bump mapping and parallax occlusion mapping.

Performance & Quality-of-Life

  • Enhanced Memory Management: Optimizes engine boundaries to mitigate classic GoldSrc limits like `MAX_MAP_MODELS` or texture allocation crashes.
  • Native Widescreen & High-DPI Support: Properly scales the field of view (FOV) and User Interface components for modern 4K and ultra-widescreen displays.
  • Anti-Aliasing & Filtering: Implements hardware-level MSAA/FXAA and high-degree Anisotropic Filtering natively.

Technical Architecture

Trinity Renderer interfaces with GoldSrc primarily through two common methodologies:

  1. Client-side Extension: Hooking directly into the client library (`client.dll`) via standard GoldSrc export tables.
  2. Renderer Wrapping / API Injection: Intercepting original OpenGL API calls or acting as a custom wrapper to pipe old engine commands into a modern core layout.

Because it utilizes standard graphics APIs under the hood, it circumvents standard engine constraints, allowing vertex layouts to be batched and instanced more efficiently than the original engine's immediate-mode architecture (`glBegin` / `glEnd`).

Installation and Usage

For Players / Mods

  1. Download the latest binary release from the official repository.
  2. Extract the contents (typically files like `trinity_renderer.dll` or custom `opengl32.dll` wrappers) directly into your main Template:HL directory (where `hl.exe` resides).
  3. Launch the game. If the renderer uses a custom launcher or command line parameters, specify them in Steam's Launch Options:

<vclog> -game cstrike -trinity </vclog>

For Level Designers and Artists

Trinity supports extra material definitions via external script files (such as `.mat` or `.json` layouts) placed within the mod directories. This allows modders to link PBR textures or custom normal maps to classic textures without recompiling the original `.bsp` map file.

Console Variables & Commands

Trinity Renderer introduces several console variables (CVars) to fine-tune graphics performance:

CVar/Command Default Description
tr_ambient_occlusion 1 Toggles Screen Space Ambient Occlusion (SSAO).
tr_pbr_enable 1 Enables or disables physically-based rendering paths for textures.
tr_bloom_intensity 0.5 Adjusts the brightness scaling of the bloom/glare post-process pass.
tr_shadows 1 Enables or disables real-time dynamic shadows from entities.
tr_reload_shaders N/A Command: Hot-reloads all GLSL shader programs from disk without restarting the game.

References

Missing Parameter {{{1}}} in template {{References}}.

See Also

  • GoldSrc
  • Xash3D — An open-source compatibility engine with its own unique rendering backends.

External Links