[Tutorial] – Lightmapping in Game Guru

Hi!

First of all, I don’t claim my lightmapping to be particularly great. However, I was one of the first to dabble into GG’s stubborn lightmapper and am sad to see that so little have yet dared to experiment with it.
Those of you familiar with my work might remember that I wrote a similar tutorial back in 2011 for FPSCreator. However, a lot has changed with how GG handles its lightmaps and GG users around the web are amazingly inept when it comes to this crucial, if not vital, part of level design that I think its time that someone writes a tutorial on how to do it.

Okay, now that I have successfully alienated the majority of my audience, lets get this puppy started:
Introduction

Now lets read what uncle Wiki says about lightmaps: “A lightmap is a data structure used in lightmapping, a form of surface caching in which the brightness of surfaces in a virtual scene is pre-calculated and stored in texture maps for later use. Lightmaps are most commonly applied to static objects in realtime 3d graphics applications, such as video games, in order to provide lighting effects such as global illumination at a relatively low computational cost.”
Now for all you shrimp with a short attention span out there, this just means that lightmapping is a process that saves illumination data in a picture and later puts it over the static geometry of your map. Like a warm and cozy blanket. Here is an example of what that looks like:
 

Example of a lightmap texture 

 

GG Level without textures and only lightmaps.

Now everyone who has ever worked in traditional art, photography or film nows how crucial lighting is and if you are just starting out in game development you might have never thought about it. Visually a level is made up in 3 equally important parts.

How it looks and the story it tells (this includes the quality of the assets, how they are arranged and how much the player can immersive himself)
How it functions, how its navigated and how clear that is communicated to the player (this is where all things gameplay fit in. Nobody likes an impressive level where you can only go straight)
And how its lit. (lighting can dramatically change the mood of the level and determines what the player sees and what he does not see.)

Since everything is constantly changing so does the hobbyist or how its now called “indie” game development scene. When I started out, people where very interested in learning new things and honing their skills but that has certainly been distorted in time. Now that Game Guru has brought in a whole new crowd we still get people who like to get to the meat of things and learn but you also get a whole new bunch who are more interested in pretending that they are a “game studio” and announce their first project right away as a work in progress blockbuster on IndieDB, social media and Steam. This type of crowd usually deflects inquiries about their skills or technical background of games and claims to add features in later or do it in post processing. One bloke even told me that he was in the process of modding the engine to incorporate state of the art lighting effects (I’m well aware that this is impossible). People that are new seem to think that they lose face when they admit that they are new and thus naturally inexperienced. The opposite is the truth. Now more serious developers told me that they had issues and then opted to use dynamic lights. Thats okay for exterior maps but can be a serious problem when working with interior levels. I’ll address some problems those folks might have encountered too but first I want to rant more about horrible poser-developers:
Now this type of developer has multiplied over the last few years and they have contributed to sites like IndieDB being mostly a graveyard of concepts and ideas and there being a fatigue for no- to low-budget indie games manifesting in the gaming crowd. There is also the steam witch hunt for asset flips.
Oh well! I suppose there is little one can do to keep this sort of thing to happen. A lot of you probably remember the individual that makes money releasing stock GG demos on steam.

I don’t quite understand this mindset but this thread is about lighting and lightmapping… so:

Long story short: I made a picture using some great work by other artists in the unreal engine to show how crucial lighting is to a map and that its indeed not a skill that can be postponed if you are at least somewhat serious at designing levels.
 

How to lightmap (the tutorial)

Its good practice that after you conceived a level ( be it on paper or in your head) that you start with outlining the general architecture.
Follow this up with a bit of detail and then start a first lighting pass. Now you can experiment with the colours and the mood you aim to realize in your level. This can be quite fun. Once you settle on a colour scheme (there is a lot you can read up on binary contrasts…just keep in mind that every other movie is already toned in oranges and blues so you might as well do something different. Just see what works! ) you can keep that in mind and start with the detail passes.

Before I get into the meat of things, I am always surprised how many game designers end up having light sources (or other objects) awkwardly float a few inches away from the wall they are supposed to be mounted on or terribly mounted on a wall texture. Please don’t add to this.

The basics for lightmapping are this:

Add a light marker and make sure that its static ( press the “y” button or adjust it in its setting. It should now be displayed with a red tint. The ring around it indicates the radius the light will have. Be sure to be generous with this, its better to have too much than too little as light in real life tends to reflect from surfaces. ) As game guru does not support directional lights (altough if you absolutely must have this feature you can easily do it by hand by adding invisible meshes to direct the light.) its best to keep the light a bit away from the light source. (i.e. lamp or fire) This will make sure that the shadows will look more natural and don’t generate any harsh black spots.

I’ll use the sewer map from my game Acythian as a sample in this tutorial:
 

Light placed below a handmade fluorescent lamp.

Colour is an essential component for lightmapping. There are very few rules here. Use what suits the tone and style of your project just remember this:
Never use plain white, even for bright neon lamps. A greyish, blueish or yellowish tint will look a lot more naturalistic.
Fire does not emit red light. Go with a orange/yellowish tint.
 

Colour is selected on the left side of the screen.

These are now shots from my previous tutorial in the FPSC engine. However, the principal here is almost identical.

Select light colour


I rarely opt for the default suggestions. Click “other” to define your very own scheme.


