The Rerendererererering

I’m very happy with a lot of the changes in Alpha 44; a bunch of the seemingly less-consequential AI improvements, such as the stockpile rewrite, seem to have been very well received. I therefore decided to do something fun last week on Thursday and Friday, and start rebuilding the rendering pipeline to support interior and dynamic lighting. On our old development report this was actually the last rendering ticket.

David Baumgart, "painter of light".

What a nice house. I bet it’s not totally full of cultists or something.

The thing that made me grumpy about the interior rendering is that we don’t want exterior dynamic lights to leak into the interior – if you put an outside light on a building, you don’t want it shining in the interior. Similarly, you don’t want to have a light inside a building reflecting the outside of the building. Finally, it would be nice if we could set the interior and exterior lighting of the world differently.

The solution I’ve arrived at is to upload an “interior map” to the renderer, which classifies each volume of space (thankfully, we live in a flat world!) as “exterior” or “interior”. We can then use different lighting values for each, and dynamic lights marked as being “outside” can then only light exterior squares (and vice versa.) In practice, you get things like this:

shot041We might have a per-building color table, or some way of making buildings run by maddened overseers… ah, “more ominous” (so, probably purple.)

In order to apply dynamic light sources from things like glowing lamps and particle effects, it is necessary to set the renderer up to be a proper deferred renderer again. Right now, it’s not – we actually do all our lighting in a forward pass as of Alpha 44, which is fine when you only have one light. We don’t want to do what is called “light prepass rendering” because I’m really not keen on putting 40 characters through a complex vertex shader twice if I can help it, and we can have a lot of objects and batches on screen (something I am still trying to reduce.) So unlike, say, a first person shooter, classical deferred rendering is still a good choice for us.

Because we have unique needs, we have shoved all kinds of nonsense into our multiple render target G-buffers. We now have:

BUFFER 0: (Normals X, Y, Z; Global Directional Light PCF Shadow Map)
BUFFER 1: (Albedo X, Y, Z; Outline for Sobel Filter)
BUFFER 2: (Glow Buffer X, Y, Z; a blank space, which gets filled by the AO shader so we can downsample our AO and our glow in the same pass)
BUFFER 3: (Specular Power; Specular Intensity; Interior/Exterior; ???)

This gives me one last thing to play with in case of emergencies. I don’t know what will go in that last float, I’ll think of something. As a consequence of all of this, I was also able to delete and clean up a lot of shaders last week, and put the glow back in! I’m not happy with how the glow is currently blurring, but I suppose I will fix that when I get there. Putting the light in the PCF shadow map gives me a little more control over biasing things, so I can(for instance) use a different bias for the terrain versus a character. There are still some scuzzy artifacts on the shadow maps for characters sometimes, especially some of the dress models, but I can clean those up whenever I have some time for cursing and swearing at a thing.

Otherwise, I’m cleaning up memory leaks and a few other pieces of fun this week, then desperately trying to finish the AI editor so I can start on the military AI; it has been decided that, since I am making a new AI tool for decision trees, I get to eat my own dog food for the rest of the month and we’ll see how it goes!

Posted in Clockwork Empires | Tagged , , , , , ,
7 Comments

7 Responses to “The Rerendererererering”

  1. Stuthulhu says:

    Let us not forget the enjoyable ominisity of secret-of-the-ooze level virulent green.

    { reply }
    • Stefan Bauer says:

      Hmm. Different ‘Maddened’ colours for different cults would be good. Threatening Violet. Sizzling Green. Somewhat Fabulous Pink. That sort of thing.

      { reply }
    • Poklamez says:

      Neither do we want to forget about the Someone-Probably-Just-Died-Here-Or-At-Least-Tried-Really-Hard-To-Do-So Crimson.

      { reply }
  2. Bropocalypse says:

    Here’s hoping this means that windows will not one day be only the province of mad update header artists!

    { reply }
  3. Please please please say that there can be Deep Dark Horrible Secret Influences that cause random mutations in overseers’ decision trees. “The fishpeople are weak! ALL fishpeople are weak! ATTAAAAACK!!!!!”

    { reply }
    • Tikigod says:

      The Concerned Citizens Against Plotting Auroch.

      * All Auroch are enemy spies.

      * They’re collecting data.

      * Discovering our weaknesses.

      * Relaying their findings back to the Oxenworld.

      * Reading our mail.

      * No! Worse in fact! Reading our very thoughts!

      * Only a few of the most trusted colonists know the truth, and it’s our sole responsibility to defend all that is cog-like from this noisome presence that lingers in the shadows.

      * Simply killing the Auroch will not purge the taint from them, their remains still linger to observer and report.

      * The only solution is fire.

      * Lots and lots of fire.

      { reply }
  4. Randolf Karter says:

    Don’t forget theses tags, “The Shadow Filter over Innsmouth’, ‘Pickman’s Lighting Model’, & ‘The Thing on the Exterior Lit Doorstep’. Classics.

    { reply }

Leave a Reply to Stuthulhu { cancel }

Your email address will not be published. Required fields are marked *