Realistic canal water

From The DarkMod Wiki
Revision as of 21:20, 23 March 2023 by Bikerdude (talk | contribs) (→‎Custom water texture)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

written by bikerdude

Summary

I created this water for Seeking Lady Leicester because up until then, The Darkmod didn’t have water that looked like it should at night. So what we have is as close as I could get to faking moving water reflections that reacted to nearby light sources.

Pretty Canal Water

Coloured, Murky, Reflective Canal Water

In a nutshell all the water is comprised of is a standard guis\underwater\underwater_blue_thinmurk.gui for underwater and a custom shader for the surface. I choose the custom shader, because every other method of using patches on the surface of the water never got close enough to the result I was after.

Custom water texture

What we have is 3 stages -

  • Bumpmap - this provides sudo micro-waves to the surface of the water.
  • Specularmap - this provides the reflections on the waves from nearby sources of light.
  • Deform/heathaze - this was copied from the stock water texture (water_coloured) to provide the darkness to the surface of the water at night time.
textures/water_source/water_dark_murk
{
	qer_editorimage textures/water_source/water_dark_ed
	discrete
	nonsolid
	water
	twosided
	translucent
	description "dark, semi-transparent clear water with normalmap"

	{
		blend    bumpmap
		map			textures/water_source/water_green_local
		translate	 0.025 * sintable[time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 2)], 0.01 * sintable[time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 2.2)]
		scale 1,1
	}
	{
        blend    specularmap
        map _white
		translate	 0.025 * sintable[time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 2)], 0.01 * sintable[time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 2.2)]
		scale 1,1
        rgb 1.0
	}

	deform turbulent sinTable 0.0175 (time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 1.5)) 10
	{
		vertexProgram HeatHazeWithMaskAndDepth.vfp
		vertexParm 0 time * (( parm5 + 0.1) - (( parm5 || 0) * 0.1)) , time * ((( parm5 + 0.1) - (( parm5 || 0) * 0.1)) * 5)
		vertexParm 1 (( parm6 + 1.5) - (( parm6 || 0) * 1.5))
		fragmentProgram HeatHazeWithMaskAndDepth.vfp
		fragmentMap 0 _currentRender
		fragmentMap 1 textures/sfx/vp1
		fragmentMap 2 textures/water_source/vp_water
		fragmentMap 3 _currentDepth
	}
	{
		blend blend
		map textures/water_source/water_clear
		alpha 0.7
		rgb 0.05
	}
}

See Also

Objects_Floating_in_Water Ragdoll Corpses in Water