Thursday, June 24, 2010
A Practical (But Simple) Model for Daylight
Sunday, June 20, 2010
Saturday, June 19, 2010
More water improvements
Friday, June 18, 2010
Multi-textured Terrain
Water Fog
I've added a new feature to my terrain shader that accounts for depth when rendering portions of the terrain that are underwater. Because the water "plane" has a constant alpha value, the deepest part of a body of water is just as visible as the ground that's only covered by a few inches of water. In reality, bodies of water such as lakes and oceans have dirt and other particles that obscure light from reaching the bottom.
My approach to this problem is basically just per-vertex fog. Instead of interpolating colors based on distance from the camera, the shader uses the 'y' coordinate of the vertex in world space, and calculates its distance below the surface. This simple effect definitely gives the water a more realistic sense of depth.
Sunday, June 13, 2010
- Waves, reflections, and specular highlights for water effect.
- Multi-textured terrain to add regions of sand/rock/etc.
- True-to-life sky dome gradient colors
Wednesday, May 12, 2010
New Graphics Engine
The GUI is coming along nicely, but I'm taking a break and moving back into some graphics stuff. It will be easier to test additions to the GUI later on when I have more uses for it.
Lately, I've been working on a new graphics engine. The central idea of the new engine is that everything is customizable and modular. It manages all of the resources, buffers, shaders, etc. Various entities in the game that need to be rendered check in with the graphics engine upon initialization and give it the details on how/when they need to be rendered.
So far I've got the terrain loading from a height map, per-vertex fog, and a fairly convincing skydome. The sky colors are actually sampled from a 2D texture. The sampled U value is proportional to the angle from the horizon (phi), and the V value is determined by the time of day. This 2D texture is calculated using the Preetham paper, A Practical Analytic Model for Daylight. Each column of pixels in the texture is a gradient of colors at a particular time of day. Tasks that remain for the skydome include clouds, stars, sun/moon sprites, and lens flare.
Friday, May 7, 2010
New GUI
I've been spending the past few weeks working on a custom GUI in DirectX. I modeled the GUI after MFC, making heavy use of inheritance. Gotta love c++. I went with this approach because it gives me (and potentially other developers) the freedom to derive modified versions of existing controls, along with creating new ones down the road.
The first week was pretty much spent getting the basic framework put together and getting a basic window drawn to the screen. Then I moved on to adding buttons, checkbox, edit box, and slider controls. The text box is capable of being assigned a value, but I haven't gotten around to allowing the user to enter values into it.
The next big tasks are to complete the edit box control and move on to list boxes.
Wednesday, March 17, 2010
Mini-projects
While I'm learning the new API, I've decided to take a break from working on the Earth project and do a series of small projects instead. I realized that most of the programming projects I've built were complex games and simulations that never got done. I usually spend lots of time working on specific aspects of the game, and before I know it the project is a year or two old and there is very functionality to show for it. It is probably a better idea to come up with a relatively simple idea and get all of the key features up and running. Then the extra effort can go into refining the details/mechanics.
One such project I've been contemplating is a "business" simulator. It would be a game where you own a business and try to earn money. The graphics would be very minimal and the focus would be on programming a solid and realistic simulation. Once the game is functional, the graphical representation could be improved (make it 3D, show people doing stuff, etc). I think the basic program could be done in a weekend.
Sunday, February 21, 2010
New Map Generator
I've spent the past few days working on a procedural map generator. Previously, my Earth3 game had randomly generated terrains using some fluid dynamics formulae. The result was a wavy map that somewhat resembled rolling hills. As you can see in the screenshot, the terrain is random, but lacks variety.
The new terrain generator uses coherent noise, which generates much more interesting and realistic terrains. The program starts by generating a Perlin noise map to determine the shape and elevation of land masses. Regions of the map where the elevation is above a certain threshold are designated as mountain ranges. These regions of the height map are blended with a Voronoi noise map in order to gove them a "ridged" look. You can see where the terrain transitions from Perlin to Voronoi, because the mointain ranges are the only regions that have that ridged pattern.
One very useful aspect of coherent noise is that the input parameters allow the user to control the look and feel of the map. For example, increasing the frequency of the Perlin noise causes the map to have several small continents instead of a couple of big ones. Other aspects that can be controled are the smoothness/roughness of the shore lines, and quantity of mountains.
Here's a screenshot of the above map, rendered in Earth3. The map clearly has more personality than the old map. The terrain has distinct geological formations ocurring in different areas, as you would expect to see in nature. The next big feature that this map needs is multi-texturing based on elevation and slope.