There are tons of great looking games out there and things like Farcry 3 really push the envelope when it comes to lush and "realistic" landscapes. Of course, I am not aiming as high. But I still need to make the world more dense, so I'm thinking more grass and a few clutter objects could greatly improve the look of the land.
So today I am trying something new, an almost life journal of my first attempt to add a generic clutter system, that for its first iteration will support only one boulder type. This will be less edited than usual and ultimately tell the story of a first failure in chronological order of the events.
So first step is to find a free boulder model on the net, import it into Blender, export it into a XNA format, add a hardcoded line to the game's code informing it about the new model, add the exported file to the import project in Visual Studio, uncomment a line that enables model reprocessing thus making the game load all meshes in the slow loading XNA format and resave them in my own custom very fast format, then run the game only to have it crash because of a failsafe assert I added. The new model has no tangent information, so I need to close Visual Studio, edit the project file in Notepad and rerun the game, to get this result:
I know, I have pipeline issues! The next step is to adjust the size of the boulder, making it fit better with the landscape style:
But why is it black? I have this problem every time I add a new mesh and it eventually goes away on its own and it goes away if I edit the new meshes material related properties. I am getting tired of this, so I start debugging and actually find a bug in my material assignment code. With this issues fixed, all new meshes should look like this:
I worked hard on getting good ambient lighting into the engine, and the effect is clearly seen on untextured objects. Here is the object from behind and the lack of a normal texture is clearly visible:
So I reuse an existing material and get this result:
The stone is very poorly UV mapped and the scale is also wrong. I do not fix the UV mapping, but I do try and fix the scale:
After some further tweaking:
So now that the material is all set up, here is again the lighting with normal maps for the backside of the boulder:
One boulder won't do me any good, I need a lot of randomly placed boulders. Dropping 400 boulders from a very low height makes them land in a very orderly manner creating a very artificial look. Dropping them from a greater distance improves a little the orderly look, but some boulders are rolling around a lot after creation:
Now let's try to add 6400 boulders. This kind of breaks physics, with thousands of boulders trying to settle while the game map is still loading up. Loading and settling now takes minutes and makes the game unusable during that period:
So life boulders are out for now. I have multiple types of physics objects and I try a less CPU intensive and static kind of object, that once placed can't be moved by normal physics interactions and this loads up nice and fast:
But why is it untextured? Because I am running out of RAM. My static object implementation eats up tons of RAM. For now I'll disable grass, another huge RAM hog:
This does not help a lot, because I can't go up well over 1600 stones RAM wise. This has nothing to do with rendering. Even if I cull most of these stones, the RAM use is still there. Here is a shot with 1600 regularly placed stones without grass:
This concludes part one, because I need to find a solution that drastically reduces memory consumption. I'll be going over the entire code base and in part two we'll see if I managed to improve the situation and thoughts on possible solutions.
I'm finishing my landscape, even if I have to use the CryEngine for it!