A lot of you are working on grunge/military style or horror games. The lower part of colour intensities is best suited for these genres.


You can adjust the brightness of your light source with the slider on the right. Don’t be afraid of experimenting with dark colours. I recommend mixing them with brighter ones to simulate naturalistic light reflection.

Now all you have to do is hit F3. (F2 and F4 are also valid options. However the F2 option produces a lesser result and the F4 option is supposed to end up rendering better, sharper lightmaps however apart from it taking significantly longer I have never noticed much of a difference myself.)
After a lengthy rendering process ( this is the right moment to grab a cup of tea and check your mail.) you should be able to see your first results.
Your first results are terrible and there are tons of issues

Haha! You didn’t expect it to be that easy, did you? I know that Game Guru is the easy game maker but the truth is, making video games is just never easy. This is also the part where I’ve seen some developers try to stick to dynamic lights and disregard lightmapping entirely. This works for games that are almost entirely set in outdoor areas but its a really poor design decision if you have interiors.

Lets go over the typical mistakes that new users make:
1. I don’t even see my lightmaps.

In order to see your lightmapping you will have to adjust a few sliders in the TAB menu. The sliders make your life really easy compared to some earlier engines. The gist is, in order to see the lightmaps your ambience setting will have to be low and your surface level setting rather high. Make sure that the RGB values of both the ambience and surface level settings complement each other. You’ll end up with better results.
Since I know that people can do the weirdest things with these sliders I saw it fit to add the settings for the sewer levels as a template:
 

2. Some of my entities are not lit or too bright

Hehe! I know it comes across a bit like an elitist statment but it holds true that you only make about 20 to 30% of your game in the GG editor. Scripts, Models, Textures and their adjustment are done outside of the convenient GG drag and drop interface. The thing is that a lot of models don’t use the proper shader. The default choice by the time I am writing this is “effectbank\reloaded\entity_basic.fx”. You will need to make sure that this is a part of the .fpe files of your models (a .fpe file can be modified with the standard windows notepad.) If you know the basics of texturing (and if you are at least somewhat serious about the whole game making thing…you’ll have to get this down.) you can also add normal and specular maps if missing. However, this is not part of the scope of this tutorial.
Note that a lot of models from the steam dlc’s are also missing the shader line.
3. I get a weird plastic like glisten on models in dark areas. 

 

Special thanks to Avenging Eagle for this screenshot!

These are normalmaps reacting to the default sun. (which can not be turned off to my knowledge. At least not at the time I am writing this). In order to rectify this you can either flatten or at least weaken the normalmap intensity or you will have to add near by lights. Adding dynamic lights in the mix with your static lights can also lessen the effect. This is something that will need some practice but I’m sure that you will quickly get the hang of hiding this problem.

The setup.ini

The setup.ini can be found in your game guru install folder. It holds a lot of settings that you can edit manually. Make sure that GG is closed when you are doing this. Here are my settings (feel free to experiment with them)

lightmappingquality=1024
The resolution of the lightmaps (see above) You can go as low as 64 and as hight as 2048. However I dont recommend using 4096 for now.
lightmappingblurlevel=100
What I assume to regulate the sharpness of the lightmaps.
lightmappingsizeterrain=2048
The resolution on the terrain plane.
lightmappingsizeentity=1024
The resolution on entities (hallways, buildings and rooms are also entities)
lightmappingexcludeterrain=1
Use this setting if your game does not use the terrain. It speeds up lightmapping and saves memory.
Be creative

Despite what the marketing of several engines out there will make you think, you can get a lot of advanced engine effects down with trickery (after all, what else are video game graphics?)

These are screenshots from the game dark messiah of might and magic. It uses plain simple textured planes to simulate volumetric light. This can be done the same way in game guru and does barely impact the performance.

This is a terribly clumsy copy of an effect rolfy used a few years ago in his game eldora. You can use illuminationmapped, transparent planes to simulate stained glass windows shining in:

These are just examples! I think its important to have a mindset that allows you to at least try to find a solution for what you wish to accomplish rather than immediately halt production and wait for Lee to implement a new feature for you.

Notes from a previous thread:

If you have models glitch out, rescale or distort:

Open them in fragmotion, uu3d or a toaster for all I care and remove all the bones. Static objects don’t need them anyway.
Remove all .dbo files in the entitybank.
(untested) Someone mentioned that adding “resetlimbmatrix = 1” to the fpe helps in some cases. I can not verify this.

If you get models that reflect oddly or look like they are covered in wax or wet plastic

The lightmapper can react oddly to normalmaps in its current state, your normalmap might be too strong. replace it with a less intense version.

If you get bad results

Mess with the surface level settings and lower the ambience (depending on scene).
Increase settings in the setup.ini (advanced users only)
Check if the lights that are supposed the be static are static.
Lightmapping examples:

Here be tons of screenshots from my games.

Sewer area




Examples from my “flagship” project:












 

Links

Previous topic on lightmapping by me

Bolt Action gamings lightmapping tutorial series

Bugsy’s thread on mixing dynamic with static lights

Thank you for reading

Advertisements

About serygala

Who really has time to think about a summary of himself on the internet? I like art, women, gamedesign and I love coffee. Everything else is too much information.
This entry was posted in 3D Art, Development, Tutorials and tagged , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s