Skip to content

Conversation

@Kitsune44
Copy link
Contributor

@Kitsune44 Kitsune44 commented Dec 13, 2025

Shaders: RDCharacter: parameter refactor and diffuse modulation consolidation


Description

This PR introduces structural and functional improvements to the RDCharacter shader:

  • Consolidate diffuse modulation
    • Purpose: ensure consistent material appearance across all shading paths.
    • Details: Previously, diffuse modulation was applied only to the diffuse lighting term, while other shading paths such as self illumination, night vision, and Phong based effects continued to use the unmodulated base color.
      This caused inconsistent material appearance and visual artifacts when per-instance color overrides (for example rendercolor or proxy driven modulation) were used.
      Now, diffuse modulation is applied directly to the base color before any shading calculations, ensuring all subsequent lighting and shading paths operate on the fully modulated color. Visual output is consistent, aligning shader behavior with the intended use of diffuse modulation as a persistent per-instance color modification.
  • Refactor shader parameter declarations
    • Purpose: improve readability, maintainability, and logical grouping for easier future modifications.
    • Details: Reorganized SHADER_PARAM declarations in character_dx9.cpp into coherent sections: misc, base, bump, envmap, phong, detail, proxy.

Additional Changes Included in this PR

  • Process_shaders.ps1 refactor
    Added default parameters and streamlined argument construction for shader compilation automation.
  • .gitignore update
    Excludes additional generated and local files to reduce noise in commits.

Testing / Verification

  • RDCharacter shader successfully compiled and tested in-game.
  • Process_shaders.ps1 script tested with default parameters.
  • .gitignore changes verified to correctly ignore generated/local files.

Reorganize and group SHADER_PARAM declarations in character_dx9.cpp
into coherent sections (misc, base, bump, envmap, phong, detail, proxy).

This is a structural refactor for readability and maintainability only.
Previously, diffuse modulation was applied only to the diffuse lighting terms
while other shading paths—such as self-illumination, night vision,
and Phong-based effects—continued to use the unmodulated base color.
This led to inconsistent material appearance and visual artifacts
when per-instance color overrides (e.g., rendercolor or proxy-driven modulation) were used.

This change applies diffuse modulation to the base color itself before
any shading calculations, ensuring that all subsequent lighting and shading paths
operate on the fully modulated color. The visual output is now consistent,
and the shader behavior aligns with the intended use of diffuse modulation
as a persistent per-instance color modification.
@Kitsune44 Kitsune44 requested a review from BenLubar December 13, 2025 20:42
@Kitsune44 Kitsune44 added enhancement New feature or request and removed enhancement New feature or request labels Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant