Thursday, January 24, 2013

Morgan - Faster Slower Water


My 1.5 hours for yesterday was really one frustrating hour last night and 10 satisfying minutes today.  Accomplished:

- Slowed down water simulation 6x
  Creates narrower wake, slower wave propagation without increasing simulation resolution
  Also reduces computation time, i.e., the simulation is faster with slower water
  Required some care because the simulation region moves over time and seven different buffers have to be synchronized precisely
  Resolution is about 1 grid point per 2x2 pixel grid.
- Visual luffing and trim indicator
- Fixed gaps in traced reflections
- Tuned ships to run at 2x physically indicated displacement hull speed
  (e.g., the 1 m-long post ship has a max speed of 0.41 m/s)
  Provides enough speed to create tension, but takes away some of the twitchy aspects

The frustration arose from the fact that I implemented all of the above quickly and then spent most of the hour debugging the water simulation, which was plagued by errors in the offsets between all of the buffers in the simulation: normals at three different times, positions at three different times, and the heightfield.  Today Mike suggested that I step back and think about it more and then do a clean implementation.  Thinking helped a lot and I was able to fix what was there very quickly.

One careful diagram is worth an hour of debugging.

Water rendering after 6x time reduction (i.e., 1/6 of the water is simulated each frame instead of all of it)

Water simulation grid as a checkerboard. You're seeing mostly Moire patterns--the checkers are between 1 and 2x2 pixels in this image at full resolution.

No comments:

Post a Comment