Skip to main content

Real VS Fake: lighting.

In a video game, what is real?

This is, strangely, a question that infects many discussions about making games, much more so that those about playing games.

Well, some things can be modeled somewhat realistically; ray tracing, shadow casting, physics, real time reflections, on the fly destructible or deformable terrain, goal orientated action planning AI... These are all "realistic" approaches" to making games, or you might say simulation based approaches. Other times people use tricks; pre-baked lighting, animated pseudo-physics, on-rails movement, scripted AI, matcap reflections... These are all cheats, to save development time and processing power. They don't simulate real word physics or behavior but simply try to mimic the results.

Players of games are rarely concerned with with such things. Everyone who plays a game knows deep down that it is not real, and they don't expect it to behave realistically. Sometimes they get annoyed with games which show bad faith, enemies which respawn inside a locked room. Guns with infinite bullets. Cars which don't dent or scratch when you crash them at 200MPH. Who wouldn't get annoyed? We've got used to better.

But in other cases things such as shadow casting lights... If you've played Diablo 3, a AAA modern game, you might not have noticed that there's only one shadow casting light in the scene, and that shines from above the player. None of the other lights cast shadows. How does no one notice that? Someone asked me today; "Why don't you make your lighting system better, more like Diablo 3?"

Actually right now my lighting system is much more sophisticated than Diablo 3. I have multiple shadowcasting lights in the scene, casting "soft" shadows, unlike the hard edges shadows of Diablo. But I wonder if I'm wasting my efforts there.

Look at the picture above.
It seems like there is a sword on the floor, glowing with light. Actually, the sword isn't glowing. It's just a simple plane with a texture that has additive type transparency. A trick that predates real time shadows, you can see it used frequently in games from the last century! If you move close you'll see that it doesn't illuminate the player, it doesn't cast shadows...

Diablo 3 is packed with tricks like that. simple 2d shaders, particle effects etc... But the basic lighting is very simple indeed. When people praise the lighting, they are really praising the fake effects, not the lighting setup itself.

So maybe I should just focus on adding more cheesy visual effects and shaders instead of trying to simulate real torchlight. In the end, who's going to notice it but me? If the game has a single unidirectional shadow lamp, no one is going to notice, and the result will be much faster on low end computers.

Comments

  1. Very simple comment from my distant past:
    "It is irrelevant how you do it, just as long as it looks right to you"
    So take whatever shortcuts, do whatever you need, and cut every corner to get it right :)

    ReplyDelete

Post a Comment

Popular posts from this blog

Back to Vinland.

I'm going back to my real time tactics project, Vinland 1936.
While working on the other project I overcame the problems which were stopping me from saving/loading the game and also cleaned up the base code a lot.

After a few weeks I'm getting near the the state I was in before.


Infantry are back to their previous state, and vehicles are running OK.
This time I'm going to push ahead with mocking up the combat system though before I work any more on the vehicle builder or graphical aspects of the game.

Map screen designs

I've been working some more on the map window. Right now you can only see the base, it doesn't show items, enemies or even doors on the map yet. These would be decals.


In the top window you can see the modified result of last night's tile based map. It looks good but there are some visual artifacts related to the problems I encountered yesterday, and as well it takes much more code and time to calculate.

The second window uses a cheap trick to fake an beveled look from a smoothed version of the 32x32 map. It uses black to mask unexplored areas.

Finally the third version is meant to look like a had drawn map. I'm using a cross hatching texture to distort it and unexplored areas are shown as blank map paper.

There's going to be a mechanic in game where you need to use some paper every level in order to activate the map for that level. From there it will fill it in automatically. Paper will be pretty rare so it might be worth keeping it safe for the more complex level…

Infantry combat and entering buildings.

I've been working a lot on the game recently and I've nearly rebuilt it to the level it was before. Past that maybe, since now I have the beginning of a working combat system and the ability to save and load the game.


Infantry can now occupy a building. It's quite an abstract representation, since they stay at the door and turn invisible. But they can then fire from one of the windows and take damage from shots at the windows too. I think I've set it up well so that when building damage and destruction is working then the system should continue to work.

For combat I tried some new ideas, but they didn't work out that well. It seems that it's important that viewing range should be further than shooting range. Now shooting range is pegged at 18 units of distance, while viewing range can extend out past that.

In the above image one unit has an officer, so has further viewing range. The other can only see as far as they can shoot, a dangerous situation since the en…