Fix clouds3d: declare outer cloud variable
'cloud' was referenced outside the for-loop where it was defined. Use 1.0 - trans (transmittance) as a cloud mask instead — same information, properly scoped.
This commit is contained in:
1 parent
48160b730f
commit
7cb04686c7
1 file changed
+3
-2
Vendored
+3
-2
@@ -188,8 +188,9 @@ var FRAG_SRC = [
|
||||
// is not the same as 'is it night').
|
||||
// Only darkens the sky, NOT the clouds — we want them to stay
|
||||
// moon-lit (their colour came from uLight) while the sky around
|
||||
// them goes dark. The cloud mask 'cloud' tells us how much of
|
||||
// this pixel is cloud, so fully cloudy pixels keep their colour.
|
||||
// them goes dark. transmittance tells us how much light made it
|
||||
// through the cloud layer (1 = clear, 0 = fully cloudy).
|
||||
'float cloud = 1.0 - trans;',
|
||||
'float skyDarkness = nightFactor * 0.85;',
|
||||
'col = mix(col, col * (1.0 - skyDarkness), 1.0 - cloud);',
|
||||
'gl_FragColor = vec4(col, 1.0);',
|
||||
|
||||
Reference in new issue
Block a user