Hi all,
In my landscape-based game, I have an island on a square heightmap mesh, surrounded by an infinite plane of water. My problem is how to render this "infinite" plane so that it blends seamlessly with the edge of the heightmap, more specifically, how to fog it correctly.
Here's an image of the problem:
Edge of the heightmap on the right, "infinite plane" on the LEFT. I'm sure the diffuse colours match, as if you tilt the camera to look straight down, they look pretty much the same.
Here's an edit showing what it should look likeThings I Have Tried:
1) Massive stationary polygons around the "real" heightmap
2) One big quad oriented in front of the camera, with the far edge at the far clip plane and the near edge under the camera
3) As (2) above but split into "stripes" running across the view direction (have tried this artificially narrow in order to check that the problem isn't due to the ends of the stripes being far off the side of the screen)
So... is there something I don't understand about OGL's fogging maths?
For uber-diagnostical completeness, here's the fog setup from the start of the main render function: (C#, Tao framework binding for GL)
Gl.glFogi(Gl.GL_FOG_MODE, Gl.GL_EXP2); // Fog Mode: GL_EXP, GL_EXP2, GL_LINEAR
Gl.glFogfv(Gl.GL_FOG_COLOR, fogColor); // Set Fog Color
Gl.glFogf(Gl.GL_FOG_DENSITY, 0.0750f); // How Dense Will The Fog Be
Gl.glHint(Gl.GL_FOG_HINT, Gl.GL_NICEST); // Fog Hint Value
Gl.glFogf(Gl.GL_FOG_START, 5.0f); // Fog Start Depth
Gl.glFogf(Gl.GL_FOG_END, Tianxia.Drawing.Camera.FarDist); // Fog End Depth
Gl.glEnable(Gl.GL_FOG); // Enables GL_FOG
(fog colour is the same as the clear colour at the moment, that you can see in the "sky" in the pic above)
Most helpful reply wins a beer, if you're at GDC. If you aren't at GDC, you'll just have to make do with a
:beer
: