Bump mapped water

Started by
31 comments, last by kill 21 years, 9 months ago
Here''s a shot of my water


There is an obvious perspective problem with this shot. The water plane looks "short". The reason why I can''t fix that is that I use a cubemap which obviously has limited resolution. When I increase the size of the water plane, it starts looking um... well... bad

If anyone knows how to fix this problem, I''d like to hear a solution. I can''t really use projective textures because I can''t spare rendering my geometry again.
Advertisement
Looks very nice, actually.

quote:
When I increase the size of the water plane, it starts looking um... well... bad

hmm, why would the cubemap be the problem ? Normally cubemaps are totally scale independent, since they operate on direction vectors. Or do you mean aliasing artifacts ? Did you mipmap your cubemap ?

I think you could almost eliminate that ''short plane'' effect, if you added fog to the water. It will give a strong scale hint, and might fool the brain into thinking the plane is much larger than it actually is.

/ Yann
Approximating the ocean as a planar surface works poorly when the sun is low in the sky, because then sunlight can enter the water on one side of a wave and leave it on the other. In this case the integrals can be analytically computed. However, the effect can probably be realistically approximated by considering the wave height map (\emph{i.e.}, perhaps points above a height threshold are given a textured orange tinge?).

Anyway, here's what I mean about using a "planar" ocean for determining water color:

The color of the water is determined by equation (3) of [NN],
I_v(\lambda) = I_q(\lambda) e^{-c(\lambda) L} + \int_{0}^{L}{I_p(\lambda) e^{-c(\lambda) l} dl},   

where $I_p(\lambda)$ is defined by equation (1),
I_p(\lambda) = \left( I_a(\lambda) + I_i(\lambda) T(\theta_i, \theta_t) \beta(\phi, \lambda) F_p e^{-c(\lambda) l_s} \right) \rho.   

For an infinitely deep ocean $L = \infty$, so the first equation reduces to
I_v(\lambda) = \int_{0}^{\infty}{I_p(\lambda) e^{-c(\lambda) l} dl}.   

When the sun is directly overhead, $\theta_i = \theta_t = 0$ and $\phi = \pi - \theta$. The transmission term is $T(0, 0) = 1 - R(0, 0) = 1$ ($R(\theta_i, \theta_t)$ is the Fresnel reflection term). $F_p = 1$ also. Finally, the distance from where the sun beam enters the water and where it scatters onto the viewing ray is $l_s = l \cos{\theta}$. Hence the second equation reduces to
I_p = \rho \left( I_a + I_i \beta(\pi - \theta, \lambda) e^{-c(\lambda) l \cos{\theta}} \right).   

Here, $\beta(\pi - \theta, \lambda)$ is the scattering function, dependent on the scattering angle and the wavelength. In fact, scattering is nearly isotropic -- there is little angle dependence, so $\beta(\pi - \theta, \lambda) \approx \beta(\lambda)$.

We now substitute $I_p$ into the equation for $I_v$ and evaluate the integral. We obtain
I_v = \frac{\rho}{c(\lambda)}\left( I_a + I_i \beta(\lambda) \frac{1}{1 + \cos\theta} \right).   

(Note that $\theta$ is the angle of the \emph{refracted} line of sight leaving the planar surface of the ocean! Furthermore, $I_v$ is the light intensity as it arrives below the ocean surface; the light immediately above the surface is $T I_v + R I_r$, where $I_r$ is the reflected light and $T$, $R$ are the Fresnel terms $T \approx 1 - R$.) This completes the derivation for the case of when the sun is directly overhead. The equation for $I_v$ will have the same form in general, but with dependence on $F_p$ and $l_s / l$. For isotropic scattering the angle $\phi$ is not important. However, of course the exact $\beta(\phi, \lambda)$ \emph{can} be used if so desired (for example, if the ocean-color map is being precomputed).
I_v = \frac{\rho}{c(\lambda)}\left( I_a + I_i (1 - R(\theta_i, \theta_t)) \beta(\lambda) F_p \frac{1}{1 + l_s / l} \right).   

Recall $\theta_t$ is given by $\sin{\theta_t} = 1.34 \sin{\theta_i}$, and
R(\theta_i, \theta_t) = \frac{1}{2}\frac{\sin^2(\theta_t - \theta_i)}{\sin^2(\theta_t + \theta_i)} \left( 1 + \frac{\cos^2(\theta_t + \theta_i)}{\cos^2(\theta_t - \theta_i)} \right),   

and can also be well approximated
R(\theta_i) \approx \frac{1}{(1 + \cos\theta_i)^8}.   


[edited by - greeneggs on July 18, 2002 2:36:06 PM]

This topic is closed to new replies.

Advertisement