The river water represented something of a technical
challenge. I wanted realistic water which appeared to be flowing in the
direction of the river. I did some research on flow maps, but due to time and
software constraints, I would not be able to implement flow maps as described here. Instead I opted to rely on clever unwrapping, and some vertex painting to
indicate flow direction for the river edges.
I decided to break the river into several sections using
rapids. Not only would the rapids look nice, but this would allow me to avoid
one large piece of geometry (which is generally advisable to avoid for various
technical reasons). This would also help if I needed to use several reflection
maps.
The normal map was made by height-painting over a photograph
of rippled, flowing water. This was then taken into max and baked down, and the
normal map was further tweaked in photoshop to ensure the ripples were
shallower on the trailing edge.
Utilising the flow-directed unwrap with the panning normal
maps and a scene-captured cube map gave a really pleasing result, which was a
great starting point. I added depth and Fresnel-based transparency (ensuring
the player could look down into the water). I’m still trying to figure out why
the distortion isn’t working, but I have faith I can get that done eventually.
With just a reflection map and a bit of colour balance, I had a pretty good result:
The water looked a bit too pristine, so I decided to make it
darker and browner when looking down into the water, and I decided to add some
foam into the water. Although foam does split apart and can change in size, its
overall shape stays the same as it travels down water, so I added it simply
panning. It looked repetitive and static, so I overlaid it on top of itself to
break the repetition, and used a blurry
noise map to offset its UVs as it moved down the river. This meant that the
foam seems to move about and “wibble”, and looked pretty good in conjunction
with the ripples. Obviously the foam is not as reflective as the water, so I
changed that, but I was not able to get a nice diffuse effect on the ripples
since the water is a translucent shader and therefore does not receive shadows.
I started by using a realtime cube map capture (every 2
seconds) for the reflections, which had the benefit of automatically adjusting
to night lighting as the scene itself darkened. However, using just one
statically-positioned capture actor meant that only a small portion of the
river had accurate reflections. Placing several would be too costly, since they
would all need to be capturing at all times, so I tried attaching the actor to
the player, but found that to be too detrimental to the frame rate as well.
In consideration of the fact that my texture usage was still
very low, I chose to use multiple static cube map renders, captured “offline”. This
meant that although the reflections were actually showing summer daytime at all
times, I hoped that nobody would really notice so long as they were
tone-corrected for night. Because the river has been broken into five sections
by rocky rapids, I could use a different cube map for each section.
Finally, I added some "white turbulence" to help the water edges and rocky parts feel like the water was flowing at a higher pressure, and against the surrounding rocks. I have yet to do freezing water, water at low flow, or water levels rising and lowering, but I doubt I'll have time for any of that any longer.
No comments:
Post a Comment