sky-fs.chunk 957 B

12345678910111213141516171819202122232425262728293031323334
  1. // default functions
  2. #ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY
  3. vec4 SurfacesFragmentModifyBaseColorAndTransparency()
  4. {
  5. return vec4(cc_ambientSky.xyz * cc_ambientSky.w, 1.0);
  6. }
  7. #endif
  8. // no structure and module functions needed
  9. layout(location = 0) out vec4 fragColorX;
  10. void main() {
  11. vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();
  12. color.a = 1.0;
  13. // HDR Fog
  14. // todo: apply fogColorBrightness to linear fogColor for supporting scatter lighting with HDR
  15. #if CC_USE_FOG != CC_FOG_NONE
  16. float fogFactor = 1.0;
  17. CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);
  18. CC_APPLY_FOG_BASE(color, fogFactor);
  19. #endif
  20. #if CC_USE_RGBE_OUTPUT
  21. color = packRGBE(color.rgb);
  22. #else//todo: change to #elif !CC_USE_FLOAT_OUTPUT when sky render queue has been fixed with custom pipeline
  23. color.rgb = HDRToLDR(color.rgb);
  24. color.rgb = LinearToSRGB(color.rgb);
  25. #endif
  26. fragColorX = color;
  27. }