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

Automating Level imports from Blender to Godot

  Recently I've been making some levels in Blender an importing them into Godot. There are only about 7 or 8 shaders for each level, not counting dynamic objects which will be added later. But to improve rendering performance, it can be a good idea to split the meshes up into sections. At that point you might be faced with a list like this: Or it might be even more chaotic, if you didn't use simple names for the objects in your level. So it can take a long time to sort out all the meshes, make them unique and add textures and so on. Blender imports with simple Blender textures, or with placeholder materials. This is sometimes OK, but if your Godot shaders are very different to those used by Blender, it means applying new materials to every mesh object in the level when you import the scene. I found that during the design process, I was importing and readying a level several times before I was happy with the final layout. So at first I was wasting a lot of time. In Blender, I us

Dynamic terrain in GODOT

Long time no posts. I haven't been keeping up with the projects I started. At first it seems fun and exciting, but I always run in to limitations in the setup, plus the grind of just making stuff without any real challenges... It ends up being something that I don't want to commit to. So right now I'm just messing around with some ideas and see what comes out. No commitment to a bigger project, just some time to try new things. This week I've been working on procedurally generated terrain.  In the past, there were some big limitations on how I approached this, because the game world had to have the whole map, from the micro to the macro. I had to choose a scale somewhere between, which meant I couldn't have really large maps, or really small details. I think I've found a way around that. Below you can see two types of map data coexisting on top of each other. The wireframe is the collision data, used for physics and for clicking on the map, to move characters ar