Wednesday 15 April 2009

Tris versus Textures

A long time ago, in a galaxy far, far away, someone made a post on the forums or in a blog which gave the memory useage for various texture sizes. I noted that useage did not double with size, but was on a much more aggressive scale. Thus 1024x gave a lot more of a kicking to Vram than two 512x.

So, town2 version (counts on fingers) er ... 4? is done. It's a mesh model, with all of the buildings enterable. No facades this time. The 2 storey facade textures (1024x) have been ditched in favour of standard 512x brickwork textures (which the facades were previously based on and had been used around the map for low walls). All doors and windows are now modeled, and are proper openings. All buildings are now fully enterable and made up of multiple rooms. Each building has at least one staircase, large buildings have two. Access to and from upstairs is granted. Access through all buildings now exists.


Prefab houses

There are currently 6 building types being used as prefabs, with a couple of custom ones (eg: church and chapel - church is still a facade, the only one left). All have at least one front and back external door, a minumum of 8 windows and 7 rooms. All have at least one staircase.

There are 50 buildings in the village. That's 641 windows, 180 external doors, 578 rooms, with 81 staircases, all linked, all useable, all explorable. I didn't count how many internal doors there were, but obviously they are what seperate the rooms so work it out (it might even be the same number as the rooms).

Needless to say this has affected the tris slightly. Tris now stands at around 48k up from 15k. And it's also affected performance - for the better.


From all closed facades to 1399-ish openings for view and movement.

Previously, with most of my Vcard (256mb 7900GS) settings on "performance" with x2 AA and Anisotropic OFF and display on x768, I was recording 165fps with the polysouped, facade mesh.

Dispensing of the services of the 1024x facade textures, and increasing the polysouped mesh by over 500%, I get the following results.

New Vcard settings are "quality" including x2 anistropic and AA. At x768 it gives a whopping 196fps, and at x1050 it gives an equally impressive 127fps.

I did have a few issues with exporting the model. I had to split the model into 6 seperate meshes, as together they exceeded the max vertices count. But as seperate meshes within the same model they exported fine.


There's lots more opportunites to worry about being ambushed. 1399 of them.

So, point proven on Vram and texture size against tris count. This was conducted on TGEA1.7.1, 1.8.1 would probably gain more of a performance boost (maybe 10%). How this will work with new tech remains to be seen, but I'd be quietly hopeful that all will be well.

In the meantime I have a Campaign for Real Ale Festival to go to, the last refuge of Saint George Flag waving, folk singing, Morris Dancing, sandal wearing, unkempt beardies who have a deep understanding of the different forms of droppings excreted by the monstrous badger of doom.

BADGER_OF_DOOM is also the current codename for my project.

God save England, 'arry and Saint George!

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.