Robot Butler - My first shipped title!
Monday, February 28, 2011 at 8:58PM
n00body in Games, RNM, Unity3D


Ladies and gentlemen...I give you Robot Butler! This game was made in 6 weeks for Kongregate's Unity 3D game contest. In it, you play LX-27, a robot butler just trying to attend to his human masters' needs while keeping them from being slaughtered by invading rogue robot butlers!


My role in this project was designing a set of custom enviroment and character shaders that would allow the game to look good and run smoothly on a wide range of hardware. Given that we had to use the basic Unity3D package, this was quite a tricky task.



First, let me say that Unity is a capable, affordable game development platform. In particular, the most recent iteration has a rather convenient system for designing surface shaders. Sadly, its lighting system left us in a bit of a bind.


Now under ideal conditions, we could just use their new deferred lighting renderer and call it a day. Sadly, this dramatically ups the hardware requirements for anyone who would want to play our game. Plus, the project's artist would have had to scale back his lighting setups to get reasonable performance. Finally, it would have forced the whole team to buy Unity Pro licenses to work on the game.


Sadly, Unity's forward renderer wasn't quite right either, since its Single Lightmap system is rather lacking. Not to mention having no Irradiance Volumes to integrate dynamic objects with the static environment. Our artist needed a capable replacement that would scale well to older hardware, support the full suite of baked lighting effects, and handle highly detailed surfaces. So let's take a look at what I had to do to meet those needs.



So the buzzwords here are: Radiosity Normal Mapping, Detail maps, & Fake specular cube maps.


To get the best kind of baked lighting for the least storage, we needed support for Radiosity Normal Mapping. This way, we could use low-res lightmaps, while still being able to support arbitrarily detailed normal maps. Plus, all normal-mapped surfaces could get the benefits of radiosity, ambient occlusion, and an arbitrary number of lights with soft-shadowing.


Now, while this system doesn't cover specular, we were able to do a convincing job using a cube map with fake highlights. Then it was a simple matter of multiplying it with the diffuse contribution to get color, shadowing, and ambient occlusion. Not perfect by any stretch, but adequate for this project.


For more details, please check out my official post on the Unity 3D forums. ;)

kitch_01 kitch_02 kitch_03 kitch_04 

Figure 1. 1, Flat RNM lighting; 2, Normal-mapped RNM; 3, Normal-mapped Fake specular; 4, final materials



So the buzzwords here are: Rim lighting, Environment maps, AO maps, & Constant Ambient.


We used high-quality scene capture environment cube maps for reflections, which provides most of the enviroment's influence for dynamic object lighting. The rest comes from rim lighting and a constant ambient color with Ambient Occlusion. Despite its simplicity, this worked out well since all our dynamic objects occupy so little screen real-estate.


The only major annoyance we encountered was getting a decent system for setting zones for the varying colors/environment maps, and then smoothly interpolating/switching between them. Each dynamic object had to be aware of all the zones, and handle the transition itself. If our game world wasn't so small, and we didn't have so few parameters to change per zone, this would have become unmanageably cumbersome in a big hurry.


Despite its limitations, the results look great and are quite efficient.


Character shader:

RB01 RB02_env_occ RB03_addnormals RB04_complete

Figure 2. 1, Ambient Occlusion; 2, Environment map; 3, Normal mapped Env map; 4, final material


Lighting Environments:

RBinEnv01 RBinEnv02 RBinEnv03 RBinEnv04 RBinEnv05 RBinEnv06

Figure 3. 1,bedroom; 2, bathroom; 3, living room; 4, dining room; 5, kitchen; 6, shed



Overall, I'd argue that despite their shortcomings, these custom shaders make Robot Butler one of the prettiest Unity3D games you will ever see. That is, until they really start taking advantage of their Beast license to provide more advanced static lighting options. ;)


In the meantime, go play the game people! :p

Article originally appeared on Crunchy Bytes (
See website for complete article licensing information.