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

Advice needed on tilesets...

I need some advice on which is the best way to handle building the dungeon. Right now I'm using prefabs for my dungeon, they have a north south east and west section for each "room": The basic tileset. This has several advantages, and also several disadvantages. Firstly I can have curved rooms, I can have tunnels and other interesting shapes. The tilesets can look quite nice with a little work. On the other hand I can't easily get the navigation data before building the map and once the map has been built I can't make changes to the layout, like having active pit traps or believable secret doors. Although the rooms are interesting, they are quite repetitive, and it takes a lot of effort to make even a few different variations. Also rooms are constrained to one size. A newer version of the tileset with a lot of variant parts for making more interesting rooms. To create a tile set is a real headache too. Planning how to lay out the UVs, trying to cra...

Upstairs / Downstairs.

I've decided to make my prefabs multilevel. Later this should allow me to add pit traps and other great stuff. It also makes it easier to line up stairs so that you can exit them on the same co-ordinates where you entered them. The prefab editor is pretty much finished, it just needs some code for loading up prefabs from a saved dictionary, so that they can be checked or edited. The entries will need to be forwards compatible, so I'll be loading each tile and then translating the indexes to a new array, that way if I add extra indexes or extra info (like traps or puzzles) I'll be able to update existing prefabs to work with the new standard. Click for a video.

Video Diary 8

Things are moving along well, there's been a lot of progress on the action manager side of things. Actions have finally moved to the UI, so you can initiate actions by clicking the appropriate button. I've set up some dummy actions to show what happens visually when actions are taken, but the actual dice rolls and such are yet to be integrated. The UI objects are also being added, though some are non functional or empty at the moment. Click on the image to see this week's development video. Every time I add something big I also add about a dozen small things. Like the selection box visualization. Previously this was using render.drawline, and old fashioned Blender function which can be impossible to see at certain resolutions, or at certain frequencies. I replaced it with a function that adds planes of the right size and scale in the right location. I also made all characters a little bigger. I still need to do some work with vectors and final target locations t...