Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----- we do have alpha in base.a at this point
- ---- this is temporary color composed from color(base + bump, etc) and vertex color
- vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
- #if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE
- float alpha = gl_Color.a;
- if (fogDistance != 0.0) {
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
- alpha = mix(alpha, 0.0, d);
- }
- ----- here alpha is replaced with fog one
- col = vec4(col.rgb, alpha);
- #else
- if (fogDistance != 0.0) {
- float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
- col = mix(col, skyBgColor, d);
- }
- ----- If theres no fog, texture alpha is being used
- col = vec4(col.rgb, base.a);
- #endif
- ----- so here we do have proper alpha back
- #ifdef ENABLE_TONE_MAPPING
- gl_FragColor = applyToneMapping(col);
- #else
- gl_FragColor = col;
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement