playcanvas
Version:
PlayCanvas WebGL game engine
4 lines (2 loc) • 577 B
JavaScript
var reflectionSheenPS = "\nvoid addReflectionSheen(vec3 worldNormal, vec3 viewDir, float gloss) {\n float NoV = dot(worldNormal, viewDir);\n float alphaG = gloss * gloss;\n float a = gloss < 0.25 ? -339.2 * alphaG + 161.4 * gloss - 25.9 : -8.48 * alphaG + 14.3 * gloss - 9.95;\n float b = gloss < 0.25 ? 44.0 * alphaG - 23.7 * gloss + 3.26 : 1.97 * alphaG - 3.27 * gloss + 0.72;\n float DG = exp( a * NoV + b ) + ( gloss < 0.25 ? 0.0 : 0.1 * ( gloss - 0.25 ) );\n sReflection += calcReflection(worldNormal, 0.0) * saturate(DG);\n}\n";
export { reflectionSheenPS as default };