Author Topic: AI War 2 gains IBL (Image Based Lighting)  (Read 2849 times)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
AI War 2 gains IBL (Image Based Lighting)
« on: November 03, 2017, 10:14:17 am »
Recently I showed how the graphics have evolved in the game via switching the materials to be more PBR-based (overpainting our cel-shaded visuals to augment them via Substance Painter).

At any rate, one of the things that was bothering me was the drop in quality between Substance Painter's view of things and the view of things in Unity.  It still looked great in Unity, but was a notable step down.

So, I thought about that a bit, and made some changes to the lighting in Unity.  More on that in a bit -- but first I should note that this isn't something that is costing any extra performance hit on your GPU.  Yeah, you heard me -- these sort of visual improvements can be "free" in terms of performance cost.  It's all in the techniques, and I've been learning a lot on that front as I've been working on my "secret side project."

Anyhow, that's been paying big dividends for AI War 2 that I wouldn't have anticipated.

Where We Started



That's purely a cel-shaded approach modeled in Maya by Blue, and painted in Photoshop.  There's a lot to love there, particularly in most of the ships in the game, but this was probably the number one ship that bothered me because the asteroid doesn't look at all like rock.  (Then again -- do rocks in any cel-shaded game look like rocks??)

At any rate, her painting and models were being fed into some custom shaders I created, and then tuned to have custom reflection maps and specularity and rim lighting, etc.

One of the big things that I struggled with with my shader was making the ships look really dramatic -- but also visible -- on their dark sides versus their light sides.

Often this really caused issues with the normal maps (those images that make things look more bumpy than the actual underlying geometry is) either being too harsh or too subtle depending on how close you were to the ship or which side of it you were on.

Next Up: Substance Painter

In a video you can see me painting that mesh using Blue's cel-shading as a base.  The end result -- in Substance Painter -- is this:



Now, there are a few things to bear in mind.

First of all, this is using different shaders than Unity has.  Ones that don't have to render in realtime, and certainly not thousands of objects in realtime -- Substance Painter would choke and die on that.  But that tool is equally useful for offline cinematics or feature films as it is for realtime game usage.

That said, it should translate pretty well -- shockingly well, to be honest -- to Unity.  When you're using full lightmapping and calculated ambient occlusion and so on, the visuals get very very close between the platforms.

Problem, though: you're not able to bake lightmapping in unity for dynamic scenes.  At least... mostly not.  There are a variety of complicated techniques, and even some simple ones.  But let's just say for our purposes here that isn't feasible in this particular case. ;)

At any rate, the second issue is that this is using IBL, or Image Based Lighting.  And in Unity I was not.

What Is IBL?

Basically that means a 360-degree image cubemap is "shining" on the model from all around it.  Imagine having a painted translucent box and putting the model in it, then shining light evenly through every side of the box at once.  The result is an IBL look.

Actually, you know what?  Just check out this video with someone showing off what Unity can do.  Video is worth a thousand words... squared?

Okay, So What This Looked Like Coming Into Unity



This is a huge improvement over what was in Unity previously, but it's still... not my favorite.  The lighting is very stark and harsh, and the specular reflections feel wrong, making me have to tone down the smoothness of the metallic shaders.  All that combines with the flatness of the lighting in general to make it feel... like a blander version of what I had before.

Well, heck -- I've worked with IBL plenty of times before.  Let's see what I can do.

Upgrade One

Starting with this:



We then move to this:



In order to get that second look, I turned off the main directional light in the scene, and am using just a single IBL light source.  I have to "bake" that in a really broad sense for Realtime GI to work in unity, but my understanding is that it isn't really using anything other than the original cubemap since there's no true baked data (no lighting probes, etc) in the scene.

At any rate, this is with the ambient light coming from the (invisible) skybox, which is an HDRI cubemap.  And then no other light sources other than the emissive materials on actual ships.  Oh, and the global reflection cubemap has also been toned down a bit and switched over to use a compressed version of the HDRI skybox rather than the studio lighting look I was using before.

This approach is pretty cool, and certainly more vibrant... but it's still missing something.  It's a very flat look to it, and if you circle the asteroid the lighting is even on all sides.  There's no real shadows happening.

Upgrade Two



Now we're talking!  This tones down the ambient light a bit, and then adds back in the directional light -- but tones that down to about 60% of what it previously was, too.  I also made the directional light warmer rather than a harsh white, so that it would match with the HDRI image I chose.  Incidentally, I went through a variety of HDRI maps before finding one that felt right.

The overall settings used in Unity for this are as follows, if you're curious:



And That's Where We Are Now!

In a non-procedural game, there's all sorts of fancy and highly-performant things that can be done with lightmaps and reflection probes and so on, but this is not that game. ;)

For performance reasons I'm not using parallax mapping/heightmapping/tessellation or baked AO on these models, either.  Those don't contribute enough to the scene to be worth the added GPU and RAM costs, and we want this game to be able to remain as huge as possible.  All of the changes thus far have been either GPU/RAM-neutral, or come with a performance savings.

I may move back into slightly custom shaders for this, mainly so that I can handle the death effects for ships via parameters on the ship itself "eating the ship away" as it dies.  But in general, beyond that, this is how the game looks now (or will look, once we paint all these models again -- blending what came before with what we can do now).

Hopefully this was an informative/interesting read.  :) It's obviously something I'm passionate about, and I think it contributes a lot both to the mood of the game and our ability to sell it to a wider audience.

Chris
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!