Monday 6 April 2009

It's The Economy Stoopid

Actually, it's the lightmaps. Map crashes on export? Bets are it's the lightmaps. Funny dark cuts along the edges of the brushes visible from certain angles and certain distances? Not brush borders, but lightmap borders.

Why does this all happen? Because geometry scale is 32, small scale lightmaps (like 8) cause trauma on larger brushes when calculating the lightmap. Keep brushes smaller for less lightmap calculation map crash trauma. Compressed edges of lightmaps visible? Make lightmap scale the same as geometry to dispell (though to be honest you'll probably still see a few of the little critters lurking out in the far distance if you have a long, long surface like a road). There's also an occaisonal light bleed in some interiors with this.


What the world looks like immediately after it spawns from my id

So, with that finally realised, we set out to design Map2. Map1 (aka High Wold, the pics of an urban environment in my previous blogs) was created as a large test BSP using large facade blocks as the buildings. Rather urbanized, terrace streets. Map2 was designed for more individual buildings, detached, semi-detached housing. The idea being to create a series of prefabs which I can then drop into editor/modeling program, arrange and then export en mass as a single object (BSP or mesh model).

And it all seemed to go okay like that. I did attempt a new method of creating a mesh model in Blender and then exporting it as a mapfile, but Blender's map exporter isn't up to anything particularly complicated, and the end result looked like a mangled, disjointed mess on close inspection. Blender can export mapfiles fine - if you stick to the basic rules of being BSP friendly (build it using individual blocks - think lego).


Church tower is 400m away, just out of rifle range but not sniper or lmg

So, establishing that prefabbing really is the way to go, and with a BSP version knocked up, I recreated the whole thing as a mesh model. Whilst polysoup collision (what you see is what you bang into) has been available for a while, the lack of lightmaps has meant that it just didn't cast realistic shadows onto itself or other meshes. This can look a bit odd to say the least. However, there is new tech on the horizon which may well sort this problem out, and which includes scandulous mention (it's not really scandulous, I'm just using a random adjective for teh interwebz draaama) that BSP will be more performance friendly. With Map2 copied into both BSP and Polysouped Mesh versions, it'll be interesting to what the difference is in-game using said new tech.


BSP version, roofs are NULLed

To be honest I was having so much fun building the mesh version that I imbellished it quite a bit, so it's got 7k faces instead of 5k as the BSP version. Performance-wise in current tech (TGEA1.7.1 'cos I haven't transfered all of my custom scripts over to 1.8.1 yet) the meshed polysoup wins out with an FPS of 30% higher than BSP (based on 5 locations and views at 1280x768 resolution with 1700m visibility). That's an max-average fps of BSP 125 and Polysoup 165.


Polysouped Mesh version - Spot the Difference!

Apart from the mesh lighting issue there are also a couple of other problems, such as the model vanishing when the fog/maxvis hits the centre of the bounding box (problematic with large meshes in low visibility environments - but fine with a long maxvis like I'm currently using). I'm a great believer that in making large environments as a single object is better for performance than making hundreds of individual objects and then sticking them in-world together. No matter how many surfaces it has, it is still just one object for the processor to initialize and then worry about, instead of 50. Another issue I've noticed with current tech's polysoup is that the colour/tone/intensity of the textures aren't as vibrant as they are when applied to BSP, probably because of the lack of lightmaps.

Anyhow, it'll be interesting to see what the new tech brings. Roll on Beta.

No comments: