Skip to content

Instantly share code, notes, and snippets.

@CkNoSFeRaTU
Created July 30, 2022 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CkNoSFeRaTU/eb78c41e0edf51f7fd0e668dc569d72a to your computer and use it in GitHub Desktop.
Save CkNoSFeRaTU/eb78c41e0edf51f7fd0e668dc569d72a to your computer and use it in GitHub Desktop.
GD3D11 PS_Water sceneWet removal
--- a/shaders/PS_Water.hlsl 2022-07-30 02:48:23.581429800 +0300
+++ b/shaders/PS_Water.hlsl 2022-07-30 02:48:30.220934200 +0300
@@ -118,14 +118,10 @@
// Darken the scene, to make a wet surface
float f = 1-saturate(pow(1-shallowDepth, 8.0f) + clamp(pow(distortionSmall.y, 2), 0.5f, 1.0f));
- float3 sceneWet = lerp(sceneClean, sceneClean * 0.01f, f); // Darken border-scene
- scene = lerp(scene, scene * float3(4, 0.2f, 0.1f) * 0.05f, f); // Darken distorted scene
-
float pxDistance = Input.vTexcoord2.y;
scene = lerp(scene, diffuse, 0.73f * max(pow(fresnel,8.0f), 0.5f));
scene.rgb += reflection * 1.0f * fresnel * lerp(1.0f, diffuse, 0.6f);
float3 color = lerp(scene, sceneClean, pow(saturate(pxDistance / 35000.0f), 4.0f));
- color = lerp(color, sceneWet, (1-shallowDepth));
color.rgb = ApplyAtmosphericScatteringGround(Input.vWorldPosition, color.rgb);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment