feat(draw): add gradient to the ambient fog term based on the angular distance to the sun

This commit is contained in:
yvt 2021-01-29 20:11:32 +09:00
parent f6912b7a1d
commit 94ab95ce8d

View File

@ -158,6 +158,13 @@ void main() {
// ---------------------------------------------------------------------
// add gradient
vec3 sunDir = normalize(vec3(0., -1., -1.));
float bright = dot(sunDir, normalize(viewcentricWorldPosition.xyz));
fogColorFactor *= bright * 0.5 + 1.0;
// ---------------------------------------------------------------------
gl_FragColor = texture2D(colorTexture, texCoord);
#if !LINEAR_FRAMEBUFFER
gl_FragColor.xyz *= gl_FragColor.xyz; // linearize