static_water Material Type - PrismaticFlower/shaderpatch GitHub Wiki

A material type that let's you place water wherever you'd like in your map. The animation for the water can come from the game's stock scroll rendertype or by tweaking material properties. There is also no requirement that water be planar. This material type is not suitable for materials that be used in the far scene due to the presence of dynamic refraction. (You can use it, but refractions will be from the previous frame and not correct.)

Mimicking Stock Water

This material type is designed to flexible enough to let you come close to the game's actual water. (Come close, there are a couple things, like collision and splashes that can not (easilly) be mimicked.)

The first thing to know is that if you mark your static water material as Doublesided then the static_water shader includes logic to not display reflections on the backside of the material. Helping you to recreate the look of being underwater. Although keep in mind doublesided surfaces do add to the GPU cost, so only do it for water that you actually want the camera to be able to look through from underneath.

The second thing to know is that you can use a well placed color grading region to further enchance this illusion and tint the game world while the camera is under water.

And finally for shallow water (like fountains or creeks) consider making the surface undearneath the water it's own object and making it's FoleyFXGroup be water_foley. Not really a Shader Patch specific tip but a useful for enhancing the water's illusion nonetheless.

Material Properties

All properties have reasonable defaults so there is no need to specify them all in your config if you do not want.

RefractionColor

  • Type: vec3
  • Default: [0.25, 0.50, 0.75]

Color to tint the scene behind the water.

BackRefractionColor:

  • Type: vec3
  • Default: [0.25, 0.50, 0.75]

Color to tint the scene behind the water, when look through the water from a back facing triangle.

ReflectionColor

  • Type: float
  • Default: [1.0, 1.0, 1.0]

Color to tint the reflections on the water.

RefractionScale:

  • Type: float
  • Default: 0.1333

Scale of the distortion for the scene behind the water.

SmallBumpScale:

  • Type: float
  • Default: 0.25

Small normal map detail strength.

MediumBumpScale:

  • Type: float
  • Default: 0.25

Medium normal map detail strength.

LargeBumpScale:

  • Type: float
  • Default: 0.25

Large normal map detail strength.

SmallScroll:

  • Type: vec2
  • Default: [0.2, 0.2]

Amount and direction the small normal map moves per second. Set to [0.0, 0.0] if animation comes from the game's stock scroll rendertype.

The water animation completes every 3600 seconds (based off the system clock, NOT ingame time), in order for it to be seamless you should be able to multiply these values by 3600 and get an integer. Or the fractional part should be so small you won't notice when the animation wraps.

MediumScroll:

  • Type: vec2
  • Default: [0.2, 0.2]

Amount and direction the medium normal map moves per second. Set to [0.0, 0.0] if animation comes from the game's stock scroll rendertype. See SmallScroll for rules on animation.

LargeScroll:

  • Type: vec2
  • Default: [0.2, 0.2]

Amount and direction the large normal map moves per second. Set to [0.0, 0.0] if animation comes from the game's stock scroll rendertype. See SmallScroll for rules on animation.

UseSpecularLighting

  • Type: bool
  • Default: false

Enable or disable the display of specular reflections from lights on the water.

SpecularExponentDirLights:

  • Type: float
  • Default: 64.0

Specular exponent for directional lights.

SpecularStrengthDirLights:

  • Type: float
  • Default: 1.0

Specular strength for directional lights. Set to 0.0 to stop specular highlights from directional lights showing up.

SpecularExponent:

  • Type: float
  • Default: 64.0

Specular exponent for point and spot lights.

FresnelMinMax:

  • Type: vec2
  • Default: [0.0, 1.0]

The range to clamp the water's fresnel value to. Mimics the same setting from the game's vanilla water.

Texture Properties

NormalMap

Normal map for the water. Will be sampled three times and differ scales and rotations. Each of these samples will contribute to the final normal for the water based off the *BumpScale values. Shader Patch's own water normal map can be used by specifying $water. Format should be BC5 for user supplied normal maps.

ReflectionMap

Sets the envmap to use for reflections. Must be a cubemap. Format should be BC7 or BC6H_UF16. If the material will be used with HDR rendering then sRGB should be set to yes.