Sprite Lamp is a software tool to help game developers combine 2D art with dynamic lighting effects, through the creation of hand drawn normal maps. You can keep up to date with Sprite Lamp via twitter or facebook.
Sprite Lamp for Windows is available right now, via the humble widget (DRM-free), or via Steam:
There is also a free trial of Sprite Lamp for Windows.
There is also a MacOS and Linux version of Sprite Lamp under development, and those will be released (also on Steam and via the Humble Widget) as soon as possible. This will likely be October or November 2014.
In case you’re here looking for information on getting a particular engine working with Sprite Lamp, here is a (short but growing) list of downloads and instructions for supported engines.
Feel free to get in touch with any questions you have about Sprite Lamp via this contact form here.
Dynamic lighting for 2D art
Despite the growing graphical power available to gamers on everything from consoles to phones, many game developers prefer to use 2D art in their games – often to preserve the style of their art, or just because 3D models can be expensive and difficult to work with. One downside of this is that dynamic lighting, and the benefits that come with it in terms of atmosphere or gameplay, become much more difficult to achieve. Sprite Lamp aims to change that.
At its core, Sprite Lamp is for creating standard assets – normal maps, depth maps, anisotropy maps, and ambient occlusion maps – to be used in the ways that common game engines are already using them.
What makes Sprite Lamp unique is that it creates these maps without ever needing to model anything in 3D – all the inputs can be hand drawn, and Sprite Lamp preserves the art styles that are possible with hand drawn images. As an example, if you were making a pixel art game featuring zombies, here’s how one of those zombies might look if you were using Sprite Lamp:
How it works
In the above example, we made a dynamically lit zombie. If you were wanting to make such a character with Sprite Lamp, here’s how you’d go about that.
First, you will need to draw the outline of the character (or whatever). This will eventually become a diffuse map – that means that it’s a picture of the character with theoretical ‘perfect’ lighting from every angle. Our zombie’s diffuse map looks like this.
Having created this, the next step is to draw what I call ‘lighting profiles’. These are images of the subject, painted in greyscale (as though the subject was made of white plaster), with a single light source coming from a single direction. You can draw as few as two lighting profiles, and as many as five – the more you draw, the less physically accurate they have to be for good results. With the zombie, we went with four.
From here, you feed these lighting profiles into Sprite Lamp, a process which looks a bit like this:
Different visual styles
Sprite Lamp works well with pixel art, but it’s just as good with digital paintings, meaning you can keep your brush strokes where you want them to be. Indeed, it can be used on physical media as well – this plague doctor was drawn with a ball point pen and scanned in.
After being processed into a normal map and a depth map, the result looks like this:
Sprite Lamp is primarily for the creation of normal maps, but it can also create depth maps. Depth maps are useful for various reasons, including 3D effects such as parallax mapping, but because at the moment Sprite Lamp’s preview window doesn’t handle 3D movement, the most effective way of demonstrating the use of a depth map is through self-shadowing. You can see this in action with the plague doctor, above, but it becomes very apparent with environmental textures. As an example, here are the drawn inputs for a brick material – you’ll notice this one was done with only two lighting profiles:
From these inputs, Sprite Lamp is able to get the following results:Sharp-eyed readers might notice that there is also a specularity map in evidence here. This is true, but I’m not cheating – it was also generated by Sprite Lamp using a slightly hackish repurposing of the ambient occlusion algorithm, allowing us to highlight the exposed edges of the stone, making them look like they’ve been worn smooth. I’ll talk a bit more about that later.
If you upgrade to the pro version of Sprite Lamp, you’ll gain access to several features designed for more substantial development operations.
- Full command line interface: Include Sprite Lamp in your build process, rather than generating maps from source art manually.
- Generation of anisotropy maps from hand-painted images: Using a specific and easy-to-draw ‘flow map’, artists can sketch lines in the direction of microfacets on a surface and Sprite Lamp will process this to create anisotropy maps in a variety of formats.
- In-editor tools for editing depth maps: Though Sprite Lamp will create depth maps for you, complex images sometimes require tweaking, and this can be tedious in a traditional image editing program. Sprite Lamp Pro lets you adjust the depth map more easily for better self-shadowing results.
- Process and play back multiple image sets at once: Sprite Lamp Pro gives you the option to load in multiple image sets, such as frames of an animation, process them all in one action, and animate them in the preview window.
Uses for Sprite Lamp
As mentioned, Sprite Lamp generates maps – the animated gifs above are from Sprite Lamp’s built in preview window. I made Sprite Lamp with the goal of making full games that look like Braid or Metal Slug or whatever 2D look you prefer, but with dynamic lighting. And to be clear, you can absolutely do that, and if you do I will sing your praises (and play your game). However, Sprite Lamp might also find uses in other places.
- Textures for 3D stuff – the common ways of creating a normal map for use in a 3D game is to model the surface in a high poly mesh and then render a normal map from that, or use a photo and then process it via a tool like Crazy Bump. Sprite Lamp gives you another option. It’s not as quick as Crazy Bump, but you have more direct control over the results. You can of course use Sprite Lamp to paint normal maps for complex geometry/UV unwraps – which might save you from having to do a high res version of the mesh for baking purposes. It might be a bit confusing painting lighting profiles onto a UV template, but it works in the least confusing way possible and doesn’t pose any serious difficulties. It’s also worth noting that Sprite Lamp’s algorithms work fine with tiling textures – if the input images tile, the outputs will too.
- Depth maps for stereoscopic 3D – something that people are gradually realising as they play more and more with stereoscopic displays such as the Occulus Rift, is that normal maps don’t really cut it anymore. Depth perception allows the player to see just how flat those surfaces really are. You can save this with various shader techniques, such as parallax mapping, but for that you need a depth map. Sprite Lamp generates depth maps from normal maps (either ones that it creates, or ones you load in).
- Relighting characters for different environments – this one doesn’t even necessarily require dynamic lighting, as it can be precalculated. Drawing a character so that they fit the colour scheme of several different environments can be challenging. Sprite Lamp can act as essentially a beefed up palette swap, meaning a character can fit into many different environments. Note that this means you only have to draw lighting profiles for the character – the environments themselves can be traditional art.
- Introducing visual variation in 2D games – you might not be making a game where lighting is massively important to the gameplay, so this doesn’t seem worth it. While it’s true that drawing lighting profiles takes up a bit of time, under certain circumstances it can end up a saving. When drawing 2D art, you often end up drawing things a couple of times so that things don’t look repetitive – adding a dynamic light can really cut down on that kind of thing. For instance, here’s a simple dirt wall texture, drawn at 64×64, showing some fairly evident tiling:Here’s that same texture, repeating just as often, but with a single point light illuminating it rather than uniform ambient light:The first one, I might be inclined to create some variations to the texture to help break it up. The second one, I think you’re safe – only a fairly trained eye can pick up the repetitions.
- Baking multiple lighting situations onto assets – even if no dynamic lighting is involved at all in a 2D game, often the artist will have to redraw certain things when lighting situations change. An isometric RPG in the style of 16 bit games might have multiple sections of similar brick wall – one in darkness and one with a torch mounted on the wall, for instance. Sprite Lamp could be used to automate this process, creating multiple assets with different types of light source, or multiple frames of a ‘flickering torch’ texture.
Won’t this take ages?
Yes and no. I mentioned a couple of examples above where Sprite Lamp could conceivably be a time saver, but I’m not about to claim that drawing a set of lighting profiles is quicker than drawing a single image. Ultimately, it’s up to the developer to decide what visual effects they want in their game, and how many resources they’re prepared to spend on that goal – Sprite Lamp simply provides another option when making that decision.
That said, drawing a set of lighting profiles doesn’t necessarily take as long as you’d think. I’m not an artist, but the artists I’ve worked with have told me that the shading isn’t the bulk of the time spent on an image, and the rest – sketching out the shape and colouring – need only be done once. Furthermore, the lighting profiles Sprite Lamp expects allow for certain simplifications – they require shading but not shadowing, for instance, for optimal results. Simple or hastily-drawn images combine to make more detailed ones, as well, so the individual lighting profiles can often be done in less time than the final image’s shading would have taken.
From what I’ve heard and observed, drawing a Sprite Lamp-ready set of images ultimately takes about twice as long as drawing a single colour image. Whether that fits into your art budget is up to you.
Sprite Lamp is available now for Windows, but I’m not done working on it yet. My immediate focus is releasing Sprite Lamp for MacOS and Linux, and further developing the Sprite Lamp shaders for a wider variety of engines. I hope to have made some major progress towards all these goals by the end of October.
In addition, there are a few outstanding features that are yet to be implemented, mostly specific to the Pro edition of Sprite Lamp. I intend to add the ability to use your own custom-made shaders to Sprite Lamp so that you can match the Sprite Lamp preview window to your game engine’s lighting environment precisely, to save artist time. I’ll also be adding the ability to export a (sensibly tessellated) mesh built on the depth map generated by Sprite Lamp.
There is also scope for more features not yet discussed, including but not limited to usability improvements. Once Sprite Lamp is in more people’s hands I will be able to get more of an idea of what people want. I intend to get a proper Sprite Lamp forum up soon to discuss things such as these, but if you can’t wait, feel free to contact me with suggestions.