========================================================= ================== FX FILE INFORMATION ================= ========================================================= The shader is written in HLSL (High-Level Shader Language), which is used for creating shaders in Microsoft DirectX. Key Details: - Shader Language: HLSL > HLSL is the primary shading language for all DirectX graphics APIs (e.g., DirectX 9, 10, 11, and 12). - DirectX Version: DirectX 9 > The vs_4_0 and ps_4_0 in your shader indicate that it's using Shader Model 4.0, but it’s most likely limited to DirectX 9 in the Strike Fighters 2 (SF2) engine. - Shader Model: 4.0 > While Shader Model 4.0 technically belongs to DirectX 10, the SF2 engine often operates in DirectX 9 compatibility mode, meaning features from Shader Model 4.0 are limited. - Purpose in SF2: > The SF2 engine uses these shaders to define rendering behaviors, including how textures, colors, and effects are processed. HLSL shaders in SF2 modify existing graphics rather than creating new rendering pipelines. Why Shader Model 4.0? - vs_4_0 (Vertex Shader 4.0) and ps_4_0 (Pixel Shader 4.0) specify Shader Model 4.0, which: > Supports more advanced features than earlier versions, such as dynamic branching, integer/float precision, and looping. > Can handle more complex pixel and vertex transformations. However, because Strike Fighters 2 uses DirectX 9, Shader Model 4.0 features might not be fully utilized or supported by the engine. Summary Language: HLSL Version: Shader Model 4.0 (likely running in a DirectX 9 environment for SF2) --------------------------------------------------------- --------------------------------------------------------- --------------------------------------------------------- ----- EFFECTS ----- EFFECTCHAFF.FX EFFECTCOLOR1ADD.FX EFFECTFIRE.FX EFFECTLIGHTADD.FX EFFECTLIGHTLEVEL.FX EFFECTLIGHTLEVELADD.FX ----- ENIVORNMENT ----- ENVCLOUDLAYER.FX ENVCLOUDS.FX ENVHORIZON.FX ENVMOON.FX ENVRAIN.FX ENVSKY.FX ENVSTAR.FX ENVSUN.FX ENVSUNFLARE.FX ----- AVIONIC ----- FLTDTVFILTER.FX FLTGUNSIGHT.FX FLTHUD.FX ----- MESH - DECALS ----- MESHDECAL1.FX MESHDECAL1BUMP.FX MESHDECAL1BUMPSPEC.FX MESHDECAL1SPEC.FX MESHDECAL2.FX MESHDECAL2BUMP.FX MESHDECAL2BUMPSPEC.FX MESHDECAL2SPEC.FX MESHDECAL3.FX MESHDECAL3BUMP.FX MESHDECAL3BUMPSPEC.FX MESHDECAL3SPEC.FX MESHDECAL4.FX MESHDECAL4BUMP.FX MESHDECAL4BUMPSPEC.FX MESHDECAL4SPEC.FX MESHDECAL5.FX MESHDECAL5BUMP.FX MESHDECAL5BUMPSPEC.FX MESHDECAL5SPEC.FX MESHDECAL6.FX MESHDECAL6BUMP.FX MESHDECAL6SPEC.FX MESHDECAL7.FX ----- MESH - NO TEXTURE ----- MESHNOTEXTURE.FX MESHNOTEXTUREALPHA.FX MESHNOTEXTUREREFLECTION.FX ----- MESH - REFLECTION ----- MESHREFLECTION.FX MESHREFLECTIONBUMP.FX MESHREFLECTIONBUMPSPEC.FX MESHREFLECTIONDECAL1.FX MESHREFLECTIONDECAL1BUMP.FX MESHREFLECTIONDECAL1BUMPSPEC.FX MESHREFLECTIONDECAL1SPEC.FX MESHREFLECTIONDECAL2.FX MESHREFLECTIONDECAL2BUMP.FX MESHREFLECTIONDECAL2BUMPSPEC.FX MESHREFLECTIONDECAL2SPEC.FX MESHREFLECTIONDECAL3.FX MESHREFLECTIONDECAL3BUMP.FX MESHREFLECTIONDECAL3BUMPSPEC.FX MESHREFLECTIONDECAL3SPEC.FX MESHREFLECTIONDECAL4.FX MESHREFLECTIONDECAL4BUMP.FX MESHREFLECTIONDECAL4BUMPSPEC.FX MESHREFLECTIONDECAL4SPEC.FX MESHREFLECTIONDECAL5.FX MESHREFLECTIONDECAL5BUMP.FX MESHREFLECTIONDECAL5SPEC.FX MESHREFLECTIONDECAL6.FX MESHREFLECTIONSPEC.FX ----- MODEL ----- MODELCANOPY.FX ----- SHHADER ----- shader.fx ----- SHADOW #1 ----- SHADOWVOLUMEDX9.FX ----- TERRAIN ----- TERALPHAOBJECT.FX TERFARTERRAINEFFECT.FX TERFARTERRAINEFFECTDX9.FX TERSOLIDOBJECT.FX TERTERRAINEFFECT.FX TERTERRAINEFFECTDX9.FX TERWATEREFFECT0.FX TERWATEREFFECT0DX9.FX TERWATEREFFECT1.FX TERWATEREFFECT1DX9.FX TERWATEREFFECT2.FX TERWATEREFFECT2DX9.FX ----- TW COLOR ----- TWCOLOR0.FX TWCOLOR1.FX TWCOLOR2.FX TWCOLOR8.FX TWCOLORBIAS.FX ----- TW TEXT / FORMATS ----- TWFONT.FX TWLINE.FX ----- TW NORMAL ----- TWNORMAL1.FX TWNORMAL1BUMP.FX TWNORMAL1BUMPSPEC.FX TWNORMAL1SPEC.FX TWNORMAL2.FX TWNORMAL8.FX ----- TW POST PROCESS ----- TWPOSTPROCESS.FX ----- SHADOW #2 ----- TWSHADOWDYNAMIC.FX TWSHADOWSTATIC.FX ----- STENCIL BUFFER ----- TWSTENCIL.FX ----- TW TRANSFORMATION ----- TWTRANSFORMED0.FX TWTRANSFORMED1.FX TWTRANSFORMED2.FX TWTRANSFORMED8.FX ========================================================= =================== FX FILE CONTENTS =================== ========================================================= ---------------------------------------------------------- ------------------------- EFFECTS ------------------------ ---------------------------------------------------------- EFFECTCHAFF.FX PURPOSE: - This shader renders chaff countermeasures with dynamic visual effects such as cycling noise patterns, speckled highlights, and fog blending. KEY FEATURES: - Dynamic Speckle Effect: > The vertex shader generates a time-dependent speckle pattern (input.uv.z) using a sinusoidal function with adjustable parameters: * CycleRate: Controls the speed of the noise cycle. * NoiseScale: Modifies the spatial variation of the noise. > The pixel shader enhances the chaff’s brightness by adding the speckle pattern to the color output. - Fog Integration: > Adds fog based on both distance and layer-based fog parameters (g_FogDistance, g_FogLayer). > Smoothly fades the chaff into the fog color (add_fog_fade_alpha function). - Texture Sampling: > Samples a material texture (g_MaterialTexture) to define the chaff’s base appearance, with anisotropic filtering for better quality. - Vertex Outputs: > Passes world-space position and dynamic noise parameters to the pixel shader for visual enhancements. ---------------------------------------------------------- EFFECTCOLOR1ADD.FX PURPOSE: - This shader renders textured objects with additive fog blending and diffuse lighting, ensuring smooth integration into foggy environments. KEY FEATURES: - Diffuse Lighting and Texturing: > Multiplies the vertex diffuse color (input.diffuse) with a sampled texture (g_MaterialTexture) for base color and detail. - Additive Fog Effects: > Applies distance-based fog and layer-based fog using the multiply_fog function. > Blends fog additively, fading object colors based on distance and altitude parameters (g_FogDistance, g_FogLayer). - Vertex and Pixel Outputs: > Computes and passes world-space positions and fog distance values from the vertex shader to the pixel shader for fog calculation. - Lighting Adjustments: > Includes a global light level (g_LightLevel) to modulate overall object brightness (although it’s not explicitly applied in the shader). ---------------------------------------------------------- EFFECTFIRE.FX PURPOSE: - This shader is designed to render fire effects with adjustable brightness and smooth fog integration, providing a dynamic, glowing appearance. KEY FEATURES: - Fire Texture and Brightness Control: > Samples the fire’s texture (g_MaterialTexture) and modulates it with the vertex diffuse color (input.diffuse). > Enhances brightness with a tunable constant (g_Brightness), outputting a secondary render target (output.bright) for glow or HDR effects. - Fog Effects: > Applies distance-based and layer-based fog using the multiply_fog2 function. > Smoothly fades fire into fog layers while maintaining its glowing appearance. > Uses an exponential fog calculation for more gradual blending (fog*fog). - Multi-Target Output: > Outputs: * Main Color (output.color): The fire’s base color with fog blending. * Brightness (output.bright): A secondary value for post-processing glow or bloom effects. - Global Parameters: > Supports configurable fog distances, layer thickness, and brightness through the constant buffers. ---------------------------------------------------------- EFFECTLIGHTADD.FX PURPOSE: - A shader for rendering textured objects with additive fog effects and diffuse lighting, blending smoothly into the fog for enhanced visual depth. KEY FEATURES: - Diffuse Lighting and Texturing: > Combines vertex diffuse color (input.diffuse) with a sampled texture (g_MaterialTexture) to create the base color. - Fog Integration: > Applies both distance-based fog and layer-based fog using the multiply_fog2 function. > Smoothly blends fog additively with an exponential falloff (fog*fog), providing more gradual transitions. - Vertex Outputs: > Passes world-space position and fog-related distance values from the vertex shader to the pixel shader for fog computation. - Light Level Adjustment: > Includes support for adjusting brightness globally using g_LightLevel. ---------------------------------------------------------- EFFECTLIGHTLEVEL.FX PURPOSE: A shader for rendering textured objects that respond to a constant light level, with optional fog effects applied based on distance and altitude. KEY FEATURES: - Light Level Modulation: > Multiplies the vertex diffuse color by the constant light level (g_LightLevel), affecting the overall brightness of the object. - Fog Integration > Includes fog effects based on: * Distance-based fog: Gradually fades object color into fog color as distance increases. * Layer-based fog: Applies additional fogging for objects within a defined altitude and thickness range (g_FogLayer). > Fog is blended using the add_fog_fade_alpha function with smooth transitions. - Texture Sampling: >Uses anisotropic filtering for smooth and detailed texture rendering (g_MaterialTexture.Sample). - Vertex Outputs: > Passes world-space position and fog-related distance data to the pixel shader for fog computation. ---------------------------------------------------------- EFFECTLIGHTLEVELADD.FX PURPOSE: - A shader for rendering textured objects that respond to a constant light level, with additive fog effects that gradually fade the object’s brightness into the fog color. KEY FEATURES: - Light Level Modulation: > Multiplies vertex diffuse color by the constant light level (g_LightLevel), affecting the object’s brightness. - Additive Fog Effects: > Distance Fog: Adds fog based on distance from the camera using g_FogDistance. > Layer Fog: Adds additional fogging for objects within a specific altitude and thickness (g_FogLayer). > Blends fog additively, fading object brightness by decreasing its intensity (multiply_fog function). - Texture Sampling: > Samples the object’s texture with anisotropic filtering (g_MaterialTexture.Sample). - Vertex Outputs: > Passes world-space position and fog-related distance data to the pixel shader for fog calculations. ---------------------------------------------------------- ----------------------- ENIVORNMENT ---------------------- ---------------------------------------------------------- ENVCLOUDLAYER.FX PURPOSE: - This shader renders cloud layers with diffuse lighting and fog integration, allowing clouds to blend seamlessly into the atmospheric environment. KEY FEATURES: - Cloud Texture and Lighting: > Samples the cloud layer’s texture (g_MaterialTexture) and modulates it with the vertex diffuse color (input.diffuse.rgb) for shading. - Fog Integration: > Smoothly blends cloud color into the fog color based on distance (g_FogDistance), using the add_fog function. > Automatically fades clouds into the fog when their distance exceeds a certain threshold (g_FogDistance.y). - Distance-Based Fogging: > Calculates fog contribution based on the view-space Z-distance (input.fogdist), ensuring realistic fading with depth. - Vertex Outputs: > Passes UV coordinates, diffuse color, and fog distance to the pixel shader for cloud rendering and fog calculations. ---------------------------------------------------------- ENVCLOUDS.FX PURPOSE: - This shader renders individual cloud objects with texture-based diffuse lighting and integrates them into the environment using distance-based fog effects. KEY FEATURES: - Cloud Texturing and Lighting: > Samples the cloud’s texture (g_MaterialTexture) and modulates it with the vertex diffuse color (input.diffuse) to create shaded cloud visuals. - Fog Integration: > Applies fog based on distance (g_FogDistance), gradually blending the cloud color into the fog color (g_FogColor). > When the fog distance exceeds a threshold (g_FogDistance.y), the cloud color is completely replaced by the fog color. - Smooth Blending: > Uses linear interpolation to mix the cloud’s color with the fog color as the fog’s influence increases. - Distance Calculations: > Calculates fog contribution dynamically based on the view-space Z-distance (input.fogdist). ---------------------------------------------------------- ENVHORIZON.FX PURPOSE: - This shader renders the horizon line or environmental backdrop using a textured surface modulated by vertex diffuse color, with an optional offset for positioning. KEY FEATURES: - Horizon Positioning: > The vertex positions are adjusted using an offset position vector (g_MeshOffsetPos) to align the horizon or environment mesh in world space. - Texturing and Color Blending: > Samples the horizon texture (g_MaterialTexture) using UV coordinates. > Multiplies the texture color by the vertex diffuse color (input.diffuse) for additional shading or customization. - Vertex Transformation: > Transforms world-space vertex positions to clip space using the view-projection matrix (g_mViewProj). ---------------------------------------------------------- ENVMOON.FX PURPOSE: - This shader renders the moon or other circular environmental elements by mapping a texture in screen space with transparency controlled by vertex diffuse alpha. KEY FEATURES: - Screen-Space Positioning: > Converts vertex positions from screen space to clip space coordinates using the screen width, height, and top-left viewport corner (g_InvScreenWidth, g_InvScreenHeight, g_ViewportTopLeft). > Ensures the moon stays fixed relative to the screen or viewport. - Texturing with Transparency: > Samples the moon texture (g_MaterialTexture) and modulates its alpha with the vertex diffuse alpha (input.diffuse.a) for smooth transparency effects. - Vertex Outputs: > Passes UV coordinates and vertex diffuse color to the pixel shader for texture sampling and color modulation. ---------------------------------------------------------- ENVRAIN.FX PURPOSE: - This shader renders rain effects with transparency that fades over distance and integrates into the environment using fog blending. KEY FEATURES: - Distance-Based Transparency: > Reduces the alpha value of the rain effect with distance using a smoothstep function (smoothstep(0.0f, 2000.0f, input.pos_w.w)), creating a natural fade-out beyond 2 km. - Fog Integration: > Applies both distance-based fog and layer-based fog using the add_fog_fade_alpha function. > Ensures that the rain fades smoothly into the fog color (g_FogColor) as it recedes into the environment. - Simple Diffuse Shading: > Uses the vertex diffuse color (input.diffuse) as the base color for the rain effect. - World-Space Positioning: > Calculates fog effects and transparency based on the view-space Z-distance (input.pos_w.w) and world-space position (input.pos_w.xyz). ---------------------------------------------------------- ENVSKY.FX PURPOSE: -This shader renders a simple sky or background element using vertex diffuse color with an optional position offset. KEY FEATURES: - Vertex Position Offset: > Applies an offset to vertex positions using the g_MeshOffsetPos constant to reposition the sky element in world space. - Diffuse Color Rendering: > Outputs the vertex diffuse color (input.diffuse) directly, without texturing or additional lighting calculations. - View-Projection Transformation: > Transforms the world-space position of each vertex into clip space using the view-projection matrix (g_mViewProj). ---------------------------------------------------------- ENVSTAR.FX PURPOSE: - This shader renders stars or celestial elements in the environment by mapping a texture to screen-space coordinates and blending it with vertex diffuse color. KEY FEATURES: - Screen-Space Positioning: > Converts vertex positions from screen coordinates to clip space coordinates using screen dimensions (g_InvScreenWidth, g_InvScreenHeight) and the viewport offset (g_ ViewportTopLeft). - Texturing and Color Blending: > Samples a texture (g_MaterialTexture) to define the star pattern or celestial feature. > Multiplies the sampled texture color with the vertex diffuse color for blending and customization. - Vertex Outputs: > Passes UV coordinates and vertex diffuse color to the pixel shader for texture sampling and modulation. ---------------------------------------------------------- ENVSUN.FX PURPOSE: - This shader renders the sun with high dynamic range (HDR) effects, enhanced brightness, and alpha-based modulation for smooth transitions and glowing effects. KEY FEATURES: - Screen-Space Positioning: > Converts vertex positions from screen coordinates to clip space using screen dimensions (g_InvScreenWidth, g_InvScreenHeight) and viewport offset (g_ViewportTopLeft). - Texturing and Brightness Control: > Samples a sun texture (g_MaterialTexture) and applies alpha modulation based on the vertex diffuse alpha (input.diffuse.a). > Scales brightness dynamically for HDR effects when the alpha value exceeds a threshold (g_HDRThreshold): * output.color.rgb× = (1.0 + (input.diffuse.a × gHDRMultiplier x (output.color.a − gHDRThreshold))) - Dual Render Targets: > Outputs: * color (Main Color): The textured sun color with brightness adjustments. * bright (Brightness): A separate render target for use in post-processing, scaled by a global brightness factor (g_Brightness). ---------------------------------------------------------- ENVSUNFLARE.FX PURPOSE: - This shader renders sun flare effects, blending texture-based visuals with alpha transparency to simulate lens flares or light scattering. KEY FEATURES: - Screen-Space Positioning: > Converts vertex positions from screen coordinates to clip space using screen dimensions (g_InvScreenWidth, g_InvScreenHeight) and the viewport offset (g_ViewportTopLeft). - Texturing and Alpha Blending: > Samples the flare texture (g_MaterialTexture) and modulates its alpha with the vertex diffuse alpha (input.diffuse.a) to control transparency. - Simplified Rendering Pipeline: > Focuses on lightweight calculations, making it suitable for performance-critical effects like sun flares or other light artifacts. ---------------------------------------------------------- ------------------------ TV FILTER ----------------------- ---------------------------------------------------------- FLTDTVFILTER.FX PURPOSE - This shader applies a luminance-based filter to a rendered scene, effectively converting it to grayscale. It utilizes precise color space conversions for accurate representation of luminance. KEY FEATURES - Grayscale Conversion: > Uses the luminance weights `{0.2125, 0.7154, 0.0721}` to calculate brightness based on human perception. > Converts the scene to grayscale by setting R, G, and B channels to the calculated luminance. - Color Space Conversion: > Provides utility functions for RGB to Yxy and Yxy to RGB conversion: - `GetYxyFromRGB`: Converts RGB to Yxy for alternative processing pipelines. - `GetRGBFromYxy`: Converts Yxy back to RGB, ensuring positive color values. - Efficient Texture Sampling: > Samples the rendered scene texture (`g_RenderedScene`) with `PointSampler` for pixel - level precision. - Simplicity: > Designed for minimal performance overhead in luminance extraction. ---------------------------------------------------------- ------------------------- AVIONIC ------------------------ ---------------------------------------------------------- FLTGUNSIGHT.FX PURPOSE: This shader renders gunsight elements, such as reticles or HUD overlays, by combining texture-based visuals with vertex diffuse colors for modulation. KEY FEATURES: - World-Space Positioning: > Transforms vertex positions from mesh space to world space and then to clip space using the mesh-to-world matrix (g_mMeshToWorld) and the view-projection matrix (g_mViewProj). - Texturing and Color Modulation: > Samples the gunsight texture (g_MaterialTexture) using UV coordinates. > Multiplies the sampled texture with the vertex diffuse color (input.diffuse) to allow dynamic coloration or transparency adjustments. - Minimalist Shader Design: > Focused solely on gunsight rendering, making it efficient and easy to integrate into cockpit or HUD systems. ---------------------------------------------------------- FLTHUD.FX PURPOSE: - This shader renders HUD (Head-Up Display) elements by combining texture-based visuals with vertex diffuse colors, with the option to use either wrapping or clamping for texture addressing. KEY FEATURES: - Screen-Space Positioning: > Converts vertex positions from screen coordinates to clip space using the screen dimensions (g_InvScreenWidth, g_InvScreenHeight) and the viewport's top-left corner (g_ViewportTopLeft). - Texture Addressing Modes: > Supports two addressing modes controlled by the g_bClampTexture flag: * Wrap (g_TextureWrapSampler): Textures repeat outside their bounds. * Clamp (g_TextureClampSampler): Textures are constrained to their edges. - Texturing and Color Modulation: > Samples the HUD texture (g_MaterialTexture) using UV coordinates. > Multiplies the sampled texture with the vertex diffuse color (input.diffuse) to allow dynamic adjustments, such as brightness or transparency. - Customizability: > Enables dynamic texture behavior via the g_bClampTexture flag, making it adaptable for various HUD designs. ---------------------------------------------------------- ---------------------- MESH - DECALS --------------------- ---------------------------------------------------------- MESHDECAL1.FX PURPOSE: - This shader handles mesh rendering with decals, supporting advanced lighting effects, fog integration, and customizable texture behavior for both base materials and decals. KEY FEATURES: - Advanced Lighting: > Supports ambient and diffuse lighting using global settings and directional, point, and spotlight sources. > Computes specular highlights with customizable intensity (g_SpecularLevel), power (g_SpecularPower), and color (g_SpecularColor). - Decal Integration: > Applies a secondary texture (g_MaterialTexture1) as a decal layer. > Blends decals with the base texture using alpha blending to allow smooth transitions. - Fog Effects: > Integrates distance-based fog and layer-based fog, blending the rendered color with the fog color (g_FogColor) depending on view-space Z-distance (input.pos_w.w) and altitude. - Reflection Handling: > Includes logic to handle reflection rendering, clipping fragments if needed based on camera position and reflection distance. - Texture Addressing: > Supports wrapping or clamping for textures based on the g_bClampTexture flag, allowing flexibility for texture tiling or edge-constrained visuals. - Efficient Math for Precision: > Includes optimized calculations for position transformations, such as a Kahan summation algorithm for higher precision in Z-depth computations. - Dynamic Lighting Per Pixel: > Calculates lighting effects per pixel using world-space normals, allowing for more realistic light interactions. - Vertex Outputs: > Transforms vertex positions from world space to view-projection space. > Passes world-space normals, position, and UV coordinates to the pixel shader. ---------------------------------------------------------- MESHDECAL1BUMP.FX PURPOSE: - This shader is designed for rendering mesh objects with bump mapping and decals, incorporating advanced lighting, fog, and texture handling for realistic surface details and effects. KEY FEATURES: - Bump Mapping: > Adds surface detail by using a normal map (g_BumpNormalTexture) to perturb the surface normals. > Computes tangent-space normals for accurate light interaction using a tangent frame derived from UV coordinates and surface geometry. - Advanced Lighting: > Implements ambient, diffuse, and specular lighting using directional, point, and spotlights. > Includes customizable specular highlights controlled by g_SpecularLevel, g_SpecularPower, and g_SpecularColor. - Decal Support: > Applies a secondary texture (g_MaterialTexture2) as a decal layer. > Blends decals with the base texture using alpha blending for subtle or pronounced overlays. - Fog Integration: > Adds distance-based and layer-based fog effects, blending the rendered color with g_FogColor based on depth and altitude. - Dynamic Lighting Per Pixel: > Performs lighting calculations per pixel, including bump-mapped normals for enhanced realism. - Customizable Texture Sampling: > Supports wrapping or clamping for textures, depending on g_bClampTexture. > Separate samplers for the base texture and bump map ensure flexibility in addressing modes. - Precision Handling: > Uses optimized position calculations to minimize Z-depth precision loss, crucial for complex scenes. - Reflection Clipping: > Includes clipping logic for reflections, ensuring objects render appropriately in reflective environments. - Vertex Outputs: > Outputs world-space positions, normals, and tangent-space UVs to the pixel shader for detailed lighting and texturing. ---------------------------------------------------------- MESHDECAL1BUMPSPEC.FX PURPOSE: - This shader is designed for rendering mesh objects with bump mapping, specular highlights, and decals, utilizing advanced per-pixel lighting, texture blending, and fog effects for high-quality visuals. KEY FEATURES: - Bump Mapping: > Utilizes a normal map (g_MaterialTexture1) to simulate surface details. > Computes per-pixel normals in tangent space using a dynamically generated tangent frame. - Specular Highlights: > Adds specular reflections using a specular map (g_MaterialTexture2) for more realistic light reflections. > Customizable via parameters like g_SpecularLevel, g_SpecularPower, and g_SpecularColor. - Decal Layering: > Supports additional decal textures (g_MaterialTexture3) for blending overlays onto the base texture. > Decals blend with diffuse and specular components based on alpha transparency. - Advanced Lighting: > Implements ambient, diffuse, and specular lighting using directional, point, and spotlights. > Performs lighting computations in tangent space for enhanced realism. - Customizable Texture Sampling: > Handles texture wrapping or clamping for base textures, bump maps, and decals using dedicated samplers. - Fog Integration: > Supports distance-based and layered fog effects, blending colors with g_FogColor based on depth and altitude. - Per-Pixel Lighting Calculations: > Includes per-pixel light and specular computations for realistic illumination. - Reflection Clipping: > Prevents objects from incorrectly appearing in reflective surfaces using clipping logic. - Multi-Texture Support: > Four textures are used: * Base texture (g_MaterialTexture0). * Bump map (g_MaterialTexture1). * Specular map (g_MaterialTexture2). * Decal texture (g_MaterialTexture3). - Vertex and Pixel Outputs: > Outputs world-space positions, normals, and tangent-space UVs from the vertex shader. > Processes diffuse, specular, and fog effects in the pixel shader. ---------------------------------------------------------- MESHDECAL1SPEC.FX Overview: - This shader is designed for rendering mesh objects with specular highlights and decals, while supporting advanced per-pixel lighting and fog effects. It is optimized for realistic visuals in scenarios involving ambient, diffuse, and specular lighting. KEY FEATURES: - Per-Pixel Specular Highlights: > Implements specular reflections based on surface normals and a specular map (g_MaterialTexture1). > Specular intensity is controlled by: * g_SpecularLevel: Overall specular intensity. * g_SpecularPower: Controls the sharpness of specular highlights. * g_SpecularColor: Color of specular highlights. - Decal Blending: > Applies decals (g_MaterialTexture2) over the base texture. > Decals blend with the underlying texture using alpha transparency, supporting up to 40% specular influence for decals. - Advanced Lighting: > Supports ambient, diffuse, and specular lighting with directional, point, and spotlights. > Computes per-pixel lighting for realistic illumination: * Directional light (g_DirLight). * Multiple point lights (g_aPointLights). * Multiple spotlights (g_aSpotLights). - Fog Effects: > Adds realistic fog blending based on: * Distance (g_FogDistance). * Altitude (g_FogLayer). > Customizable fog color (g_FogColor). - Customizable Texture Sampling: > Supports wrapping or clamping for texture sampling (g_bClampTexture). - Multi-Texture Support: > Uses three textures: * Base texture (g_MaterialTexture0). * Specular map (g_MaterialTexture1). * Decal texture (g_MaterialTexture2). - Reflection Clipping: > Prevents rendering artifacts in reflective surfaces using the g_bInReflection parameter. ---------------------------------------------------------- MESHDECAL2.FX Overview: - The MESHDECAL2.FX shader renders objects with support for multi-layered decals, lighting effects, and fog. It incorporates ambient, diffuse, and specular lighting and applies two decal layers on top of the base texture. KEY FEATURES: - Lighting System: > Directional Lighting: * Defined by g_DirLight, simulates light from a distant source like the sun. > Point Lights and Spotlights: * Supports up to 8 point lights and 2 spotlights, enabling detailed local lighting. > Ambient and Diffuse Lighting: *Uses the compute_per_pixel_ambient_diffuse function to calculate pixel-level diffuse and ambient lighting based on surface normals and light sources. > Specular Highlights: * Added using the compute_per_pixel_specular function, controlled by: - g_SpecularLevel: Intensity. - g_SpecularPower: Sharpness. - g_SpecularColor: Highlight color. - Multi-Decal Support: > Supports two decal layers (g_MaterialTexture1 and g_MaterialTexture2) applied over the base texture (g_MaterialTexture0). > Decals blend with the base texture using alpha transparency. - Fog Effects: > Adds fog to simulate atmospheric effects: > Distance Fog: Blends fog based on camera distance (g_FogDistance). > Layered Fog: Adds altitude-based fog for realistic visuals (g_FogLayer). - Texture Sampling: > Textures are sampled with wrapping or clamping behavior based on g_bClampTexture. - Shader Precision: > Utilizes custom compute_pos for accurate vertex position transformation, reducing precision loss. - Customizable Materials: > Per-material parameters allow enabling/disabling fog (g_bFogEnabled), lighting (g_bLightEnabled), and specular highlights (g_bSpecularEnabled). ---------------------------------------------------------- MESHDECAL2BUMP.FX PURPOSE: - Renders objects with multi-layered decals, bump mapping, and lighting effects. It supports detailed light interactions with surface normals, including ambient, diffuse, and specular components, and applies fog for atmospheric effects. KEY FEATURES: - Bump Mapping: > Utilizes a normal map (g_BumpNormalTexture) for enhanced surface detail. > Calculates tangent space for accurate bump mapping effects. - Lighting System: > Supports directional, point, and spotlights. > Calculates ambient, diffuse, and specular lighting per pixel. > Adjustable specular level, power, and color. - Multi-Decal Support: > Blends up to two decal layers (g_MaterialTexture2, g_MaterialTexture3) over the base texture (g_MaterialTexture0). - Fog Effects: > Adds distance-based and altitude-based fog to the scene. - Customizable Textures: > Allows texture wrapping or clamping based on g_bClampTexture. - High Precision Positioning: > Computes vertex positions with minimized precision loss for accurate rendering. ---------------------------------------------------------- MESHDECAL2BUMPSPEC.FX PURPOSE: - Provides advanced rendering for objects with multi-layered decals, bump mapping, and specular effects. Incorporates realistic lighting and fog for immersive visual fidelity. KEY FEATURES: - Bump Mapping: > Normal map-based bump effects (g_MaterialTexture1) using tangent space computation. - Specular Effects: > Specular highlights modulated by a specular map (g_MaterialTexture2). > Adjustable specular level, power, and color for precise customization. - Multi-Decal Support: > Supports up to two decals (g_MaterialTexture3, g_MaterialTexture4) layered on the base texture. - Lighting System: > Directional, point, and spotlight calculations per pixel. > Dynamic diffuse and specular lighting based on material and light properties. - Fog Integration: > Distance-based and altitude-based fog blending with configurable parameters. - Precision Positioning: > Enhanced position calculations to reduce precision loss for large scenes. Texture Sampling: > Flexible wrapping or clamping of textures controlled by g_bClampTexture. ---------------------------------------------------------- MESHDECAL2SPEC.FX PURPOSE: - Handles rendering of mesh decals with support for specular highlights and multiple decal layers. Provides realistic lighting and fog for enhanced scene depth and detail. KEY FEATURES: - Specular Mapping: > Uses a specular map (g_MaterialTexture1) to control specular intensity on surfaces. > Adjustable specular level and power for custom highlights. - Multi-Decal Support: > Supports up to two decals (g_MaterialTexture2, g_MaterialTexture3) layered on the base texture with blending. - Lighting System: > Per-pixel ambient, diffuse, and specular lighting using directional, point, and spotlights. > Specular reflections modulated by the specular map for dynamic highlights. - Fog Integration: > Adds distance-based and altitude-based fog effects for visual depth. - Texture Sampling Options: > Flexible texture addressing modes with wrapping or clamping based on g_bClampTexture. - Efficient Position Calculation: > Precise computations to minimize z-buffer precision loss for large scenes. ---------------------------------------------------------- MESHDECAL3.FX PURPOSE: - Supports rendering mesh decals with multiple decal layers while incorporating ambient, diffuse, and specular lighting. Designed for use in complex 3D scenes with fog and advanced lighting effects. KEY FEATURES: - Multi-Decal Layering: > Supports up to three decal layers (g_MaterialTexture1, g_MaterialTexture2, g_MaterialTexture3) with alpha blending for detailed texture overlays. - Dynamic Lighting: > Computes per-pixel ambient, diffuse, and specular lighting for realistic interactions with directional, point, and spotlights. > Adjustable specular power and level to customize the highlight intensity. - Fog Integration: > Handles distance-based and altitude-based fog effects, enhancing scene depth and realism. - Texture Sampling Options: > Allows texture clamping or wrapping for flexible UV mapping. - Efficient Shader Logic: > Streamlined position and lighting computations for optimal performance. > Supports Kahan summation for precise z-buffer calculations in large scenes. ---------------------------------------------------------- MESHDECAL3BUMP.FX PURPOSE: - Adds bump mapping to the multi-decal rendering pipeline for enhanced surface details. Provides dynamic per-pixel lighting effects with fog integration. KEY FEATURES: - Bump Mapping: > Implements normal maps (g_BumpNormalTexture) to simulate fine surface details with adjustable bump intensity (g_BumpAmount). - Multi-Decal Layering: > Supports up to three decal layers (g_MaterialTexture2, g_MaterialTexture3, g_MaterialTexture4) with alpha blending for textured overlays. - Dynamic Lighting: > Computes per-pixel ambient, diffuse, and specular lighting based on normal and bump maps for realistic effects under directional, point, and spotlights. - Fog Support: > Includes distance and altitude-based fog effects for atmospheric realism. - Customizable Specular Highlights: > Controls for specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). Limits max specular impact on decals to maintain visual consistency. - Efficient Tangent Frame Calculation: > Generates tangent frames dynamically in the pixel shader to align bump mapping with surface geometry. - Flexible Texture Sampling: > Provides options for texture wrapping or clamping to support varied UV mapping requirements. ---------------------------------------------------------- MESHDECAL3BUMPSPEC.FX PURPOSE: Combines bump mapping and specular mapping to enhance multi-decal rendering with detailed surface textures and realistic lighting effects. KEY FEATURES: - Bump Mapping with Adjustable Intensity: > Incorporates normal maps (g_MaterialTexture1) for detailed surface relief effects. > Adjustable bump strength via g_BumpAmount. - Specular Mapping for Enhanced Highlights: > Implements a specular map (g_MaterialTexture2) for realistic light reflections. > Allows control over specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Multi-Decal Layering: > Supports up to three layered decals (g_MaterialTexture3, g_MaterialTexture4, g_MaterialTexture5) with alpha blending. > Decals blend with base texture and are affected by lighting and specular maps. - Dynamic Lighting: > Per-pixel ambient, diffuse, and specular lighting calculations based on normal and bump maps. > Compatible with directional, point, and spotlight sources. - Fog Integration: > Adds fog effects based on distance and altitude for environmental realism. - Tangent Space Calculation: > Computes tangent frames dynamically for proper alignment of bump and specular maps. - Texture Sampling Options: > Supports texture wrapping or clamping for UV flexibility. - Efficiency Optimizations: > Limits specular intensity on decals to 40% of the maximum for consistent visual balance. ---------------------------------------------------------- MESHDECAL3SPEC.FX PURPOSE: - Enhances the rendering of multi-layered decals with specular mapping for realistic light reflections, dynamic lighting, and fog integration. KEY FEATURES: - Specular Mapping for Highlight Control: > Uses a specular map (g_MaterialTexture1) to define light reflection intensity. > Adjustable specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Multi-Decal Layering: > Supports up to three decals (g_MaterialTexture2, g_MaterialTexture3, g_MaterialTexture4). > Decals blend with diffuse and specular effects for detailed and realistic surface rendering. - Dynamic Per-Pixel Lighting: > Implements ambient, diffuse, and specular lighting influenced by directional, point, and spotlights. - Fog Effects: > Adds fog based on distance and altitude (g_FogDistance, g_FogLayer) to enhance environmental realism. - UV Clamping and Wrapping Options: > Offers flexible texture sampling modes (clamp or wrap) to handle varied decal placement. - Specular Highlight Capping: > Caps decal specular highlights at 40% of the material’s maximum (g_SpecularLevel) for visual balance. - Optimization for Realistic Blending: > Smooth blending between decals and base textures with fog and specular effects factored in. - Shader Model Compatibility: > Designed for Shader Model 4.0 (vs_4_0, ps_4_0) to ensure compatibility with modern rendering pipelines. ---------------------------------------------------------- MESHDECAL4.FX PURPOSE: - A shader designed for rendering multi-layered decals with diffuse and specular effects, including support for fog and dynamic lighting, optimized for up to four decal layers. KEY FEATURES: - Multi-Layer Decal Rendering: > Supports four decal layers (g_MaterialTexture1 to g_MaterialTexture4). > Smooth blending of decals with the base texture using alpha transparency. - Dynamic Lighting and Shading: > Ambient, diffuse, and specular lighting effects driven by directional, point, and spotlights. > Per-pixel lighting calculations for accurate shading across complex surfaces. - Specular Highlight Management: > Implements adjustable specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). > Caps specular highlights for decals at 50% to maintain visual balance. - Fog Integration: > Adds atmospheric depth using distance-based and altitude-based fog effects. > Configurable fog parameters (g_FogDistance, g_FogLayer). - Flexible Texture Sampling: > Allows clamping or wrapping of texture coordinates to suit various decal applications. - Efficient Vertex and Pixel Processing: > Optimized vertex shader transforms positions, normals, and UVs for efficient rendering. > Pixel shader handles blending, lighting, and fogging with precision. - Shader Model Compatibility: > Designed for Shader Model 4.0 (vs_4_0, ps_4_0) to support modern rendering hardware. ---------------------------------------------------------- MESHDECAL4BUMP.FX PURPOSE: - An advanced shader for rendering multi-layered decals with bump mapping for enhanced surface detail. Includes diffuse, specular, and fog effects with dynamic lighting. KEY FEATURES: - Bump Mapping for Surface Detail: > Uses g_BumpNormalTexture to add surface normal details. > Adjustable bump strength via g_BumpAmount. - Dynamic Multi-Layer Decals: > Supports up to four decals (g_MaterialTexture2 to g_MaterialTexture5). > Smooth blending of decals with base texture (g_MaterialTexture0) using alpha transparency. - Lighting and Shading: > Per-pixel ambient and diffuse lighting for realistic illumination. > Specular highlights with adjustable intensity and sharpness (g_SpecularLevel, g_SpecularPower). > Dynamic lighting from directional, point, and spotlights. - Tangent Frame Calculation: > Computes a local tangent frame for accurate bump mapping. > Handles texture space transformations for lighting calculations. - Fog Integration: > Adds atmospheric fog effects based on distance and altitude. > Configurable fog parameters (g_FogDistance, g_FogLayer). - Texture Handling: > Clamping and wrapping options for texture sampling. > Linear filtering for smooth bump texture sampling. - Shader Model Compatibility: > Designed for Shader Model 4.0 (vs_4_0, ps_4_0). ---------------------------------------------------------- MESHDECAL4BUMPSPEC.FX PURPOSE: - A versatile shader designed for rendering multi-layered decals with bump and specular mapping. It enhances surface realism through detailed normal maps and reflective highlights while supporting dynamic lighting and fog effects. KEY FEATURES - Bump Mapping for Enhanced Detail: > Normal mapping adds fine surface details using g_MaterialTexture1 as a bump map. > Strength of the bump mapping is controlled by g_BumpAmount. - Specular Mapping for Reflective Effects: > Specular reflections are modulated by g_MaterialTexture2, allowing spatial variation in shininess. > Adjustable specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Multi-Layer Decals: > Supports up to four decals (g_MaterialTexture3 to g_MaterialTexture6). > Decals blend with base texture (g_MaterialTexture0) using alpha transparency. - Dynamic Lighting: > Supports ambient, directional, point, and spotlights. > Performs per-pixel lighting calculations for realistic shading. - Fog Integration: > Adds atmospheric fog effects with configurable depth and altitude-based settings (g_FogDistance, g_FogLayer). - Tangent Space Lighting: > Constructs a tangent frame for accurate normal mapping and lighting in texture space. ---------------------------------------------------------- MESHDECAL4SPEC.FX PURPOSE: - This shader is crafted for rendering multi-layered decals with integrated specular highlights and fog effects. It supports dynamic lighting and realistic material representation for applications like games and simulations. KEY FEATURES - Specular Mapping for Material Highlights: > Specular highlights are modulated using g_MaterialTexture1 for spatial variations in shininess. > Configurable specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Multi-Layer Decals: > Supports up to four decal layers (g_MaterialTexture2 to g_MaterialTexture5). > Decals blend with the base texture (g_MaterialTexture0) based on alpha transparency. - Dynamic Lighting: > Ambient, directional, point, and spotlights are implemented. > Per-pixel lighting computations ensure detailed and realistic shading. - Fog Integration: > Atmospheric fog is applied for depth and altitude-based effects using g_FogDistance and g_FogLayer. - Layered Blending with Specular Control: > Specular highlights are capped at 40% intensity for decal layers to maintain visual coherence. ---------------------------------------------------------- MESHDECAL5.FX PURPOSE - This shader file is designed for managing mesh-based decals with advanced lighting and fog effects. It supports multiple texture layers, lighting calculations (ambient, diffuse, specular), and fog integration to enhance visual fidelity in the Strike Fighters 2 environment. KEY FEATURES - Lighting Support: > Directional Lighting: Calculates ambient and diffuse lighting using a directional light source. > Point and Spot Lights: Includes per-pixel lighting calculations for up to 8 point lights and 2 spotlights with range and angle attenuation. > Specular Highlights: Implements specular reflection based on material properties and lighting conditions, including power and color customization. - Texture Layers and Decals: > Base Texture: The primary material texture is sampled with anisotropic filtering. > Decals: Supports up to 5 additional texture layers for decals with alpha blending for precise placement. Specular effects can influence base texture blending but not decals. - Fog Integration: > Fog Distance and Layer: Allows both distance-based and altitude-based fog effects, blending object colors with fog color based on calculated fog density. > Smooth Fog Transitions: Uses smoothstep for gradual fog blending, enhancing visual realism. - Precision Handling: > Improved Position Calculations: Uses Kahan summation to minimize precision errors in vertex position transformations, especially for Z-buffer calculations. - Global Settings: > Material toggles for enabling/disabling fog, lighting, and specular effects. > Adjustable specular level, power, and color for fine-tuning material appearance. ---------------------------------------------------------- MESHDECAL5BUMP.FX PURPOSE - This shader enhances mesh-based decals by integrating bump mapping for detailed surface normal effects, along with lighting and fog support. It is designed to improve visual depth and realism in Strike Fighters 2 environments. KEY FEATURES - Bump Mapping for Surface Details: > Incorporates g_BumpNormalTexture for normal mapping, scaled by g_BumpAmount. > Adds detailed surface variation for more realistic lighting interactions. - Lighting and Shading: > Directional, point, and spotlights are supported for dynamic illumination. > Ambient and diffuse lighting calculations are performed per pixel. > Specular highlights are calculated with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layer Support: > Supports up to 5 decal layers (g_MaterialTexture2 to g_MaterialTexture6). > Decals blend with base texture (g_MaterialTexture0) using alpha transparency for precise layering. - Fog Integration: > Adds atmospheric fog effects with configurable depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Tangent Frame Calculation: > Computes a tangent frame for accurate normal mapping in texture space. > Handles texture transformations for consistent bump mapping and lighting. - Texture Handling: > Wrap and clamp options for both material and bump textures. > Linear filtering for smooth bump and decal blending. - Precision Enhancements: > Implements Kahan summation in position calculations to minimize precision loss. ---------------------------------------------------------- MESHDECAL5BUMPSPEC.FX PURPOSE - This shader extends mesh-based decals by combining bump mapping and specular mapping for enhanced surface realism. It integrates dynamic lighting and fog effects to create detailed and reflective materials in Strike Fighters 2 environments. KEY FEATURES - Bump Mapping for Surface Details: > Uses g_MaterialTexture1 for bump mapping, modulated by g_BumpAmount. > Provides detailed surface normal variations for realistic lighting interactions. - Specular Mapping for Reflective Surfaces: > Incorporates g_MaterialTexture2 for spatially varying specular highlights. > Modulates specular intensity and sharpness using g_SpecularLevel, g_SpecularPower, and the specular map. - Lighting and Shading: > Supports dynamic ambient, diffuse, and specular lighting with directional, point, and spotlights. > Per-pixel lighting ensures accurate and realistic shading. - Decal Layer Support: > Handles up to 5 decal layers (g_MaterialTexture3 to g_MaterialTexture7). > Decals blend with the base texture (g_MaterialTexture0) using alpha transparency for smooth layering. - Fog Integration: > Implements atmospheric fog effects with customizable depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions using fog blending for a natural look. - Tangent Frame Calculation: > Computes a tangent frame for precise bump mapping and specular lighting in texture space. > Ensures consistent normal transformations for lighting. - Texture Handling: > Wrap and clamp options for material, bump, and specular textures. > Linear filtering ensures smooth sampling for all textures. - Specular Decal Control: > Caps specular intensity on decals to maintain visual coherence, with a maximum intensity of 0.4. ---------------------------------------------------------- MESHDECAL5SPEC.FX PURPOSE - This shader is tailored for rendering mesh-based decals with integrated specular mapping to simulate reflective surfaces. It includes support for dynamic lighting and fog effects to enhance material realism in Strike Fighters 2 environments. KEY FEATURES - Specular Mapping for Reflective Surfaces: > Uses g_MaterialTexture1 to define spatially varying specular highlights. > Modulates specular intensity and sharpness with g_SpecularLevel and g_SpecularPower. > Limits specular influence on decals to 40% for visual consistency. - Lighting and Shading: > Supports ambient, diffuse, and specular lighting with directional, point, and spotlights. > Performs per-pixel lighting calculations for accurate and dynamic illumination. - Decal Layer Support: > Handles up to 5 decal layers (g_MaterialTexture2 to g_MaterialTexture6). > Decals blend with base texture (g_MaterialTexture0) using alpha transparency to ensure smooth and seamless layering. - Fog Integration: > Adds atmospheric fog effects with adjustable depth (g_FogDistance) and altitude (g_FogLayer). > Uses smoothstep blending to create natural transitions between object colors and fog. - Texture Handling: > Wrap and clamp options for material and specular textures. > Smooth sampling ensures high-quality blending of base and decal textures. ---------------------------------------------------------- MESHDECAL6.FX PURPOSE - This shader is designed for rendering mesh-based decals with advanced lighting and fog effects. It supports multiple decal layers, dynamic lighting, and specular highlights to enhance surface detail and realism in Strike Fighters 2 environments. KEY FEATURES - Lighting and Shading: > Supports ambient, diffuse, and specular lighting with directional, point, and spotlights. > Per-pixel lighting calculations provide realistic shading and dynamic illumination. > Adjustable specular intensity and sharpness using g_SpecularLevel and g_SpecularPower. - Decal Layer Support: > Handles up to 6 decal layers (g_MaterialTexture1 to g_MaterialTexture6). > Decals blend with the base texture (g_MaterialTexture0) using alpha transparency for seamless layering. - Fog Integration: > Implements distance and altitude-based fog effects with configurable parameters (g_FogDistance, g_FogLayer). > Smooth fog blending using smoothstep for natural transitions. - Texture Handling: > Wrap and clamp options for material and decal textures. > Anisotropic filtering ensures high-quality sampling for all textures. - Specular Decal Control: > Limits maximum specular intensity on decals to 40% to maintain visual consistency. ---------------------------------------------------------- MESHDECAL6BUMP.FX PURPOSE - This shader is designed to render mesh-based decals with bump mapping and advanced lighting. It enhances surface realism by adding normal-based details, multiple decal layers, and dynamic fog integration in Strike Fighters 2 environments. KEY FEATURES - Bump Mapping for Surface Details: > Utilizes g_BumpNormalTexture for detailed normal mapping, modulated by g_BumpAmount. > Adds realistic surface variation for enhanced lighting effects. - Lighting and Shading: > Includes ambient, diffuse, and specular lighting with directional, point, and spotlights. > Per-pixel lighting calculations ensure accurate and dynamic illumination. > Adjustable specular highlights controlled by g_SpecularLevel and g_SpecularPower. - Decal Layer Support: > Supports up to 6 decal layers (g_MaterialTexture2 to g_MaterialTexture7). > Decals blend with the base texture (g_MaterialTexture0) using alpha transparency for seamless integration. - Fog Integration: > Adds configurable distance and altitude-based fog effects (g_FogDistance, g_FogLayer). > Smooth fog blending using smoothstep for natural depth transitions. - Tangent Frame Calculation: > Computes a tangent frame for accurate bump mapping and texture space lighting. > Ensures consistent normal transformations for precise light interactions. - Texture Handling: > Wrap and clamp options for material and bump textures. > Linear filtering ensures smooth sampling for bump and decal textures. - Specular Decal Control: > Caps maximum specular influence to maintain visual consistency across decals. ---------------------------------------------------------- MESHDECAL6SPEC.FX PURPOSE - This shader specializes in rendering mesh-based decals with advanced specular mapping, lighting, and fog effects. It supports multiple decal layers and dynamic light interactions to create a highly realistic visual experience in Strike Fighters 2. KEY FEATURES - Specular Mapping for Reflective Effects: > Uses g_MaterialTexture1 to modulate specular highlights for spatial variation. > Adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower) for precise control. > Caps maximum specular influence at 40% for decals to maintain visual consistency. - Lighting and Shading: > Supports ambient, directional, point, and spotlights for dynamic illumination. > Per-pixel lighting calculations for realistic shading and detailed surface rendering. > Specular and diffuse lighting blended seamlessly for natural highlights and reflections. - Multi-Layer Decals: > Supports up to 6 decals (g_MaterialTexture2 to g_MaterialTexture7). > Decals blend with the base texture (g_MaterialTexture0) using alpha transparency for precise layering and integration. - Fog Integration: > Configurable fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth blending of object colors with fog using smoothstep for natural depth transitions. - Texture Handling: > Wrap and clamp options for material and specular textures. > Anisotropic filtering ensures smooth and high-quality sampling for textures. - Performance Optimizations: > Efficient per-pixel lighting and specular calculations to enhance visual quality while maintaining performance. ---------------------------------------------------------- MESHDECAL7.FX PURPOSE - This shader is designed for rendering detailed mesh decals with multi-layer support, dynamic lighting, and realistic fog effects. It ensures seamless integration of decals with the base material while incorporating advanced lighting and shading techniques. KEY FEATURES - Multi-Layer Decals: > Supports up to 7 decal layers (g_MaterialTexture1 to g_MaterialTexture7). > Decals blend with the base texture (g_MaterialTexture0) using alpha transparency. > Each decal contributes to overall visual fidelity and depth. - Dynamic Lighting and Shading: > Per-pixel ambient and diffuse lighting calculations for realistic shading. > Full support for directional, point, and spotlights. > Specular highlights are computed with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). > Limits specular contribution for decals to 40% for balanced visual results. - Fog Integration: > Configurable atmospheric effects using distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between objects and fog using smoothstep blending. - Texture Handling: > Wrap and clamp modes for textures to allow precise texture sampling. > Anisotropic filtering for improved texture clarity and quality. - Precision Enhancements: > Implements Kahan summation in position computations to minimize floating-point precision loss. > Enhances rendering accuracy in large-scale scenes. ---------------------------------------------------------- -------------------- MESH - NO TEXTURE ------------------- ---------------------------------------------------------- MESHNOTEXTURE.FX PURPOSE - This shader renders untextured mesh objects with dynamic lighting and optional fog effects. It provides basic rendering for meshes without relying on textures, ensuring compatibility in various lighting environments. KEY FEATURES - Untextured Mesh Rendering: > Renders objects using a solid diffuse color defined by g_DiffuseColor. > Ideal for scenarios where texture data is unavailable or not required. - Dynamic Lighting: > Supports per-pixel ambient and diffuse lighting calculations. > Incorporates directional, point, and spotlight effects. > Adds specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Adds atmospheric fog effects with configurable distance (g_FogDistance) and altitude (g_FogLayer). > Ensures smooth transitions between object color and fog using linear interpolation. - Precision Enhancements: > Uses Kahan summation for accurate position calculations to minimize floating-point precision loss. > Maintains rendering precision in large-scale environments. ---------------------------------------------------------- MESHNOTEXTUREALPHA.FX PURPOSE - This shader handles rendering untextured meshes with support for alpha transparency, dynamic lighting, and atmospheric fog. It is optimized for simple materials without textures, making it ideal for specific cases like glass or other transparent objects. KEY FEATURES - Alpha Transparency: > Utilizes g_Transparency to define material opacity, enabling smooth blending. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting calculations are performed per pixel for consistent shading. > Specular highlights are calculated with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between fog and object colors using smoothstep for natural transitions. - Precision Enhancements: > Implements Kahan summation in position calculations to minimize precision loss. - Performance Optimizations: > Designed for untextured materials, reducing computational overhead. ---------------------------------------------------------- MESHNOTEXTUREREFLECTION.FX PURPOSE - This shader enables rendering untextured meshes with dynamic reflection effects, supporting fog and lighting. It is designed for simple reflective materials, such as metallic or glass-like surfaces. KEY FEATURES - Reflection Mapping: > Uses spherical reflection coordinates for dynamic environment reflections. > Blends between the base diffuse color (g_DiffuseColor) and the reflection texture based on alpha values. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting computations ensure accurate shading. > Specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Atmospheric fog effects with distance-based transitions (g_FogDistance). > Altitude-sensitive fog blending using smoothstep (g_FogLayer). - Texture Handling: > Reflective texture sampling with anisotropic filtering for high-quality reflections. - Precision Enhancements: > Implements Kahan summation for position computations to reduce precision loss. - Performance Optimizations: > Simple input structure and reflection mapping keep computations efficient. ---------------------------------------------------------- -------------------- MESH - REFLECTION ------------------- ---------------------------------------------------------- MESHREFLECTION.FX PURPOSE - This shader handles rendering reflective textured meshes with dynamic lighting and fog, supporting advanced reflection mapping for immersive visuals. KEY FEATURES - Reflection Mapping: > Combines primary texture (g_MaterialTexture0) with reflection map (g_MaterialTexture1). > Uses spherical reflection coordinates for accurate environment reflections. > Reflection blending based on alpha values in the reflection texture. - Lighting and Shading: > Supports ambient, directional, point, and spotlights for realistic illumination. > Per-pixel ambient and diffuse lighting for detailed shading. > Adjustable specular highlights using g_SpecularPower and g_SpecularColor. - Fog Integration: > Adds fog effects with depth- and altitude-based transitions (g_FogDistance and g_FogLayer). > Smooth blending between fog and mesh colors for seamless atmospheric integration. - Texture Handling: > Wrap and clamp sampling options for both base and reflection textures. > Anisotropic filtering for high-quality texture sampling. - Reflection Clipping: > Dynamically clips reflection rendering using camera-relative position (g_CameraPos) when in reflection mode (g_bInReflection). - Precision Enhancements: > Utilizes Kahan summation for position calculations to minimize floating-point errors. ---------------------------------------------------------- MESHREFLECTIONBUMP.FX PURPOSE - This shader enhances meshes with bump mapping and dynamic reflection effects, offering realistic surface details and lighting for environments requiring high visual fidelity. KEY FEATURES - Bump Mapping: > Uses g_BumpNormalTexture for surface detail variations via normal mapping. > Adjusts bump strength with g_BumpAmount for customizable detail intensity. - Reflection Mapping: > Implements spherical reflection mapping for environment reflections. > Blends between base texture (g_MaterialTexture0) and reflection texture (g_MaterialTexture2) based on alpha transparency. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting computations for accurate shading. > Specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Adds atmospheric fog with depth-based transitions (g_FogDistance). > Smooth altitude-sensitive fog blending using smoothstep (g_FogLayer). - Texture Handling: > Separate samplers for material and bump textures with wrap and clamp options. > Anisotropic and linear filtering for enhanced visual quality. - Precision Enhancements: > Uses Kahan summation in position computations to reduce precision loss. - Reflection Culling: > Clips surfaces outside the reflective view, controlled by g_bInReflection and g_CameraPos. ---------------------------------------------------------- MESHREFLECTIONBUMPSPEC.FX PURPOSE - This shader enhances materials with bump mapping, specular highlights, and reflective effects. It supports dynamic lighting and atmospheric fog, offering a visually rich rendering for reflective surfaces in 3D environments. KEY FEATURES - Reflection Mapping: > Implements spherical reflection mapping using g_MaterialTexture3 for dynamic environment reflections. > Reflection intensity is controlled by the blue channel of g_MaterialTexture2. - Bump Mapping: > Utilizes g_MaterialTexture1 for normal mapping, scaled by g_BumpAmount for adjustable surface detail. > Provides realistic lighting interactions on uneven surfaces. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Performs per-pixel ambient and diffuse lighting using tangent-space calculations. > Specular highlights are calculated with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Adds depth with distance-based fog effects (g_FogDistance). > Atmospheric fog blending based on altitude using g_FogLayer. - Reflection Culling: > Implements clipping in reflection passes to ensure accurate rendering. - Precision Enhancements: > Kahan summation minimizes precision loss in position calculations. - Performance Optimizations: > Wrap and clamp sampling modes for efficient texture handling. ---------------------------------------------------------- MESHREFLECTIONDECAL1.FX PURPOSE - This shader enhances mesh rendering by adding reflection effects, dynamic lighting, and decals, with fog integration. It is designed to improve realism for objects with reflective surfaces. KEY FEATURES - Reflection Mapping: > Implements spherical reflection mapping using g_MaterialTexture1 for realistic surface reflections. > Blends base texture (g_MaterialTexture0) with reflections based on alpha. - Decal Layer Support: > Supports a single decal layer (g_MaterialTexture2) blended with the base texture and reflection. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic lighting. > Per-pixel ambient and diffuse lighting calculations provide consistent shading. > Specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Adds atmospheric fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between fog and object colors using smoothstep for natural transitions. - Reflection Clipping: > Clips reflections based on g_CameraPos and input depth for rendering accuracy when in reflection. - Performance Optimizations: > Conditional texture sampling based on clamp or wrap settings for efficient resource use. ---------------------------------------------------------- MESHREFLECTIONDECAL1BUMP.FX PURPOSE - This shader renders mesh-based materials with reflection mapping, bump mapping, dynamic lighting, and decal support. It integrates realistic environmental reflections for enhanced visual fidelity in reflective surfaces. KEY FEATURES - Reflection Mapping: > Computes spherical reflection coordinates from world and view space normals. > Integrates reflection texture (g_MaterialTexture2) with adjustable alpha blending. - Bump Mapping: > Incorporates g_BumpNormalTexture for normal mapping, scaled by g_BumpAmount. > Enhances surface detail for realistic lighting interactions. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Calculates ambient and diffuse lighting per pixel for consistent shading. > Specular highlights with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Integration: > Supports a single decal layer (g_MaterialTexture3) over the base texture. > Blends decal with lighting and reflection effects using alpha transparency. - Fog Integration: > Configurable fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Reflection Clipping: > Uses g_bInReflection to clip geometry not visible in reflections. - Precision Enhancements: > Implements Kahan summation in position calculations to minimize precision loss. ---------------------------------------------------------- MESHREFLECTIONDECAL1BUMPSPEC.FX PURPOSE - This shader combines reflection mapping, bump mapping, and specular highlights to enhance the realism of reflective surfaces with decals. It supports lighting and fog integration, making it suitable for dynamic environments with complex material properties. KEY FEATURES - Reflection Mapping: > Integrates spherical reflection coordinates for reflective surface effects. > Reflective intensity controlled by specular map blue channel (sm.b). - Bump Mapping for Surface Details: > Uses g_MaterialTexture1 for normal mapping, scaled by g_BumpAmount. > Tangent space normal calculations for realistic light interaction. - Lighting and Shading: > Supports dynamic directional, point, and spotlights. > Per-pixel ambient and diffuse shading with specular highlights. > Adjustable specular intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layer Support: > Incorporates decals (g_MaterialTexture4) with alpha transparency for layered effects. - Fog Integration: > Configurable atmospheric fog (g_FogDistance, g_FogLayer). > Blends object colors and fog seamlessly for depth and realism. - Dynamic Reflection Control: > Reflective blending modulated by sm.b channel and g_MaterialTexture3 (reflection texture). - Precision Enhancements: > Uses Kahan summation for position calculations to minimize precision loss. ---------------------------------------------------------- MESHREFLECTIONDECAL1SPEC.FX PURPOSE - This shader enables the rendering of reflective decals with specular highlights and dynamic lighting. It supports reflection mapping, fog, and blending for enhanced realism in Strike Fighters 2 environments. KEY FEATURES - Reflection Mapping: > Implements spherical reflection coordinates derived from view-space normals. > Blends base textures with reflection components sampled from g_MaterialTexture2, scaled by specular intensity. - Specular and Diffuse Lighting: > Supports directional, point, and spotlights for dynamic illumination. > Specular highlights computed per pixel using g_SpecularLevel and g_SpecularPower. > Diffuse lighting calculations combine ambient and per-light contributions. - Decal Integration: > Allows blending of a decal texture (g_MaterialTexture3) with the base material. > Limits specular contribution of decals to a maximum of 40% for balanced visual effects. - Fog and Atmospheric Effects: > Supports distance and altitude-based fog using g_FogDistance and g_FogLayer. > Smooth transitions between fog and object colors for natural atmospheric integration. - Reflection Clipping: > Handles view clipping for reflections using g_bInReflection to exclude out-of-bound reflections. - Texture Handling: > Wrap and clamp options for base and reflection textures. > Anisotropic filtering for enhanced texture quality. - Precision Enhancements: > Uses Kahan summation to reduce precision loss in position calculations. ---------------------------------------------------------- MESHREFLECTIONDECAL2.FX PURPOSE - This shader integrates reflection mapping with decals for enhanced realism, while supporting dynamic lighting and fog effects. Designed for materials that require reflective surfaces with detailed decals. KEY FEATURES - Reflection Mapping: > Utilizes g_MaterialTexture1 for spherical environment mapping. > Blends base texture (g_MaterialTexture0) with reflection based on alpha channel. - Lighting and Shading: > Supports ambient, diffuse, and specular lighting calculations. > Directional, point, and spotlights are supported for dynamic light effects. > Adjustable specular highlights using g_SpecularLevel and g_SpecularPower. - Decal Layer Integration: > Adds up to two decal layers (g_MaterialTexture2 and g_MaterialTexture3). > Decals blend with reflection and base texture for layered visual details. - Fog Integration: > Atmospheric fog effects with depth-based transitions. > Smooth blending between object colors and fog using smoothstep. - Texture Sampling: > Wrap and clamp options for base and reflection textures. > Ensures smooth blending and accurate reflection mapping. - Precision Enhancements: > Implements Kahan summation in position calculations to reduce precision loss. ---------------------------------------------------------- MESHREFLECTIONDECAL2BUMP.FX PURPOSE - This shader combines reflection mapping, bump mapping, dynamic lighting, and decal layers to create realistic and visually appealing materials. Designed for advanced effects like shiny, bumpy surfaces with dynamic decals, it enhances realism in scenes. KEY FEATURES - Reflection Mapping: > Spherical reflection coordinates derived from view-space normals. > Integrates reflection texture (g_MaterialTexture2) for realistic environmental effects. - Bump Mapping: > Uses g_BumpNormalTexture for normal mapping, scaled by g_BumpAmount. > Creates detailed surface variations for enhanced lighting interaction. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting calculations for realistic shading. > Specular highlights with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layer Support: > Two decal layers (g_MaterialTexture3 and g_MaterialTexture4) for precise surface details. > Decals blend with base texture and reflection map using alpha transparency. - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between fog and object colors using smoothstep. - Tangent Frame Calculation: > Computes tangent frame for accurate normal mapping in texture space. > Handles texture transformations to maintain consistent bump mapping and lighting. - Precision Enhancements: > Implements Kahan summation for position calculations to reduce precision loss. - Performance Optimizations: > Efficient combination of reflection and lighting for balanced quality and performance. ---------------------------------------------------------- MESHREFLECTIONDECAL2BUMPSPEC.FX PURPOSE - This shader provides advanced rendering features for reflective, bump-mapped mesh surfaces with multiple decal layers, specular highlights, and atmospheric fog integration. It is ideal for dynamic and realistic environments in Strike Fighters 2. KEY FEATURES - Reflection Mapping: > Implements spherical reflection mapping using g_MaterialTexture3 for dynamic environment reflections. > Smoothly blends reflections based on surface properties (controlled by sm.b channel). - Bump Mapping for Surface Details: > Uses g_MaterialTexture1 for normal mapping with adjustable bump intensity (g_BumpAmount). > Creates detailed surface interactions with light and reflections. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting computed in tangent space for precision. > Specular highlights with customizable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layer Support: > Supports up to two decal layers (g_MaterialTexture4 and g_MaterialTexture5). > Decals blend seamlessly with base texture and reflections. - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between fog and object colors using smoothstep for natural transitions. - Precision Enhancements: > Kahan summation in position calculations minimizes precision loss. - Texture Handling: > Separate wrap and clamp samplers for flexible texture addressing. > Smooth sampling for base textures, bump maps, and decals. ---------------------------------------------------------- MESHREFLECTIONDECAL2SPEC.FX PURPOSE - This shader provides support for rendering reflective surfaces with decals and specular highlights. It enhances visuals by combining dynamic lighting, spherical reflections, and fog integration for a realistic effect. KEY FEATURES - Spherical Reflection: > Calculates reflection coordinates using vertex normals in view space. > Blends the base texture (g_MaterialTexture0) with reflection data from g_MaterialTexture2. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting calculations for precise shading. > Specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). > Specular blending with a maximum contribution of 40% for decal layers. - Decal Layer Support: > Adds up to two decal layers (g_MaterialTexture3 and g_MaterialTexture4). > Decals are blended with the base texture using alpha transparency for precise layering. - Fog Integration: > Atmospheric fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Performance Optimizations: > Selective use of reflection blending (based on g_MaterialTexture1 blue channel) to reduce unnecessary calculations. ---------------------------------------------------------- MESHREFLECTIONDECAL3.FX PURPOSE - This shader combines reflective surfaces and decal layering, offering detailed lighting and shading for complex materials. It simulates environmental reflections while supporting multiple decal textures for enhanced realism. KEY FEATURES - Reflection Mapping: > Computes spherical reflection coordinates in view space. > Blends base material with environment reflection (g_MaterialTexture1), adjusted by alpha. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting calculations are performed per pixel. > Specular highlights with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layering: > Supports up to three decal layers (g_MaterialTexture2 to g_MaterialTexture4). > Decals blend with base material and reflections for detailed surface effects. - Fog Integration: > Atmospheric fog effects using distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Precision Enhancements: > Implements Kahan summation for position calculations to minimize precision loss. - Performance Optimizations: > Dynamically disables fog calculations for distant objects. ---------------------------------------------------------- MESHREFLECTIONDECAL3BUMP.FX PURPOSE - This shader renders mesh decals with integrated reflection and bump mapping, adding realistic surface reflections and texture details. It supports lighting and fog for immersive environments. KEY FEATURES - Reflection Mapping: > Utilizes spherical reflection coordinates to create dynamic reflection effects. > Blends base texture (g_MaterialTexture0) with reflection map (g_MaterialTexture2) based on alpha transparency. - Bump Mapping for Surface Details: > Uses g_BumpNormalTexture for normal mapping with adjustable intensity via g_BumpAmount. > Enhances surface variation and light interaction. - Lighting and Shading: > Supports directional, point, and spotlights for detailed illumination. > Ambient and diffuse lighting calculations are performed per pixel. > Specular highlights are calculated with configurable power (g_SpecularPower) and color (g_SpecularColor). - Decal Layer Support: > Handles up to 3 decal layers (g_MaterialTexture3, g_MaterialTexture4, g_MaterialTexture5). > Decals blend with base texture and reflections using alpha transparency. - Fog Integration: > Incorporates fog effects with depth (g_FogDistance) and altitude (g_FogLayer) parameters. > Ensures smooth transitions between object colors and fog using smoothstep. - Tangent Frame Calculation: > Computes tangent space for precise bump mapping in texture space. - Precision Enhancements: > Implements Kahan summation to reduce floating-point precision errors in position calculations. ---------------------------------------------------------- MESHREFLECTIONDECAL3BUMPSPEC.FX PURPOSE - This shader enhances mesh rendering with bump mapping, specular highlights, decals, and reflective effects. It is optimized for environments in Strike Fighters 2 requiring realistic material detail, reflections, and dynamic lighting. KEY FEATURES - Reflection Mapping: > Utilizes reflection coordinates derived from view-space normals (uv3). > Combines base texture with reflection map (g_MaterialTexture3) for surfaces with reflectivity (controlled by specular map’s blue channel). - Bump Mapping for Surface Detail: > Normal mapping through g_MaterialTexture1 with scaling controlled by g_BumpAmount. > Accurate surface variation enhances light interaction. - Dynamic Lighting: > Supports directional, point, and spotlights for realistic illumination. > Ambient and diffuse lighting computed per pixel. > Specular highlights calculated with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Decal Layering: > Supports up to three decal layers (g_MaterialTexture4, g_MaterialTexture5, g_MaterialTexture6). > Decals blend with diffuse and specular components for natural integration. - Fog Integration: > Atmospheric fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Precision Optimizations: > Implements Kahan summation for accurate position calculations, minimizing precision loss. - Performance Considerations: > Efficient design integrates multiple visual effects for high-quality rendering while maintaining performance. ---------------------------------------------------------- MESHREFLECTIONDECAL3SPEC.FX PURPOSE - This shader handles rendering meshes with support for reflection, dynamic lighting, decals, and fog integration. Designed to enhance material realism, it blends reflections, decals, and specular highlights for advanced visual effects. KEY FEATURES - Reflection Mapping: > Generates spherical reflection coordinates based on world-space normals. > Blends material color with reflection texture (g_MaterialTexture2) using specular mask (g_MaterialTexture1). - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting calculations are performed per pixel. > Specular highlights are computed with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Decal Layer Support: > Supports up to 3 decal layers (g_MaterialTexture3 to g_MaterialTexture5). > Decals blend with base material and reflections for consistent integration. - Fog Integration: > Atmospheric fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between fog and object colors for realistic transitions. - Texture Handling: > Wrap and clamp options for all textures. > Specular blending limits decals' specular contribution to a maximum of 40%. - Performance Optimizations: > Utilizes efficient reflection calculations and conditional blending for performance. ---------------------------------------------------------- MESHREFLECTIONDECAL4.FX PURPOSE - This shader supports reflective materials with multiple decal layers, combining dynamic lighting, fog effects, and spherical reflections for enhanced realism in reflective surfaces. KEY FEATURES - Spherical Reflection Mapping: > Utilizes g_MaterialTexture1 to apply spherical environment reflections. > Blends base texture with reflections based on alpha transparency. - Multi-Layer Decal Support: > Supports up to 4 additional decal layers (g_MaterialTexture2 to g_MaterialTexture5). > Decals blend with base texture and reflections, with lighting effects integrated. - Lighting and Shading: > Per-pixel ambient and diffuse lighting calculations using directional, point, and spotlights. > Adjustable specular highlights via g_SpecularLevel and g_SpecularPower for realistic surface reflections. - Fog Integration: > Adds atmospheric fog based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between object colors and fog for natural transitions. - Texture Handling: > Wrap and clamp options for texture sampling, ensuring flexibility across material designs. > Linear filtering for smooth blending between textures, decals, and reflections. - Performance Optimization: > Dynamically enables or disables fog and lighting based on material flags. ---------------------------------------------------------- MESHREFLECTIONDECAL4BUMP.FX PURPOSE - This shader combines reflection mapping, bump mapping, and multi-layer decals for visually rich surfaces. It supports lighting and fog integration to create realistic materials with reflective properties in dynamic environments. KEY FEATURES - Reflection Mapping: > Generates spherical reflection coordinates for realistic environment reflections. > Blends base texture with reflection map (g_MaterialTexture2) using alpha transparency. - Bump Mapping for Surface Details: > Uses g_BumpNormalTexture for normal mapping, scaled by g_BumpAmount. > Adds surface variations to enhance lighting and reflections. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting computed per pixel for accuracy. > Specular highlights are calculated with adjustable sharpness (g_SpecularPower) and intensity (g_SpecularLevel). - Multi-Layer Decal Support: > Allows up to 4 decal layers (g_MaterialTexture3 to g_MaterialTexture6). > Decals are blended with the base and reflection textures using alpha transparency. - Fog Integration: > Atmospheric fog effects using distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog with smoothstep blending. - Tangent Frame Calculation: > Computes a tangent frame for accurate bump mapping and reflection alignment. ---------------------------------------------------------- MESHREFLECTIONDECAL4BUMPSPEC.FX PURPOSE - This shader enables detailed rendering of reflective surfaces with multiple decal layers, bump mapping, and specular highlights. It is designed to provide realistic lighting, reflection, and fog integration for enhanced visual depth in complex scenes. KEY FEATURES - Reflection Mapping: > Computes spherical reflection coordinates for dynamic reflection effects. > Uses g_MaterialTexture3 for reflection data, with adjustable intensity. - Bump Mapping for Surface Details: > Incorporates g_MaterialTexture1 for normal mapping, scaled by g_BumpAmount. > Adds fine surface variation for enhanced lighting realism. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting are calculated per pixel. > Specular highlights with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower), blended with decal data. - Decal Layer Support: > Handles up to 4 decal layers (g_MaterialTexture4 to g_MaterialTexture7). > Decals blend with the base texture using alpha transparency, maintaining surface reflection and specular effects. - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Tangent Frame Calculation: > Constructs a tangent frame for accurate normal mapping and lighting in texture space. > Handles texture transformations consistently for lighting and reflections. - Precision Enhancements: > Implements Kahan summation in position calculations to reduce precision errors. - Performance Optimizations: > Efficient texture sampling and reflection computations for real-time rendering. ---------------------------------------------------------- MESHREFLECTIONDECAL4SPEC.FX PURPOSE - This shader combines reflection mapping with decal layers, specular highlights, and dynamic lighting. It enhances the realism of reflective materials in environments like water, glass, or polished surfaces. KEY FEATURES - Reflection Mapping: > Utilizes a reflection texture (g_MaterialTexture2) to simulate reflective surfaces. > Reflection intensity controlled by the blue channel of the specular map texture. - Decal Layer Support: > Supports up to 4 decal layers (g_MaterialTexture3 to g_MaterialTexture6). > Decals blend with base texture using alpha transparency. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting are calculated per pixel. > Specular highlights with adjustable sharpness (g_SpecularPower) and level (g_SpecularLevel). - Fog Integration: > Adds depth-based atmospheric fog using g_FogDistance and altitude fog with g_FogLayer. > Smooth transitions between fog and object colors for natural blending. - Texture Handling: > Wrap and clamp sampling options for material and reflection textures. > Linear filtering for smooth blending. - Spherical Reflection Coordinates: > Generates UVs for reflection mapping based on world-to-view transformations. - Precision Enhancements: > Implements Kahan summation in position calculations to minimize precision loss. ---------------------------------------------------------- MESHREFLECTIONDECAL5.FX PURPOSE - This shader provides a blend of texture-based materials, spherical reflections, dynamic lighting, and decals. It enhances visuals by integrating reflective surfaces with multiple decal layers, making it suitable for reflective objects in Strike Fighters 2. KEY FEATURES - Spherical Reflection Mapping: > Computes reflection coordinates in view-space to create realistic spherical reflection effects. > Reflection blended using g_MaterialTexture1 with alpha control for seamless integration. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting calculations are performed per pixel. > Specular highlights calculated with adjustable sharpness (g_SpecularPower) and intensity (g_SpecularLevel). - Decal Layer Support: > Supports up to 5 decal layers (g_MaterialTexture2 to g_MaterialTexture6). > Decals blend with base texture (g_MaterialTexture0) using alpha transparency. - Fog Integration: > Atmospheric fog effects with depth (g_FogDistance) and altitude (g_FogLayer) control. > Smooth transitions using smoothstep for natural blending. - Texture Handling: > Configurable wrap and clamp sampling for material and reflection textures. - Precision Enhancements: > Implements Kahan summation for accurate position calculations in the vertex shader. ---------------------------------------------------------- MESHREFLECTIONDECAL5BUMP.FX PURPOSE - This shader enhances mesh-based decals with bump mapping, dynamic reflections, and support for up to 5 decal layers. It improves realism and depth in environments with lighting, reflections, and fog. KEY FEATURES - Dynamic Reflections: > Computes spherical reflection coordinates in view space. > Blends base texture with dynamic reflection texture (g_MaterialTexture2). - Bump Mapping for Surface Details: > Utilizes g_BumpNormalTexture for normal mapping, scaled by g_BumpAmount. > Enhances surface variations for accurate lighting interactions. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting for consistent shading. > Specular highlights are calculated with adjustable intensity (g_SpecularLevel) and sharpness (g_SpecularPower). - Decal Layer Support: > Supports up to 5 decal layers (g_MaterialTexture3 to g_MaterialTexture7). > Decals blend with base and reflection textures using alpha transparency. - Fog Integration: > Implements distance and altitude-based fog (g_FogDistance, g_FogLayer). > Smooth blending with object colors using smoothstep. - Tangent Frame Calculation: > Computes tangent space for accurate normal mapping and reflection mapping. ---------------------------------------------------------- MESHREFLECTIONDECAL5SPEC.FX PURPOSE - This shader enhances mesh rendering by adding support for reflection mapping, specular highlights, and layered decals. It is tailored for visually rich scenes in Strike Fighters 2, where reflections and lighting play a critical role in realism. KEY FEATURES - Reflection Mapping: > Uses spherical reflection coordinates to simulate environmental reflections. > Incorporates g_MaterialTexture2 for reflection textures, modulated by reflection intensity from the blue channel of g_MaterialTexture1. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic lighting. > Per-pixel ambient and diffuse calculations ensure realistic illumination. > Specular highlights with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). > Specular intensity modulated for decals to a maximum of 40%. - Decal Layering: > Supports up to 5 decal layers (g_MaterialTexture3 to g_MaterialTexture7). > Decals are blended with diffuse and specular components for realistic integration. - Fog Integration: > Atmospheric fog effects with depth (g_FogDistance) and altitude (g_FogLayer). > Smooth color transitions using fog blending. - Precision Enhancements: > Kahan summation in position computations to minimize precision loss. > Accurate spherical reflection coordinates calculated in the vertex shader. ---------------------------------------------------------- MESHREFLECTIONDECAL6.FX PURPOSE - This shader enables reflective decals on meshes, blending reflection maps with dynamic lighting, specular highlights, and fog effects. Designed for environments requiring complex surface effects such as glass or polished surfaces. KEY FEATURES - Reflection Mapping: > Incorporates a reflection texture (g_MaterialTexture1) blended with the base texture (g_MaterialTexture0) using spherical reflection coordinates. > Smooth blending between reflection and base material for realistic results. - Lighting and Shading: > Supports ambient, directional, point, and spotlights for dynamic illumination. > Per-pixel diffuse and specular lighting calculations with adjustable sharpness (g_SpecularPower) and intensity (g_SpecularLevel). - Decal Layer Support: > Handles up to 6 decal layers (g_MaterialTexture2 to g_MaterialTexture7). > Decals blend seamlessly with reflections and base material using alpha transparency. - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep. - Precision Enhancements: > Implements Kahan summation in position calculations to minimize precision loss. - Texture Handling: > Wrap and clamp sampling options for flexibility in texture mapping. ---------------------------------------------------------- MESHREFLECTIONSPEC.FX PURPOSE - This shader adds reflection and specular highlights to mesh surfaces, simulating shiny or reflective materials with support for lighting, fog, and reflections. It is designed for materials such as metal or polished surfaces in Strike Fighters 2. KEY FEATURES - Reflections: > Computes spherical reflection coordinates for reflective surfaces. > Uses g_MaterialTexture2 as the reflection map, blended with base color based on reflection strength (blue channel of g_MaterialTexture1). - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Calculates ambient and diffuse lighting per pixel for realism. > Specular highlights are calculated with adjustable sharpness (g_SpecularPower) and intensity (g_SpecularColor). - Fog Integration: > Adds atmospheric fog effects with configurable depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between reflection, base color, and fog. - Texture Handling: > Base texture (g_MaterialTexture0) and specular map (g_MaterialTexture1) sampled with wrap or clamp modes. > Reflection map (g_MaterialTexture2) sampled with precise UV coordinates. ---------------------------------------------------------- -------------------------- MODEL ------------------------- ---------------------------------------------------------- MODELCANOPY.FX PURPOSE - This shader is designed for rendering canopy materials in Strike Fighters 2, with support for dynamic reflections, transparency, lighting, and fog integration. It enhances the visual appearance of glass-like materials by simulating reflective and refractive effects. KEY FEATURES - Reflection and Transparency: > Supports dynamic reflections with spherical mapping using g_MaterialTexture1. > Reflection blending controlled by g_ReflectionStage for realistic appearance. > Transparency level adjustable via g_MaterialTexture0 alpha channel. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting are calculated per pixel for consistent shading. > Specular highlights adjusted for glass materials with g_SpecularPower and g_SpecularColor. - Fog Integration: > Atmospheric fog effects using g_FogDistance and g_FogLayer. > Smooth transitions between canopy colors and fog via smoothstep. - Advanced Shading: > Implements view-dependent alpha adjustments for realistic transparency and reflection. > Per-pixel specular computations simulate glass reflectivity and highlight intensity. - Precision Enhancements: > Implements Kahan summation in position calculations to reduce precision loss. - Texture Support: > g_MaterialTexture0 for base color and alpha. > g_MaterialTexture1 for reflective details. ---------------------------------------------------------- ------------------------- SHHADER ------------------------ ---------------------------------------------------------- SHADER.FX PURPOSE - This shader applies post-processing effects, including Fast Approximate Anti-Aliasing (FXAA) and SweetFX adjustments, to improve the visual quality of rendered frames. It integrates user-configurable settings for fine-tuning edge smoothing and color enhancements. KEY FEATURES - FXAA Integration: > Reduces jagged edges and aliasing with FXAA, a lightweight anti-aliasing technique. > Configurable parameters for subpixel smoothing (`fxaaQualitySubpix`), edge thresholds (`fxaaQualityEdgeThreshold`, `fxaaQualityEdgeThresholdMin`). - SweetFX Enhancements: > Provides hooks for custom post-processing effects defined in `SweetFX/Shaders/Main.h`. > Includes options for brightness, contrast, saturation, and more from `SweetFX_preset.txt`. - Modular Post-Processing: > Technique `PostProcess1` applies only FXAA for edge smoothing. > Technique `PostProcess2` applies additional SweetFX enhancements. - Texture and Sampler Definitions: > Supports both nearest and linear filtering for screen and luma textures. > Textures are clamped or bordered to handle edge cases gracefully. - Performance Considerations: > Optimized sampling for minimal performance impact during anti-aliasing and color adjustments. > Flexible toggling of FXAA and SweetFX effects for different use cases. CONFIGURABLE PARAMETERS - `fxaaQualitySubpix`: Controls the amount of subpixel aliasing removal. - `fxaaQualityEdgeThreshold`: Minimum contrast required for edge detection. - `fxaaQualityEdgeThresholdMin`: Skips processing of darker areas to optimize performance. RENDER PIPELINE - `PostProcess1`: > Uses `LumaShader` to apply FXAA if enabled; otherwise, samples the original screen texture. - `PostProcess2`: > Uses `MyShader` to combine luma adjustments with SweetFX effects for final output. > Ensures compatibility with a wide range of post-processing settings. ---------------------------------------------------------- -------------------- SHADOW - VOLUMNE -------------------- ---------------------------------------------------------- SHADOWVOLUMEDX9.FX PURPOSE - This shader is designed to generate shadow volumes for dynamic shadow masking in DirectX 9 environments. It creates extruded shadow geometry based on light direction and vertex data, suitable for rendering shadow effects in 3D scenes. KEY FEATURES - Shadow Volume Generation: > Utilizes gShadowLength to define the extrusion direction for shadow geometry. > Dynamically determines if a vertex is part of the shadow volume using gShadowVert. - Transformation Pipeline: > Transforms vertex positions from object space to world space (gWorld) and then to clip space using the view-projection matrix (gViewProj). - Lightweight Design: > Focused solely on shadow volume creation without texture sampling or color calculations, ensuring minimal performance overhead. ---------------------------------------------------------- ------------------------- TERRAIN ------------------------- ---------------------------------------------------------- TERALPHAOBJECT.FX PURPOSE - This shader is designed for rendering terrain objects with alpha transparency, dynamic lighting, and fog effects. It includes distance-based fading for smooth transitions, ideal for creating immersive environments in Strike Fighters 2. KEY FEATURES - Alpha Transparency and Distance Fading: > Supports alpha blending using g_MaterialTexture's alpha channel. > Implements g_FadeDistance for smooth fading based on camera distance. - Lighting and Shading: > Calculates ambient and diffuse lighting per pixel, incorporating directional, point, and spotlights. > Ensures consistent shading across terrain with lighting dynamically adjusted to the world space position. - Fog Integration: > Adds atmospheric fog effects based on depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between terrain colors and fog using linear interpolation. - Precision Enhancements: > Implements a precision summation function (precision_add_z) for accurate depth computation, reducing numerical errors. - Optimized UV Sampling: > Uses g_MaterialTexture for texture sampling with anisotropic filtering for high quality rendering. ---------------------------------------------------------- TERFARTERRAINEFFECT.FX PURPOSE - This shader is designed to render terrain with dynamic lighting, texture sampling, and atmospheric fog. It ensures smooth transitions between terrain details and environmental effects for visually immersive scenes. KEY FEATURES - Terrain Rendering: > Supports texture mapping using g_MaterialTexture, with smooth sampling via g_LinearSampler. > Vertex normals are utilized for accurate shading across uneven surfaces. - Lighting and Shading: > Directional lighting driven by g_DirLight for global illumination. > Dynamic per-pixel light sourcing for point and spotlights. > Ambient and diffuse lighting ensure consistency across terrain surfaces. - Fog Integration: > Atmospheric fog based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth blending transitions between terrain colors and fog using smoothstep. - Precision Enhancements: > Implements Kahan summation for accurate z-coordinate calculations, reducing floating-point errors. - Performance Optimizations: > Leverages vertex-level pre-computed lighting for diffuse base, refined at pixel level for additional light sources. > Minimal computational overhead for large terrain surfaces. ---------------------------------------------------------- TERFARTERRAINEFFECTDX9.FX PURPOSE - The shader is designed to render far terrain with optimized lighting, fog integration, and support for ambient, directional, and point lights. It ensures realistic terrain appearance even in distant scenes. KEY FEATURES - Ambient and Directional Lighting: > Calculates diffuse lighting based on the provided ambient light (AmbientLight) and directional light (LightColor and LightDir). > Diffuse lighting computation ensures dynamic shading with terrain normals. - Point Light Support: > Computes per-pixel light contribution for a single point light (PointLight). > Attenuation is calculated using the point light's range and position for localized lighting effects. - Fog Integration: > Implements fog blending based on distance (FogDistance) for seamless terrain fading. > Uses view-space depth (Pv.z) to calculate fog intensity for atmospheric depth. - Texture Sampling: > Uses MaterialTexture to add terrain details via texture mapping. > Smooth texture filtering (linear min/mag/mip filters) ensures high-quality visuals. - Optimized Shader Workflow: > Vertex shader handles position, normal transformation, fog computation, and diffuse lighting. > Pixel shader combines lighting and texture sampling for the final terrain color. - Performance Considerations: > Simple lighting calculations in VS with optional point light contribution in PS. > Designed for DX9 with vs_2_0 and ps_2_0 compatibility. ---------------------------------------------------------- TERSOLIDOBJECT.FX PURPOSE - This shader is designed for rendering solid objects with lighting, fog, and fade effects based on camera distance. It ensures visually consistent shading while integrating distance-based fade for smooth transitions. KEY FEATURES - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting calculations for precise shading. > Directional lighting with adjustable intensity and direction. - Distance-Based Fading: > Implements fade effect using g_FadeDistance to gradually blend objects with the background based on distance. - Fog Integration: > Atmospheric fog effects with configurable depth (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between object colors and fog using smoothstep blending. - Texture Mapping: > Uses g_MaterialTexture with UV sampling for material definition. > Supports clamped texture coordinates for precise texture alignment. - Precision Enhancements: > Utilizes Kahan summation in position calculations for minimal precision loss. > Computes Z-coordinate with additional precision using `precision_add_z`. ---------------------------------------------------------- TERTERRAINEFFECT.FX PURPOSE - This shader renders detailed terrain by blending normal-mapped surface details with dynamic lighting and atmospheric fog. It provides a realistic visual representation of large-scale environments with fading bump mapping based on distance. KEY FEATURES - Normal Mapping for Terrain Details: > Incorporates g_BumpTexture for detailed surface normals, with scaling controlled by g_BumpAmount. > Fades bump mapping effect over distance, blending seamlessly with the base material. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic terrain illumination. > Performs per-pixel ambient and diffuse lighting calculations for realistic shading. > Utilizes tangent space for accurate normal mapping and lighting interactions. - Fog Integration: > Applies atmospheric fog based on configurable depth (g_FogDistance) and altitude (g_FogLayer). > Blends terrain colors with fog using smoothstep for natural transitions over long distances. - Distance-Based Effects: > Implements fading bump mapping based on StartFadeDist and EndFadeDist values to optimize distant terrain rendering. > Dynamically adjusts bump mapping strength based on the camera's relative position. - Texture Handling: > Uses g_MaterialTexture for base terrain colors and g_BumpTexture (e.g., "NoiseNormal.bmp") for normal mapping. > Wrap and clamp sampler states for smooth texture blending and edge handling. - Precision Enhancements: > Implements Kahan summation for position calculations to minimize precision loss. > Uses a custom function (precision_add_z) for precise computation of depth values. - Performance Optimizations: > Minimizes bump mapping computations for distant terrain to reduce GPU load. > Optimized for large-scale outdoor environments with varying levels of detail. ---------------------------------------------------------- TERTERRAINEFFECTDX9.FX PURPOSE - This shader is designed for terrain rendering with bump mapping, directional and point light support, and fog integration. It enhances realism in large-scale outdoor environments by simulating surface details and lighting effects. KEY FEATURES - Terrain Rendering with Bump Mapping: > Utilizes `BumpTexture` for normal mapping to add fine surface details. > Adjusts bump effect dynamically based on distance (controlled by `BumpAmount` and fade parameters). - Dynamic Lighting: > Directional lighting using `LightDir` and `LightColor` for sunlight simulation. > Optional support for point lights with range and color effects (`PointLight`). > Ambient light blending using `AmbientLight`. - Fog Integration: > Smooth fog blending based on distance (`FogDistance`) for atmospheric effects. > Layered fog fade-out with user-defined start and end distances. - Camera and View Adaptation: > Accounts for camera position and view projection transformations for consistent terrain shading. > Includes distance-based fade and noise scaling for optimizing far-field rendering. - Texture Sampling and Performance: > Employs two samplers: `TextureSampler` for base material and `BumpSampler` for bump mapping. > Linear filtering for smooth texture transitions. - Efficient Tangent Frame Calculation: > Computes tangent space transformations dynamically for terrain surface normals. > Adapts lighting directions into terrain tangent space for precise shading. ---------------------------------------------------------- TERWATEREFFECT0.FX PURPOSE - This shader simulates water effects and terrain blending with dynamic lighting, bump mapping, and fog. Designed for rendering water surfaces and nearby land transitions in Strike Fighters 2. KEY FEATURES - Water Simulation: > Bump mapping with dynamic noise from g_BumpTexture to create realistic water surface ripples. > Adjustable bump effect controlled by g_BumpAmount, fading with distance for optimized visuals. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic lighting. > Per-pixel ambient and diffuse shading for both water and land surfaces. > Unique lighting treatments for water and terrain, including tangent frame calculations. - Terrain-Water Blending: > Seamlessly blends water and land surfaces using alpha blending from the base texture. - Fog Integration: > Adds atmospheric fog using g_FogDistance and g_FogLayer for depth and altitude-based effects. > Smooth transitions between fog and object colors for a natural appearance. - Dynamic Effects: > Real-time adjustments to water ripple intensity and alpha blending based on camera position and object proximity. - Performance Optimizations: > Bump effects fade at distances beyond EndFadeDist2 for reduced overhead. > Precision improvements with Kahan summation for position calculations. - Texture Handling: > Uses g_MaterialTexture for terrain base color and alpha blending. > Bump mapping driven by g_BumpTexture for both water and terrain noise details. > Separate samplers for textures (clamp) and bump maps (wrap). ---------------------------------------------------------- TERWATEREFFECT0DX9.FX PURPOSE - A water shader designed for DirectX 9, offering realistic water and land transitions. It utilizes bump mapping, dynamic lighting, and fog integration to simulate complex water surface effects and terrain blending. KEY FEATURES - Realistic Water Effects: > Supports bump mapping for dynamic water surface ripples and noise. > Blends water and terrain dynamically based on the alpha channel of the base texture. - Lighting and Shading: > Per-pixel lighting for directional, ambient, and point lights. > Utilizes light direction and normal maps for detailed water and land shading. > Point light effects diminish over distance, adding realism to lighting falloff. - Fog Integration: > Supports atmospheric fog with configurable start and end distances (FogDistance). > Smooth blending for objects fading into the fog. - Performance Optimizations: > Dynamically adjusts bump mapping intensity based on distance for better performance. > Precomputes tangent-space transformations in the vertex shader. - Dynamic Noise: > Noise-based normal mapping adds visual complexity to water surfaces. > Adjustable noise intensity (BumpAmount) scales ripples with distance. ---------------------------------------------------------- TERWATEREFFECT1.FX PURPOSE - This shader creates water and terrain effects by blending dynamic water surfaces with land textures. It simulates water ripples, reflections, and lighting while maintaining realistic transitions to terrain. KEY FEATURES - Water Effects: > Uses g_BumpTexture for water surface normal mapping, simulating ripples and waves. > Dynamically adjusts bump mapping intensity (g_BumpAmount) based on view distance. - Terrain Integration: > Blends water and land textures (g_MaterialTexture) based on alpha values. > Adds noise to water surfaces for natural variation and realism. - Lighting and Shading: > Supports ambient and diffuse lighting for both water and terrain. > Specular highlights are computed for water surfaces to simulate light reflections. - Fog Integration: > Seamlessly integrates fog effects (g_FogDistance, g_FogLayer) for realistic atmospheric depth. - Adaptive Rendering: > Dynamically fades water bump mapping based on distance for optimized performance. > Implements UV scaling and adjustments to simulate dynamic water movement. ---------------------------------------------------------- TERWATEREFFECT1DX9.FX PURPOSE - This shader creates a dynamic water effect with bump mapping, directional lighting, and fog integration. It blends water and terrain for realistic rendering in scenes with bodies of water and land. KEY FEATURES - Water and Land Blending: > Blends water and land textures based on alpha values in the main texture. > Separate lighting computations for water and land for better realism. - Dynamic Bump Mapping: > Bump mapping applied to water surface using NoiseNormal.bmp. > Noise effect controlled by BumpAmount and camera-relative coordinates. > Smooth transition for bump effects based on distance fading. - Lighting and Shading: > Directional and point lights for dynamic illumination. > Water and land lighting use directional light vectors and optional per-pixel point light sources. > Specular highlights calculated with SpecularPower and SpecularColor for realistic reflections on water. - Fog Integration: > Fog effects are calculated based on camera distance and altitude using FogDistance. > Smooth blending between fog and rendered colors for natural transitions. - Performance Optimizations: > Distances and fade effects pre-computed in the vertex shader. > Simplified calculations for land when bump mapping is not applied. > Efficient usage of alpha blending for texture transitions. - Techniques: > `WaterBump`: Combines water and land rendering with bump mapping for water surfaces. ---------------------------------------------------------- TERWATEREFFECT2.FX PURPOSE - This shader renders dynamic water and terrain effects with integrated bump mapping, specular highlights, and fog. It uses wave and noise textures to simulate realistic water motion and detailed terrain surfaces. KEY FEATURES - Water Simulation: > Implements dynamic wave effects using g_WaveTexture and wind movement (WindVelocity). > Configurable wave intensity (WaveBumpAmount) and cycle rate (WaveCycleRate). > Simulates water motion with smooth transitions and fade effects based on distance. - Terrain Bump Mapping: > Adds terrain surface details with g_BumpTexture using adjustable bump intensity (g_BumpAmount). > Handles terrain fading for realistic blending with distant terrain. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Per-pixel ambient and diffuse lighting, including specular highlights with adjustable power (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Atmospheric fog based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth blending between fog and object colors for natural transitions. - Noise-Based Texture Blending: > Uses noise scaling (NoiseScale) to enhance surface variation. - Precision Enhancements: > Implements Kahan summation for precise depth calculations in compute_pos. - Dynamic Effects: > Time-based wave animation driven by g_TimeNow for realistic water movement. > Seamless blending between water and terrain textures based on alpha. ---------------------------------------------------------- TERWATEREFFECT2DX9.FX PURPOSE - This water effect shader simulates dynamic water surfaces with waves, reflections, lighting effects, and blending with underlying terrain. It is optimized for DirectX 9 and supports both water and land rendering seamlessly. KEY FEATURES - Water Dynamics: > Simulates wave motion using sine functions and a moving noise texture. > Adjustable wave parameters (WaveNoiseScale, WaveBumpAmount, WaveCycleRate) for customizable effects. - Terrain Blending: > Blends water surfaces with terrain textures based on alpha values for natural transitions between land and water. - Lighting and Specular Highlights: > Calculates per-pixel diffuse and specular lighting based on directional and point light sources. > Supports realistic light interaction with water normals and wave distortions. - Fog Integration: > Adds atmospheric depth using configurable fog distance (FogDistance). - Wind and Wave Movement: > Incorporates wind velocity (WindVelocity) for dynamic wave movement. > Time-based wave animation for realistic surface motion. - Texture Sampling: > Uses multiple texture samplers for material, bump, and wave normal maps. > Adjustable texture filtering for optimal visual quality. - Performance Optimization: > Includes adjustable fade distances for bump and wave effects to optimize performance for distant objects. ---------------------------------------------------------- ------------------------ TW COLOR ------------------------ ---------------------------------------------------------- TWCOLOR0.FX PURPOSE - A simple shader for rendering vertex-colored objects. It passes vertex colors directly to the output, with no additional lighting or texture sampling, making it lightweight and ideal for rendering basic colored geometry. KEY FEATURES - Vertex Color Rendering: > Directly outputs vertex diffuse color from the input data without modifications. - Minimal Shader Pipeline: > No texture sampling or lighting calculations, ensuring high performance for simple geometry. - Transformations: > Transforms vertex positions from local space to screen space using g_mMeshToWorld and g_mViewProj matrices. - Lightweight Design: > Optimized for scenarios where vertex colors are sufficient and no advanced shading is required. ---------------------------------------------------------- TWCOLOR1.FX PURPOSE - This shader is designed for rendering textured objects with per-vertex color blending. It supports linear filtering for smooth texture sampling and simple transformations for efficient performance in lightweight applications. KEY FEATURES - Per-Vertex Color Blending: > Blends per-vertex diffuse colors with texture sampling for flexible color effects. > Supports dynamic color variations across vertices. - Texture Sampling: > Uses g_MaterialTexture for applying a texture map to the mesh. > Linear filtering via g_LinearSampler ensures smooth transitions between texels. - Lightweight Transformations: > Transforms vertices from model space to view-projection space using g_mMeshToWorld and g_mViewProj matrices. > Optimized for scenarios where complex lighting and shading are unnecessary. - Efficiency: > Minimal computational overhead due to simple vertex and pixel shader operations. > No lighting or fog integration, keeping the shader focused on texture and color blending. ---------------------------------------------------------- TWCOLOR2.FX PURPOSE - This shader allows for multi-texture blending with per-vertex color modulation. It is ideal for scenarios requiring a base texture combined with an optional second texture for effects like overlays or decals. KEY FEATURES - Multi-Texture Blending: > Supports two texture stages: 1. **Base Texture** (g_MaterialTexture0): The primary texture applied to the mesh. 2. **Overlay Texture** (g_MaterialTexture1): An optional secondary texture blended with the base texture using alpha blending. > Dynamic control via g_NumTextures to enable or disable the second texture stage. - Per-Vertex Color Modulation: > Blends vertex color with the resulting texture for added flexibility in color effects. > Allows for color gradients or lighting-like effects without per-pixel calculations. - Texture Sampling: > Linear filtering via g_LinearSampler ensures smooth texture transitions. > Separate UV coordinates for each texture stage (uv0 for g_MaterialTexture0, uv1 for g_MaterialTexture1). - Lightweight Transformations: > Transforms vertices from model space to view-projection space using g_mMeshToWorld and g_mViewProj matrices. > Optimized for efficiency with no advanced lighting or fog effects. - Efficiency: > Designed for applications needing basic texture blending with minimal computational overhead. ---------------------------------------------------------- TWCOLOR8.FX PURPOSE - This shader is designed to blend up to **eight textures** dynamically, allowing complex layering and effects. It supports per-vertex color modulation for further customization and is ideal for applications requiring detailed multi-texturing. KEY FEATURES - Multi-Texture Blending: > Supports up to 8 texture stages: * **Base Texture** (g_MaterialTexture0): Primary texture applied to the mesh. * **Overlay Textures** (g_MaterialTexture1 to g_MaterialTexture7): Additional textures blended sequentially using alpha blending. > Blending logic: * Output is blended with each stage based on the alpha channel of the overlay texture. * Ensures smooth transitions and layered effects. - Per-Vertex Color Modulation: > Combines vertex colors with the blended result for additional artistic control. > Enables dynamic color gradients or vertex-specific tinting. - Texture Sampling: > UV mappings for all 8 textures (uv0 to uv7) are passed from the vertex shader to the pixel shader. > Linear filtering (g_LinearSampler) ensures smooth sampling and blending. - Lightweight Transformations: > Transforms vertices from model space to view-projection space using g_mMeshToWorld and g_mViewProj matrices. > Focuses solely on texture blending without lighting or fog effects. - Configurable Texture Count: > Controlled via **g_NumTextures**, the number of active textures can range from 1 to 8, enabling optimization for specific use cases. - Versatility: > Ideal for terrains, decals, and other scenarios requiring complex texture layering. NOTES - Texture Stages: > Each texture stage beyond the base layer is conditionally applied based on g_NumTextures. > The shader ensures unused texture stages are skipped, optimizing performance. ---------------------------------------------------------- TWCOLORBIAS.FX PURPOSE - A minimalistic shader designed for direct rendering of vertex colors. It applies no textures, lighting, or transformations, making it suitable for debugging, simple overlays, or wireframe rendering with per-vertex color. KEY FEATURES - Per-Vertex Color Rendering: > Directly outputs the **diffuse color** defined at each vertex. > No blending or texture sampling involved, ensuring high performance for simple cases. - Lightweight Shader Structure: > Vertex Shader: - Passes vertex color (diffuse) and position directly to the pixel shader. > Pixel Shader: - Outputs the input diffuse color as the final pixel color. > No additional computations or sampling, keeping GPU usage minimal. - Simple Transformation: > Positions are directly passed through, suitable for use in scenarios where screen coordinates or pre-transformed positions are supplied. NOTES - Use Cases: > Ideal for rendering debug visuals like bounding boxes or vertex color overlays. > Can be extended for additional effects like wireframe rendering. - No View/Projection Transform: > Assumes positions are already in the required space (e.g., screen space). > Does not include support for model-view-projection transformations. - High Efficiency: > Designed for scenarios where minimal GPU resources are required. ---------------------------------------------------------- -------------------- TW TEXT / FORMATS ------------------- ---------------------------------------------------------- TWFONT.FX PURPOSE - This shader is specialized for rendering text overlays and HUD elements in screen-space. It maps text textures to screen coordinates and supports per-vertex color blending for dynamic text effects. KEY FEATURES - Screen-Space Text Rendering: > Converts 2D screen coordinates to clip-space coordinates for correct positioning. > Accounts for viewport offsets using g_ViewportTopLeft. - Per-Vertex Color Blending: > Blends per-vertex diffuse colors with sampled texture colors for customizable text coloring effects. - Texture Sampling: > Applies g_MaterialTexture for rendering font glyphs. > Linear filtering via g_LinearSampler ensures smooth glyph edges. - High Precision: > Utilizes g_InvScreenWidth and g_InvScreenHeight for accurate scaling across different screen resolutions. - Lightweight and Efficient: > Optimized for rendering text with minimal computational overhead. > No lighting or complex transformations to keep performance high. ---------------------------------------------------------- TWLINE.FX PURPOSE - This shader is designed for rendering lines in a 3D scene, supporting per-vertex coloring for simple and efficient line-based visualizations. KEY FEATURES - Per-Vertex Coloring: > The diffuse color is defined at each vertex, enabling smooth color transitions across the line. - 3D Transformation: > Transforms vertex positions from object space to clip space using g_mMeshToWorld and g_mViewProj matrices. > Supports integration into complex 3D environments. - Minimal Overhead: > No texture sampling or lighting calculations for maximum performance. > Optimized for scenarios where lines need to be drawn efficiently. - Lightweight Design: > Ideal for debugging, grid overlays, or other line-based graphical elements. ---------------------------------------------------------- ------------------------ TW NORMAL ----------------------- ---------------------------------------------------------- TWNORMAL1.FX PURPOSE - This shader applies normal mapping to textured meshes, supporting dynamic lighting, fog effects, and reflections. It is designed to enhance visual detail and realism in environments with textured materials. KEY FEATURES - Normal Mapping: > Calculates per-pixel normal using g_MeshToWorld transformation. > Enhances surface detail and lighting interactions. - Lighting and Shading: > Directional, point, and spotlights are supported for dynamic illumination. > Ambient and diffuse lighting computations are performed per pixel. > Specular highlights are calculated with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Reflection Clipping: > Includes g_bInReflection to conditionally clip fragments for planar reflections. - Fog Integration: > Atmospheric fog effects based on g_FogDistance and g_FogLayer. > Smooth blending with fog for depth-based visual effects. - Texture Sampling: > Wrap or clamp sampling modes for g_MaterialTexture with anisotropic filtering. - Precision Enhancements: > Kahan summation for position calculations minimizes precision loss. - Performance Optimizations: > Skips unnecessary computations when fog or reflections are disabled. ---------------------------------------------------------- TWNORMAL1BUMP.FX PURPOSE - This shader applies normal and bump mapping to textured meshes, supporting dynamic lighting, fog, and reflections. It is designed to add detailed surface effects and realism to environments. KEY FEATURES - Bump Mapping: > Uses g_BumpNormalTexture for normal perturbations. > Adjustable influence through g_BumpAmount. - Lighting and Shading: > Supports directional, point, and spotlights for dynamic illumination. > Ambient and diffuse lighting calculations are done per pixel. > Specular highlights are computed with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Tangent Frame Calculation: > Computes tangent frame for accurate normal and bump mapping in texture space. > Handles texture transformations consistently. - Reflection Clipping: > Includes g_bInReflection to clip fragments for planar reflections. - Fog Integration: > Atmospheric fog effects based on g_FogDistance and g_FogLayer. > Smooth transitions between object colors and fog using depth-based blending. - Texture Handling: > Wrap and clamp sampling modes for material and bump textures. > Anisotropic and linear filtering for smooth visual effects. - Performance Optimizations: > Conditional calculations for fog, lighting, and reflections to optimize rendering. - Precision Enhancements: > Implements Kahan summation for position calculations to reduce precision loss. ---------------------------------------------------------- TWNORMAL1BUMPSPEC.FX PURPOSE - This shader renders textured meshes with detailed bump and specular mapping, lighting, and fog integration. It is optimized for use in environments requiring high visual fidelity and supports reflection clipping for selective rendering. KEY FEATURES - Bump Mapping: > Supports g_BumpAmount for detailed normal mapping effects using g_MaterialTexture1. > Generates realistic surface variations for enhanced light interaction. - Specular Highlights: > Adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). > Supports reflection clipping (g_bInReflection) for selective surface rendering. - Lighting and Shading: > Handles ambient, diffuse, and specular lighting with per-pixel accuracy. > Supports directional, point, and spotlights for dynamic scene illumination. - Texture and Material Support: > Base texture mapping with g_MaterialTexture0. > Specular intensity mapping via g_MaterialTexture2. - Fog Integration: > Atmospheric fog effects with distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions between fog and object colors using smoothstep blending. - Advanced Tangent Frame Calculation: > Computes tangent frames for precise bump mapping in texture space. > Ensures consistency in lighting and texture transformations. - Reflection Clipping: > Allows clipping based on g_CameraPos and object depth for accurate reflections. ---------------------------------------------------------- TWNORMAL1SPEC.FX PURPOSE - This shader renders textured meshes with specular highlights, dynamic lighting, and fog effects. It includes reflection clipping functionality for improved realism in reflective surfaces. KEY FEATURES - Specular Highlights: > Adjust sharpness with g_SpecularPower and color with g_SpecularColor. > Specular mapping enhanced with g_MaterialTexture1 for intensity variation. - Lighting and Shading: > Supports ambient, diffuse, and specular lighting for realistic surface illumination. > Handles directional, point, and spotlights with per-pixel lighting precision. - Fog Integration: > Implements atmospheric fog effects with g_FogDistance and g_FogLayer for depth and altitude-based fog. > Smooth blending transitions between fog and object colors using smoothstep. - Reflection Clipping: > Clipping functionality based on g_CameraPos and object depth, controlled by g_bInReflection. - Texture and Material Handling: > Base texture mapping via g_MaterialTexture0. > Specular intensity adjustments with g_MaterialTexture1. ---------------------------------------------------------- TWNORMAL2.FX PURPOSE - This shader renders textured meshes with support for multi-texturing, dynamic lighting, specular highlights, and atmospheric fog. It is optimized for detailed surface rendering with up to two texture stages. KEY FEATURES - Multi-Texturing: > Supports up to two texture stages with alpha blending for layer compositing. - Dynamic Lighting: > Per-vertex ambient and diffuse lighting using a directional light source. > Per-pixel lighting for point and spotlights with falloff and angle attenuation. - Specular Highlights: > Specular reflections with adjustable sharpness (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Atmospheric fog effects based on distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions using smoothstep for realistic blending. - Reflection Clipping: > Option to clip pixels outside reflection volume using g_bInReflection. - Precision Enhancements: > Kahan summation in position calculations to minimize precision loss. - Texture Handling: > ANISOTROPIC filtering for high-quality texture sampling. - Performance Optimizations: > Combines per-vertex and per-pixel lighting for balanced performance and quality. ---------------------------------------------------------- TWNORMAL8.FX PURPOSE - This shader supports rendering complex multi-textured materials with dynamic lighting, specular highlights, and fog effects. It is tailored for environments and objects that require multiple texture stages and precise lighting computations. KEY FEATURES - Multi-Texturing: > Supports up to 8 texture layers (g_MaterialTexture0 to g_MaterialTexture7). > Alpha blending between texture stages for smooth transitions and layer mixing. > Dynamic handling of texture stages based on g_NumTextures. - Lighting and Shading: > Per-vertex and per-pixel lighting for ambient, diffuse, and specular effects. > Directional, point, and spotlights supported. > Specular highlights with adjustable intensity (g_SpecularPower) and color (g_SpecularColor). - Fog Integration: > Atmospheric fog effects with configurable distance (g_FogDistance) and altitude (g_FogLayer). > Smooth transitions using smoothstep for blending between object colors and fog. - Reflection Culling: > Conditional clipping of geometry when rendering reflections using g_bInReflection. - High Precision Position Computation: > Implements Kahan summation in vertex transformations to minimize precision loss. - Texture Filtering and Wrapping: > Anisotropic filtering for high-quality texture sampling. > Wrap and clamp options for texture coordinate handling. - Advanced Per-Pixel Effects: > Incorporates point and spot light falloff based on distance and angle. > Blends multiple texture stages with per-pixel lighting for enhanced realism. ---------------------------------------------------------- --------------------- TW POST PROCESS -------------------- ---------------------------------------------------------- TWPOSTPROCESS.FX PURPOSE - Implements high-dynamic-range (HDR) post-processing effects including luminance calculation, bright-pass filtering, bloom, and final tone mapping. Designed to enhance visual fidelity and dynamic lighting realism in rendered scenes. KEY FEATURES - Luminance Calculation: > Downscales the scene to calculate average luminance using `PS_DownScale_Lum`. > Supports iterative luminance map downscaling with `PS_DownScale` for exposure control. - Bright-Pass Filtering: > Extracts high-intensity pixels for bloom effects using `PS_DownScale_BrightPass`. > Adaptively enhances bright areas while retaining HDR highlights. - Bloom Effect: > Generates a bloom texture using a Gaussian-like blur in `PS_Bloom`. > Adds radiance around bright objects to simulate light scattering. - Final Tone Mapping: > Applies tone mapping with adaptive exposure in `PS_FinalPass`. > Converts scene luminance for display while preserving HDR details. > Includes bloom blending and vignette effects for enhanced realism. - Color Space Conversion: > Converts between RGB and Yxy color spaces for luminance and tone mapping. > Ensures accurate color transformations with RGB2XYZ and XYZ2RGB matrices. - Optimized Sampling: > Uses `PointSampler` and `LinearSampler` for precise and efficient texture sampling. > Adjustable sample offsets and weights for bloom and blur computations. - Techniques: > Provides separate rendering passes for luminance, bright-pass, bloom, and final composition. ---------------------------------------------------------- ------------------------ SHADOW - ------------------------ ---------------------------------------------------------- TWSHADOWDYNAMIC.FX PURPOSE - This shader is designed for rendering dynamic shadow projections, allowing objects to cast shadows with adjustable length and vertex-based control. It is optimized for efficient shadow generation in 3D scenes. KEY FEATURES - Shadow Length Adjustment: > Shadows are extended by g_ShadowLength, allowing dynamic control over shadow size and direction. - Vertex-Based Shadow Control: > Shadows are applied only to vertices above the g_ShadowVert threshold for selective shadowing effects. - Precision Enhancements: > Implements precision addition in Z calculations using Kahan summation to reduce precision loss during shadow projection. - Matrix Transformations: > Transforms vertices from world space to view-projection space for accurate shadow placement. - Optimized for Performance: > Excludes pixel and geometry shaders, focusing solely on vertex transformations to improve efficiency. ---------------------------------------------------------- TWSHADOWSTATIC.FX PURPOSE - This shader calculates static shadows for objects, projecting their positions into clip space for shadow mapping or depth-based rendering. KEY FEATURES - Precision Depth Calculation: > Implements precision_add_z function to minimize depth precision loss in clip space. > Employs Kahan summation to handle floating-point precision errors during depth calculations. - Lightweight Design: > Optimized for vertex processing only, without pixel shading, to efficiently handle shadow computations. - World-to-Clip Space Transformation: > Transforms object positions from world space to clip space using g_mMeshToWorld and g_mViewProj matrices. - Performance Optimizations: > Excludes geometry and pixel shaders to focus entirely on vertex transformations. > Streamlined input structure (POSITION only) for minimal processing overhead. ---------------------------------------------------------- -------------------- TW STENCIL BUFFER ------------------- ---------------------------------------------------------- TWSTENCIL.FX PURPOSE - This shader is used for stencil buffer operations, designed to mark specific areas in the render target without modifying color or depth data. KEY FEATURES - Simple Pass-Through Vertex Shader: > The vertex shader directly passes input positions (POSITION) to the output (SV_POSITION) without transformation or computation. - No Pixel or Geometry Processing: > Excludes both pixel and geometry shaders for optimal performance, focusing purely on stencil operations. - Efficient for Stencil Buffer Marking: > Ideal for applications such as shadow volumes, masking, or outlining specific regions using the stencil buffer. - Minimal Overhead: > Lightweight design with no extra processing beyond position handling. ---------------------------------------------------------- -------------------- TW TRANSFORMATION ------------------- ---------------------------------------------------------- TWTRANSFORMED0.FX PURPOSE - This shader is designed for rendering pre-transformed screen-space geometry, such as 2D UI elements or overlay graphics. It supports basic color and UV mapping functionality with efficient screen-to-clip space coordinate conversion. KEY FEATURES - Screen-to-Clip Space Conversion: > Converts input screen coordinates (pos) into clip space for rendering using g_InvScreenWidth and g_InvScreenHeight. > Adjusts for viewport offsets using g_ViewportTopLeft to ensure correct placement. - Color Handling: > Passes vertex color (diffuse) directly to the pixel shader for rendering. - Lightweight Design: > Optimized for pre-transformed geometry with minimal computational overhead. ---------------------------------------------------------- TWTRANSFORMED1.FX PURPOSE - This shader renders pre-transformed screen-space geometry with texture sampling and vertex color blending. It is suitable for UI elements or 2D overlays with basic texture and color manipulation. KEY FEATURES - Screen-to-Clip Space Conversion: > Converts screen coordinates (pos) to clip space using g_InvScreenWidth and g_InvScreenHeight. > Accounts for viewport offsets with g_ViewportTopLeft. - Texture Sampling: > Samples a texture (g_MaterialTexture) using UV coordinates and a linear sampler (g_LinearSampler) for smooth filtering. > Clamps texture addressing to ensure proper UV handling. - Vertex Color Blending: > Multiplies vertex color (diffuse) with the sampled texture color in the pixel shader for flexible visual effects. - Lightweight and Efficient: > Designed for rendering pre-transformed geometry with minimal performance overhead. ---------------------------------------------------------- TWTRANSFORMED2.FX PURPOSE - This shader is designed for rendering 2D screen-space transformed objects with support for multiple texture layers and per-vertex color blending. It is optimized for UI elements, overlays, and other 2D assets. KEY FEATURES - Screen-Space Transformation: > Converts input positions from screen coordinates to clip space using g_ViewportTopLeft, g_InvScreenWidth, and g_InvScreenHeight for precise placement. - Texture Blending: > Supports up to two textures (g_MaterialTexture0 and g_MaterialTexture1). > Blends textures using alpha transparency, enabling multi-layered effects. - Per-Vertex Color: > Input vertex colors (diffuse) are blended with sampled texture colors for additional customization. - Sampler Configuration: > Linear filtering (g_LinearSampler) ensures smooth texture sampling. > Clamp addressing prevents texture wrapping for clean 2D rendering. - Minimal Overhead: > Lightweight shader optimized for 2D rendering, reducing GPU load for screen-aligned assets. ---------------------------------------------------------- TWTRANSFORMED8.FX PURPOSE - This shader renders transformed vertices directly in screen space with support for up to 8 texture stages. It is designed for efficient compositing of multiple textures with alpha blending in a 2D rendering pipeline. KEY FEATURES - Screen-Space Rendering: > Converts screen coordinates to clip space using `g_ViewportTopLeft`, `g_InvScreenWidth`, and `g_InvScreenHeight`. > Simplifies rendering of already-transformed vertices in screen space. - Multi-Texture Compositing: > Supports blending of up to 8 textures (g_MaterialTexture0 to g_MaterialTexture7). > Textures are layered using their alpha values, allowing for smooth transitions. - Adaptive Texture Pipeline: > Dynamically adjusts rendering based on `g_NumTextures` for optimal performance. > Each texture stage is sampled only if required. - Linear Filtering: > Applies `MIN_MAG_MIP_LINEAR` filtering for smooth texture sampling. - Lightweight Shading: > Uses a straightforward vertex color (`diffuse`) modulation with texture output. > Optimized for simplicity and speed in 2D rendering scenarios. - Versatility: > Ideal for HUD elements, overlays, and other 2D components requiring multi-layered visuals. ---------------------------------------------------------- ----------------------- OTHER FILES ---------------------- ---------------------------------------------------------- BLUECONE.LOD GREENCONE.LOD REDCONE.LOD WHITECONE.LOD STARS.DAT