Relative subjects:
Custom shaders
Shadowmap
Lightmap
Line of Sight
Fog of War
Screen Space Ambient Occlusion (SSAO)
Contact-Surface
Okey, so it's getting close to christmas and all my friends has fleed my hometown to their own hometowns. I have spent these days on the coach(since my friends is out of town) doing some thinking about the lighting in the game i'm currently developing with some friends and I just like to share some of the thoughts I came up with incase someone is interested

First off I can show a picture of the game to give you an Idea what I have to work with.

So it's a turnbased strategygame where you can play 1v1 online or LAN or vs a computer.
The camera can by zoomed out and in and turned in any direction.
1. ShadowmappingAs you can see there is not much shadows in the game. I have spent tons of hours of researching shadowmapping techniques and settled with one where I just prerendered a static shadowmap for the whole level wich I then did depthtests against in runtime.
It worked well on the landscape, but there was an issue where the resolution wasn't enought when I applied the shadows to the objects. I had problems with penumbra areas and z-fighting. Any blur filter or any other technique didn't seem to solve the problem.
I noticed that I could change the texture from 16bit to 32 bit to increase the depthresolution and also set the far near planes as close to each other as possible. It didn't help much though.
I thought that I might just add realtime shadows instead, It's more expensive but the it would be of a higher resolution. I did alot of reasearch and tried several approuches but I just couldn't get it working perfect with the dynamics of the camera in the game. So I sought my answers in something else..
2. LightmappingSince most of the content in my level is static I thought I could use a lightmap for the landscape instead of a shadowmap. It would allow the graphiccard to do texturefiltering on the texture, I could prerender blurfilters and it would be alot cheaper to render.
I must say that this was alot easier then expected. All I had to do was to do a collisiontest from each point in the landscape facing the sun and save it to a texture. Wow, why didn't I try this before? Took like 3 min to calculate but since I save the lightmap-texture I don't need to do it again, aight!
3. SSAO, not reallyAs you can see in the previous picture I were using SSAO along with the shadows. It's not real SSAO though

I had a thoght about SSAO and did some research on it, I tried implemting it and got it working but I noticed that calculating SSAO for up to 500 objects in a level takes some time and the detail wasn't very satisfying either. I had a thought about it and asked myself if a strategygame is a good setup for SSAO? I would say no, it's other ways I could simulate the effect of SSAO which is alot quicker and cheaper. I got this idéa that what if I just simulate a contact-surface between the objects and the landscape, wouldn't that give an effect that would increase the looks of the game? Probably.
What I did was that I did a collisiontest on the points on the landscape and about 3 pixels up determine if it was an object above that point. I set the pixels accordinly into a texture and ran a PCF filter on it so it would bleed(to get it outside of the meshes). This took like 2 minutes for me to calculate, and needs again only be done once. I could live with that and the depth of the game increased significally.
Part 2 was to get the meshes to blend with the landscape. By simply checking the position of the pixel in the shader relative to the objects height I could fade it on the bottom. Really cheap but the result talks for itself:

4. Lightning on objectsNext step in the progess would be to get those darn shadows on the objects in the scene. What I came up with was to once again precompute this(on level basis). What I did was to run through each vertex in ever single object on the level and do a collisiontest towards the direction of the light and then I tried to save the data into a texture but I had problems with understanding the UV-coords so instead I chose to set it into the vertexcolor in the mesh. This went smoother then expected, took like 60 seconds to run though 350 objects and I could save the information to reuse it for the specific level each time.
5. ConclusionIt's a beautiful day, I am so happy to get rid of the shadowmapping(it's really a maze). I had some problems with getting the vertexnormals to work with the setting of the vertexcolors but I it was a easy fix. Below is a picture with working normalmaps and specualar. Anyway the best thing about all this is that the levelartists is using a neat leveleditor that I built, where they just need to click "Export" once everything is done and then Lightmaps, Nodegraph, Heightfiles, Occlusionmap, FoW-grid and other information is calculated, zipped to one file and then it's just to put in the level-folder of the game and ready2play. Since everything is precomputed we can get all these neat qualityfeatures during runtime for almost at same fps as simply running ambient lighting.

Here's some pictures from the realtime updated Line of Sight based Fog of War(it was harsh to get updated in realtime without any lag when running line of sight checks between 100 objects with 300 objects to collide with)


It's alot of things so I can't go into detail about how I solved everything and what I learned doing so but If you'r interested in anything I love to help!
You can read more about the game here if your interested or visit my blog.