feat: improve fps controller / add fog and ambient light to the scene
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user