feat: improve fps controller / add fog and ambient light to the scene

This commit is contained in:
2026-10-16 09:29:59 +02:00
parent 21621001c2
commit 4c9b77c948
105 changed files with 609 additions and 110 deletions
+3 -2
View File
@@ -91,16 +91,17 @@ void main()
diffuseColor, roughness, metallic, f0, shadow);
}
// emissive
vec3 emissiveColor = material.emissiveColor.rgb * sampleTexture2D(material.emissiveTex, samplerID, inUV).rgb;
fragColor += emissiveColor;
// ambient, the specular part keeps metals from turning black without lights
float NoV = clamp(dot(n, v), 0.0001, 1.0);
vec3 ambientLight = pcs.sceneData.ambientColor * pcs.sceneData.ambientIntensity;
vec3 ambientSpecular = envBRDFApprox(f0, roughness, NoV);
fragColor += (diffuseColor + ambientSpecular) * ambientLight * ambientOcclusion;
float fogAmount = pcs.sceneData.fogDensity * length(cameraPos - fragPos);
fragColor = mix(pcs.sceneData.fogColor, fragColor, exp(-fogAmount * fogAmount));
if (pcs.sceneData.debugLightHeatmap != 0) {
fragColor = mix(fragColor, lightHeatmapColor(tileLightCount), 0.5);
}