Skip to main content

Make your game models POP with fake rim lighting.

I was watching one of my son's cartoons today and I noticed they models were using serious amounts of simulated rim lighting. Even though it wasn't a dark scene where you'd usually see such an effect, the result was actually quite effective.



The white edge highlighting and ambient occluded creases give a kind of high contrast that is similar to, but different from traditional comic book ink work.


I'll be honest, I don't know if there's a specific term for this effect in 3d design, since my major at university was in traditional art. I learned it as part of photography.


You can find plenty of tutorials on "what is rim lighting" for photography. It basically means putting your main sources of light behind your subject so that they are lit around the edges. It can produce very arresting photographs, either with an obvious effect when used on a dark subject...


..,or as part of a fully lit scene to add some subtle highlights. See how alive the subject looks? It really separates them from the dark background and makes them in to an iconic image.


Now here's where it can be useful in your games. Because modern games can be very busy, with lots of environmental details, sometimes it can be hard to bring your models out of the background and make them stand out. There's a whole generation of games which were very muddy and brown, where the often great models are lost in the fog.


Darkness is also a problem, with "too dark" being a common complaint that indie games run in to during early development.



There are ways around this, use of light and shadow is very important, and there are always quick cheats like colored selection outlines to help the player find important interactive objects on the map.


But it's not always possible to have perfect control over the lighting in your scenes, and we don't want the UI to intrude too much in to the game world. If you want your game to have a dark atmosphere, you don't want to always rely on a player carrying a torch or flashlight. If you're an indie game developer you may also be working with limited resources and dedicating lighting for non essential effects might not be possible. So how else can we make our models stand out?


It's actually very simple to add a fake rim light to your characters as a texture layer in your materials. This 64x64 image can add a lot of pop to a character without adding any extra lights. Just set it as an additive mix over your diffuse color, it needs to be mapped to "normal" co-ordinates or whatever they are called in your engine of choice. It's basically the same kind of mapping used by matcap textures.

Here's what it looks like with just the texture:


It's quite a subtle effect, you might want to increase the edge size by making the inner, black part of the circle smaller. If your game is very dark, you can give it a little bit of influence on how the material is lit. You can also change the hue of the light to match the incidental lighting of your environment. In a volcano level for example it should be red.


Here's an example of a simple low poly character with (left) and without (right) the rim lighting. It's a very subtle effect and it's easy to miss, but it can add a little bit of an extra outline to your characters, especially if they are standing in front of a dark background.

Another example shows how it can look better when the key light is behind or to one side of the subject.


You can see how this would look best in a dark environment, maybe with a scattering of green screen consoles around the level.

Using a little bit of code it's easy to switch out textures for different environments too, so that the rim lighting matches the incidental color or the level your character is on.


As you can tell from my examples, I'm not an AAA artist, so I expect real artists would be able to get better results from this technique. But even on my simple low poly models I think it really adds something for very little extra resource usage.

I think that with a bit of tweaking this technique can also be used to bring fur shaders to life, or add something extra to cartoon images, just like the one that inspired me. 

Note: Photography credits can be found on the pages I've linked above. The source of the game images should be obvious. :)

Comments

Popular posts from this blog

How to... build a strong art concept.

So you want to make some art assets for your game. The first on the list is a Steampunk Revolver for your main character to shoot up Cthulhu with. Quickly opening your internet browser you start with a Google image search. Ah, there is is!

It might be a good idea to find a few influences so you don't accidentally end up copying a famous design.


Just mash them up and you're ready to go! Off to your favorite modeling program.
But wait! isn't there more to building a strong design concept than that?

Of course there is.
One of the diseases of modern design is that of recursion. Everything is a copy of a copy of a copy. This is especially a problem with "historical" concepts. Over the course of that recursive process the concept becomes infected with modern design elements, and ends up looking very similar to everything else that anyone else has ever made.
If you want to come up with a really fresh idea, you have to get beyond secondary references and go look at real …

Skynet

Ok, so it's not exactly skynet, but I have got my first AI state working, kind of.


The first state is "HOLD" in which case the agent stays in place where they are and shoots at any unit that comes in range. When I started writing this module, I found that the existing method of triggering actions wasn't good enough to allow the AI to choose the best weapon or target. It worked by simply sending a command to the unit to trigger the currently selected action.

If the action is valid, it triggered, if not it didn't.
That's fine for play controlled units, as that's all they need to do. But AI needs to know in advance if the action is valid. The player can get that info from UI feedback, but that wasn't available to the AI player.

There were three problems:

1. The UI feedback duplicated code in the action trigger function. These  two sets of code could get out of phase so that UI feedback was wrong.

2. The action trigger didn't give enough feedback for …