Skip to content

Instantly share code, notes, and snippets.

@KumoKairo
Created August 11, 2017 15:21
Show Gist options
  • Save KumoKairo/a1cabe7ca567ed24d71280aad8131e0c to your computer and use it in GitHub Desktop.
Save KumoKairo/a1cabe7ca567ed24d71280aad8131e0c to your computer and use it in GitHub Desktop.
#define HARDNESS_EXPONENT_BASE 0.125
half calcSunSpot(half3 sunDirPos, half3 skyDirPos)
{
half3 delta = sunDirPos - skyDirPos;
half dist = length(delta);
half spot = 1.0 - smoothstep(0.0, _SunSize, dist);
return 1.0 - pow(HARDNESS_EXPONENT_BASE, spot * _SunHardness);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment