Remove terrain specular and fix washed-out tonemap

Drop specular lighting from terrain shader — ground materials (dirt, grass,
stone) are purely diffuse and specular highlights made them look plastic.
Replace Reinhard tonemapper with a shoulder-only compressor that is identity
below 0.9 and softly rolls off HDR values above, preserving scene contrast.
This commit is contained in:
Kelsi 2026-02-04 15:33:00 -08:00
parent 09e1ee0ae2
commit 1c718dce22
3 changed files with 5 additions and 15 deletions

View file

@ -32,9 +32,6 @@ uniform vec3 uAmbientColor;
// Camera
uniform vec3 uViewPos;
// HDR specular
uniform float uSpecularIntensity;
// Fog
uniform vec3 uFogColor;
uniform float uFogStart;
@ -78,14 +75,8 @@ void main() {
diff = max(diff, 0.2); // Minimum light to prevent completely dark faces
vec3 diffuse = diff * uLightColor * finalColor.rgb;
// Specular lighting (subtle for terrain)
vec3 viewDir = normalize(uViewPos - FragPos);
vec3 halfwayDir = normalize(lightDir + viewDir);
float spec = pow(max(dot(norm, halfwayDir), 0.0), 32.0);
vec3 specular = spec * uLightColor * uSpecularIntensity;
// Combine lighting
vec3 result = ambient + diffuse + specular;
// Combine lighting (terrain is purely diffuse — no specular on ground)
vec3 result = ambient + diffuse;
// Apply fog
float distance = length(uViewPos - FragPos);

View file

@ -1176,9 +1176,9 @@ void Renderer::initPostProcess(int w, int h) {
out vec4 FragColor;
void main() {
vec3 color = texture(uScene, vUV).rgb;
float exposure = 1.8;
color *= exposure;
vec3 mapped = color / (color + vec3(1.0));
// Shoulder tonemap: identity below 0.9, soft rolloff above
vec3 excess = max(color - 0.9, 0.0);
vec3 mapped = min(color, vec3(0.9)) + 0.1 * excess / (excess + 0.1);
FragColor = vec4(mapped, 1.0);
}
)";

View file

@ -324,7 +324,6 @@ void TerrainRenderer::render(const Camera& camera) {
// Set lighting
shader->setUniform("uLightDir", glm::vec3(lightDir[0], lightDir[1], lightDir[2]));
shader->setUniform("uLightColor", glm::vec3(lightColor[0], lightColor[1], lightColor[2]));
shader->setUniform("uSpecularIntensity", 0.5f);
shader->setUniform("uAmbientColor", glm::vec3(ambientColor[0], ambientColor[1], ambientColor[2]));
// Set camera position