Enable HDR lighting with Reinhard tonemapping across all world shaders

Replace hardcoded specular multipliers with uLightColor * uSpecularIntensity
uniforms in all 4 world shaders (terrain, WMO, M2, character), set HDR sun
color (1.5, 1.4, 1.3) and specular intensity 0.5 so highlights can exceed
1.0, and switch the post-process pass from passthrough to exposure-compensated
Reinhard (exposure=1.8) for soft highlight roll-off without clipping.
This commit is contained in:
Kelsi 2026-02-04 15:28:47 -08:00
parent 1f672e1d73
commit 09e1ee0ae2
6 changed files with 24 additions and 6 deletions

View file

@ -253,6 +253,8 @@ bool M2Renderer::initialize(pipeline::AssetManager* assets) {
in vec2 TexCoord;
uniform vec3 uLightDir;
uniform vec3 uLightColor;
uniform float uSpecularIntensity;
uniform vec3 uAmbientColor;
uniform vec3 uViewPos;
uniform sampler2D uTexture;
@ -299,7 +301,7 @@ bool M2Renderer::initialize(pipeline::AssetManager* assets) {
vec3 viewDir = normalize(uViewPos - FragPos);
vec3 halfDir = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfDir), 0.0), 32.0);
vec3 specular = spec * vec3(0.1);
vec3 specular = spec * uLightColor * uSpecularIntensity;
// Shadow mapping
float shadow = 1.0;
@ -1117,6 +1119,8 @@ void M2Renderer::render(const Camera& camera, const glm::mat4& view, const glm::
shader->setUniform("uView", view);
shader->setUniform("uProjection", projection);
shader->setUniform("uLightDir", lightDir);
shader->setUniform("uLightColor", glm::vec3(1.5f, 1.4f, 1.3f));
shader->setUniform("uSpecularIntensity", 0.5f);
shader->setUniform("uAmbientColor", ambientColor);
shader->setUniform("uViewPos", camera.getPosition());
shader->setUniform("uFogColor", fogColor);