Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. ----- we do have alpha in base.a at this point
  2.  
  3. ---- this is temporary color composed from color(base + bump, etc) and vertex color
  4. vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
  5.  
  6. #if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE
  7. float alpha = gl_Color.a;
  8. if (fogDistance != 0.0) {
  9. float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
  10. alpha = mix(alpha, 0.0, d);
  11. }
  12. ----- here alpha is replaced with fog one
  13. col = vec4(col.rgb, alpha);
  14. #else
  15. if (fogDistance != 0.0) {
  16. float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));
  17. col = mix(col, skyBgColor, d);
  18. }
  19. ----- If theres no fog, texture alpha is being used
  20. col = vec4(col.rgb, base.a);
  21. #endif
  22.  
  23.  
  24. ----- so here we do have proper alpha back
  25. #ifdef ENABLE_TONE_MAPPING
  26. gl_FragColor = applyToneMapping(col);
  27. #else
  28. gl_FragColor = col;
  29. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement