Standard Waterwarp Consistency Test

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Standard Waterwarp Consistency Test

Postby mankrip » Fri Dec 09, 2016 12:56 am

The screen distortion when submerged, known as "water warp" (from the r_waterwarp cvar name) is one of the main visual effects introduced in the first Quake game.

However, its implementation did not behave consistently across the multiple possible configurations of the game. Configurations that introduces innacuracies in this effect's behavior are:
  • Monitor aspect
  • Video aspect (whether it's stretched to monitor aspect)
  • Video resolution (desktop or fullscreen area)
  • Image resolution (window or fullscreen area)
  • Image scale (controlled by the viewsize cvar)
  • Status bar (the classic one offsets the on-screen view position)

So, here's a standardized test to check the accuracy of this effect across multiple configurations and multiple engines:
  • Download this savegame, and place it in a clean installation of the game
  • Start the game, open the console and enter this commandline: load waterwarptest;wait;wait;wait;wait;pause
The four "wait" commands makes the engine run 4 frames before pausing, which is needed to allow all data to be properly initialized and updated by the savegame.

At the resolution of 320x240, which was the default 4:3 resolution the renderer was programmed for (as confirmed by all the multiple occurrences of these dimensions as base values for the rendering calculations in the engine's source code), it looks like this:
The above screenshot was upscaled 4 times, to serve as a base for comparison against the highest 4:3 resolution supported by the vanilla WinQuake engine, which is 1280x960.
The 4:3 aspect was chosen because it is the only one that WinQuake can render at.
The window borders were kept to make sure that the output image resolution was accurately set.

By following this test, here's how the waterwarp looks at 1280x960 in WinQuake and several other engines.
The borders of the following screenshots were padded to align the contents of their windows to the contents of the original 320x240 screenshot above, which allows for easier per-pixel comparisons.
These are rendered at exactly the same frame in time, and the same position in space, as provided by the waterwarptest.sav savegame:
On all these engines I've tested, only Retroquad was fully accurate to the original 320x240 rendering. FTEQW was pretty close, with the size of the waves being the most faithful among all the other engines, despite not being truly accurate.

"WinQuake Mark V" at 1280x960 is consistent with vanilla WinQuake at the same resolution, but this is actually a false positive, since WinQuake is not consistent with itself.

Retroquad is not only accurate at 1280x960, but it is also consistently accurate across multiple resolutions and aspects, in both windowed and fullscreen video modes.
The algorithm it uses was developed for the Makaqu engine, and here is an animated collection of screenshots for comparing exactly the same scene across many different configurations.
Each screenshot in the animation linked above was scaled and offset to align their contents for per-pixel comparisons.

FTEQW is also consistent across multiple resolutions, but since there's no way to pause its waterwarp effect, there's no way to make an animated screenshot comparison like the above.


The properly-scaled submerged screen warping algorithm from the Makaqu engine was posted in this topic 3 years and a half ago.

For comparison purposes, the original WinQuake algorithm, with all its inconsistencies, can be found here.

And the FTEQW source code can be found in its official website.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
Dev blog / Twitter / YouTube
User avatar
Posts: 908
Joined: Fri Jul 04, 2008 3:02 am

Re: Standard Waterwarp Consistency Test

Postby Baker » Fri Dec 09, 2016 7:17 am

I've always noticed the WARP_WIDTH and WARP_HEIGHT defines aren't particularly consistent nor friendly to larger resolutions.

Interesting analysis. :cool:
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Posts: 3639
Joined: Tue Mar 14, 2006 5:15 am

Re: Standard Waterwarp Consistency Test

Postby Maraakate » Sat Dec 31, 2016 6:15 pm

Somewhat related, the particle sizes at least in SW are pretty inconsistent as well so I implemented this hacky solution and user configurable CVARS: ... 0a9354256a

There's probably a formula that I could come up with, but I admittedly hacked it up very quickly to suit my needs.
Posts: 5
Joined: Sun May 31, 2015 9:37 am

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest