How many times have I posted over the past months saying “I’ve got it!”, only to discover later that I really didn’t? Man…it’s been a few to be sure. It’s weird how that happens to be honest…sometimes you know in the back of your head that something is just not quite right, but you’re caught up in the euphoria of having made a solid improvement or breakthrough, and you get ahead of yourself. I am the king of that, haha.
In my last post I threw up a bunch of screenshots of the “saucer”, and while I was reviewing my post, I noticed something was a little off on the player models lighting. I had also noticed that the new dynamic lighting seemed off in much the same way. At various times I yet again noticed that certain map objects, especially larger ones, seemed a little weirdly lit in places. I really couldn’t put my finger on it, but I knew…oh I knew…
Let’s look at a shot that really shows the problem:

Well, at first I really thought this was a great example of the lighting and shadowing in the engine, but there is actually something a little off on the player models. Their left sides show a decent amount of shadow, when it actually should be brightly lit. I started noticing that most every screenshot of player models had the same issue. Also, further back, the wall near the ceiling is quite brightly lit. That is also wrong. Now maybe you think, ok, maybe it’s the shadows that are wrong, but that is not the case. The shadows are generated prior to translating anything, but the lighting is generated on another pass that is post translation(there are reasons for that, trust me!). Knowing where my light sources are, and how the shadows are, I realized that the lighting was off. This really aligned up with what I was seeing in dynamic lighting – that when shooting a lit projectile down a hall, that one side of the hall seemed lit up more than the other.
There was no doubt in my mind that I was not translating the light sources in concert with the meshes. In fact, it seemed obvious now that everything was 90 degrees off on one axis. I looked at my code and saw the problem immediately. DOH! I literally had the wrong X axis translation, I think I was experimenting and never put it back. Well now, that was a quick and easy fix! I fired the game up…and well, things looked quite a bit different! I made some fixes to the maps lighting, fog, atmosphere, and got it tweaked to have a good mix between the diffuse and ambient light values (which when a map is made of a bunch of large meshes, it’s pretty crucial). Now I saw a vastly improved lighting, and all of the weird lighting artifacts? GONE. WOOHOO!
Look at a similar shot and how the lighting looks –

As you can see compared to the previous shot, the light on the left/front side of the model is much brighter, and the shadow matches what you’d expect. The walls in the rear now seem to blend more with the ceiling as well. The objects hanging from the ceiling, they also blend in better with the ceiling. These things may seem subtle, but believe me when moving around in the world, it’s a massive difference and really makes the renderer feel accurate and smooth.
You may also note that the tone looks a little warmer and more alive. This shot also exemplifies the more natural look –

The main reason for this is, that I fixed a long standing bug with the light bloom code. This was another major DOH! The idea is that you sample the bright pixels, blur them vertically, then horizontally, and then blend them over the scene. Well, I did, but made a really dumb mistake. Like really, really dumb! I was sampling, then blurring vertically, blending over the scene, then taking the sample, blurring horizontally, and blending over the scene again. But wait…what? Of course that’s not right. You have to blur vertically, then blur the BLURRED image horizontally, then blend. Now that is fixed, and what a huge difference it made! WOOHOO!
By now you’re probably thinking hey, what’s that weapon in the last screen shot? Well yes indeed, there is a new weapon, and it’s fully functioning! This would be the grenade launcher, a weapon that flings out a grenade with a big punch. Took a while to get all of the physics right, but it works really well, and I’ve gotten the bots using it effectively too. Doing all of this led to me cleaning house on a number of unused items, and it will lead to further consolidation. It’s getting close to the point where I will add the final weapon, and then the various ammo/armor/item entities. I should also add that the map editor is getting improved as I go along, and I also will soon (very, like next) add a new map test of an outdoor area. This will also lead to me refactoring how map objects are loaded at some point, which will mean a lot more management of assets and physics. Yuck – but a necessity. It’s been fun just being all irresponsible and carefree with assets and memory but I guess it’s time to get serious.
Meanwhile, here are some new and some updated screenshots of the Saucer with all of the lighting changes:






The last thing to write about here will be the third weapon. I believe previously I had discarded the idea of a hit scan weapon, but I’m leaning more in that direction. Not set in stone, and a part of me really wants to deviate from the normal aFPS weapon set, but it’s hard to picture this game without some sort of raygun beam weapon. I know the color I want it, and the overall look/size/feel. What it’ll do is still up in the air though…