Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/shaders/glsl/water_high.fs
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | #if USE_REAL_DEPTH | ||||
if (depth > newDepth + 3.0) | if (depth > newDepth + 3.0) | ||||
distoFactor /= 2.0; // this in general will not fall on the fish but still look distorted. | distoFactor /= 2.0; // this in general will not fall on the fish but still look distorted. | ||||
else | else | ||||
depth = newDepth; | depth = newDepth; | ||||
#endif | #endif | ||||
#if USE_FANCY_EFFECTS | #if USE_FANCY_EFFECTS | ||||
depth = max(depth, fancyeffects.a); | depth = max(depth, fancyeffects.a); | ||||
if (waterDepth < 0.0) | |||||
depth = 0.0; | |||||
#endif | #endif | ||||
// Distort the texture coords under where the water is to simulate refraction. | // Distort the texture coords under where the water is to simulate refraction. | ||||
refrCoords = (0.5 * refractionCoords.xy - n.xz * distoFactor) / refractionCoords.z + 0.5; | refrCoords = (0.5 * refractionCoords.xy - n.xz * distoFactor) / refractionCoords.z + 0.5; | ||||
vec3 refColor = texture2D(refractionMap, refrCoords).rgb; | vec3 refColor = texture2D(refractionMap, refrCoords).rgb; | ||||
// Note, the refraction map is cleared using (255, 0, 0), so pixels outside of the water plane are pure red. | // Note, the refraction map is cleared using (255, 0, 0), so pixels outside of the water plane are pure red. | ||||
// If we get a pure red fragment, use an undistorted/less distorted coord instead. | // If we get a pure red fragment, use an undistorted/less distorted coord instead. | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator