Saturday 28 August 2010

Blender-PureLight-Jefferson Starship-ShapeEditor-Prefabs-LOD

Yep, I think that sums up this posting quite accurately ... and if it doesn't, well hell, I ran out of space in the title anyhow.

Blender ... scourge of Damocles, liberator of ... er ... I don't know ... stuff ...
Also Jefferson Starship.

As free goes, Blender's awesome, but rather lacking of a working DAE importer (no, I haven't tried 2.5 yet). But it's free - so workarounds should be expected. It's not like you've forked out a shovel full of cash for PS and then have to patch the PNG exporter, can't say freebie Gimp ever suffered from not being able to export a standard format ...

I'd been thinking of ways to (re)build a town (again ... and again - BSP lol!) since making various test versions, and had come up the idea of using a few stock buldings, repeated through-out the landscape. Basically a detached house, a semi-detached (dual building), a cottage, a large manor house, a church and chapel, a multipurpose large public building with changeable props, and a couple of other things.

And whilst knocking up a detached house in Blender (with 140 collision meshes) I cam across a formula. Exterior Mesh - heavily LODed, Interior Mesh - (just the rooms no details) lods out completely at distance and the exterior takes over, and Props - furniture, stairs and details which lod out once the player is a bit outside. Props is the biggy 5500tris of beds, wardrobes, sofas, toilets, stairs, window ledges - uses 3 textures. Interior is a simple 700 tris, but uses 6/7 textures, and the Exterior has a fair few textures, but quickly LODs down to a simplified single texture (by amalgamating all the materials into a single low-res texture) and Interior also does this, so all good for performance there.

Of course there's one problem ... and that's that the unlit interior looks kinda flat, and in Lowest Lighting is just bloody awful.

PureLight Huzzar. So I decided to tonemap the Interior and Props meshes, giving a little depth and interest to the ambient. Nothing fancy, just a light ambient through the windows, something that doesn't look too out of place if you have in-game sunlight coming in as well.

Also Jefferson Starship.

Now in Max or something, you'd reimport your tonemapped meshes and stitch the whole thing into a file ... but Blender ain't gonna do that, so I cranked out the Shape Editor for a test run. I found that it was easy enough to add a new mesh LOD to my Interior (2 meshes remember, same tris but one has only 1 material) and then a dummy LOD of a single triangle to force the mesh to LODout completely. I soon found that sharing a dummy LOD object with another mesh causes issues so each new LOD/Dummy requires it's own individual dummy LOD object (might've helped if I'd renamed them but nah ...).

Anyhow the upshot was :
Exterior - fully Loded, no tonemaps
Interior - Loded with ShapeEditor, tonemaps
Props - single Lod, Lodsout fast, tonemaps

Also placed correctly, the only thing remaining is to zip them up into a prefab, and drop them into a level as I please. RESULT!

And then I found that somethings can affect lightmapping. SubSurface scattering seems to help lightmaps fight off the power of the ambient and preserve their vibrance.



And as you can see from the above pic, various settings alter the way ambient and tonemaps interact ... and boy, does BasicLighting look nice now! Not that I'm ever going to be using it personally ... but someone ... somewhere will.

Also Jefferson Starship.

Did I mention Jefferson Starship? (caution:Flash)Clovis Music Festival. Tip the parking attendants, if they speak with a funny accent that includes words like "ee bye gum" they might be my folks - don't ask my dad to explain cricket ... Last year featured my mum holding back a horde of hysterical middle aged women as they tried to rush the stage and tear the clothes of a teenage Richie Vallens impersonator ... the lucky young bastard!

Of course some of us poor buggers aren't retired so it'll be business as usual on the one man -who's not entirely sure what he's doing- game development.

Talking of which, I had a quick test of close range combat against a melee based foe.



Which was geniunely quite panicky - so I was pretty chuffed with myself.

Now ... do I really need to make roads with sidewalks/pavements as models ... if I don't have curbs then I could just use decal roads ... but curbs do give a rather urban feel ...

... decisions, decisions the pressures of command ...

Sunday 8 August 2010

Mortality test - We Are Not Immortal ... allegedly ...

Death comes to us all ... admittedly that's not been proven IRL yet ... but chances are it's a safe bet. In games, you tend to have the option to respawn ... not sure about IRL ...

Apparently ... you who are reading this ... may actually be mortal ...

I know, it's obviously incredibly unfair - why are you and me getting singled out like this? The world might actually continue without us ... clearly a grevious bias against us personally ... well, me anyway ... I mean ... what if there isn't a respawn option? And even if there is ... you're gonna lose all of your loot! And restart at level one! You might as well just rage-quit the concept of reincarnation all together, settle for a cloud and learn to play a harp ...


But enough about IRL, in gaming you respawn ... or at the very least restart the game, it doesn't just delete from your hard-drive when you avatar bites the dust and then refuse to redownload another copy. If it did, people would be at your door with pitchforks ...

But rather than just "pop back" into the game, I decided to make a little death sequence everytime the player buys the farm ... and keep it short, because the player might get to see it quite a bit if they're having a bad day at the keyboard ...

Initially this worked ... okayish ... not used to messing around with camera functions or the sort, and then in the new build it broke. But rather than my usual tactic of try every combination of events and scripts which I could possibly think of - then trawl the forums for info that usual relates to redundant engine versions, I just looked up the new docs and found all the camera functions and then linked my system to corpse mode. And it was better than before. Yes those folks at GG, TP, or WTF it's called now, have finally got out a full engine API and script reference. Docs for teh win! as our cousins across the pond tend to shout ... a lot ...



And what's more restful than a chapel of rest? As long as it's only a few seconds, or else it'll get annoying.

Once again, Huzzar for PureLight. Just 2 tonemaps and 3 meshes. Outside of the chapel is a straight unlightmapped mesh, with the interior and interior props, collected together as a Prefab (first prefab I've used, and boy do these thigns look useful!). And it's a fully enterable building too, so I can use it in-game as a prop as well.

Originally I'd used a realistic lighting technique for the tonemaps ... but thought it looked a bit dull, so I arty'd the whole thing up with shadow blockers and multiple spotlight through each window, casting varying degrees of light intensity around the interior.


Admittedly this screenie is a bit dark on the ambient ...


So here's another ...

Window on the left took me over nine thousand hours in MS Paint ... and the one on the right took my about 9 seconds after I remembered how to draw ... out of practise ...

Repawn/quit dialogue is still just a stock GUI, so I'll need to replace that with something completely custom, but all in all, I thought it was quite a nice touch.