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

@ -74,6 +74,8 @@ bool WMORenderer::initialize(pipeline::AssetManager* assets) {
in vec4 VertexColor;
uniform vec3 uLightDir;
uniform vec3 uLightColor;
uniform float uSpecularIntensity;
uniform vec3 uViewPos;
uniform vec3 uAmbientColor;
uniform sampler2D uTexture;
@ -105,7 +107,7 @@ bool WMORenderer::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.15);
vec3 specular = spec * uLightColor * uSpecularIntensity;
// Sample texture or use vertex color
vec4 texColor;
@ -490,6 +492,8 @@ void WMORenderer::render(const Camera& camera, const glm::mat4& view, const glm:
shader->setUniform("uProjection", projection);
shader->setUniform("uViewPos", camera.getPosition());
shader->setUniform("uLightDir", glm::vec3(-0.3f, -0.7f, -0.6f)); // Default sun direction
shader->setUniform("uLightColor", glm::vec3(1.5f, 1.4f, 1.3f));
shader->setUniform("uSpecularIntensity", 0.5f);
shader->setUniform("uAmbientColor", glm::vec3(0.4f, 0.4f, 0.5f));
shader->setUniform("uFogColor", fogColor);
shader->setUniform("uFogStart", fogStart);