forge-linear-fog

Apply depth-based fog to SDL GPU fragment shaders after lighting.

Updated Mar 17, 2026
One-click install
npx skills add https://github.com/code-review-benchmark/coderabbit_prs2__forge-gpu__coderabbit__PR323__20260317 --skill forge-linear-fog
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: forge-linear-fog
Source: https://github.com/code-review-benchmark/coderabbit_prs2__forge-gpu__coderabbit__PR323__20260317/tree/main/.claude/skills/forge-linear-fog
Command: npx skills add https://github.com/code-review-benchmark/coderabbit_prs2__forge-gpu__coderabbit__PR323__20260317 --skill forge-linear-fog

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adds depth-based distance fog to any SDL GPU scene to simulate atmospheric perspective and improve depth cues by fading distant objects toward a fog color.

Core Features & Use Cases

  • Distance-based fog: supports linear, exponential, and exponential-squared modes to fade distant geometry toward a fog color.
  • Shader integration: designed to be appended to an existing fragment shader pipeline and blended after lighting.
  • Practical use cases: enhance realism for outdoor scenes, reduce Z-fighting visibility at far distances, and simulate haze or weather effects.

Quick Start

Add the fog uniform block (fog_color, fog_start, fog_end, fog_density, fog_mode) and implement the depth-based fog calculation in your fragment shader to blend with the lit color after lighting.

Frequently Asked Questions about forge-linear-fog

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add depth fog to an SDL GPU scene?

To add depth fog to an SDL GPU scene, append a fog uniform block to your shaders and calculate distance-based blending in the fragment shader after lighting. This simulates atmospheric perspective by fading distant geometry toward a specified fog color.

Can I use different fog modes like exponential in an SDL3 GPU fragment shader?

Yes, the fog implementation supports linear, exponential, and exponential-squared fog modes. You can configure these modes within the fog uniform block alongside fog_color, fog_start, fog_end, and fog_density to achieve varied atmospheric perspective effects.

What uniforms do I need to set up for distance fog in an HLSL shader?

You need to set up a fog uniform block containing fog_color, fog_start, fog_end, fog_density, and fog_mode. These parameters drive the depth-based fog calculation applied in the fragment shader after lighting.

Does depth fog integration work with dynamic cameras and outdoor lighting?

Yes, depth fog is designed for real-time 3D SDL3 GPU applications with dynamic cameras and varied lighting. It calculates distance based on depth values, ensuring atmospheric perspective remains accurate as cameras move through outdoor scenes.

Why apply distance fog after lighting in the fragment shader?

Applying distance fog after lighting ensures the fog color blends correctly with the final lit surface colors. This approach preserves local lighting details on nearby objects while smoothly fading distant geometry to simulate atmospheric haze.

What is the best way to reduce Z-fighting visibility at far distances in SDL3?

Applying distance fog is an effective way to reduce Z-fighting visibility at far distances. By fading distant geometry toward a fog color using linear or exponential modes, depth precision artifacts become visually obscured in outdoor scenes.