Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/shaders/glsl/model_water.fs
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | #if USE_SHADOW | ||||
float fresShadow = mix(fresnel, fresnel*shadow, dot(sunColor, vec3(0.16666))); | float fresShadow = mix(fresnel, fresnel*shadow, dot(sunColor, vec3(0.16666))); | ||||
#else | #else | ||||
float fresShadow = fresnel; | float fresShadow = fresnel; | ||||
#endif | #endif | ||||
vec3 color = mix(refrColor + 0.3*specular, reflColor + specular, fresShadow); | vec3 color = mix(refrColor + 0.3*specular, reflColor + specular, fresShadow); | ||||
color *= getLOS(); | color *= getLOS(); | ||||
gl_FragColor.rgb = applyDebugColor(color, 1.0); | |||||
// Make alpha vary based on both depth (so it blends with the shore) and view angle (make it | // Make alpha vary based on both depth (so it blends with the shore) and view angle (make it | ||||
// become opaque faster at lower view angles so we can't look "underneath" the water plane) | // become opaque faster at lower view angles so we can't look "underneath" the water plane) | ||||
t = 18.0 * max(0.0, 0.7 - v.y); | t = 18.0 * max(0.0, 0.7 - v.y); | ||||
gl_FragColor.a = 0.15 * waterDepth * (1.2 + t + fresnel); | float alpha = 0.15 * waterDepth * (1.2 + t + fresnel); | ||||
gl_FragColor = vec4(applyDebugColor(color, 1.0, alpha, 0.0), alpha); | |||||
} | } |
Wildfire Games · Phabricator