Let me show you some results from Friday. They are kind of late. Here's the thing: I've training at ever increasing intensity since late October, and last week I had one of the most intense workout ever by counting the number of different exercises. I was supposed to have this week off to recuperate, but instead I started my hand stand training and besides that this is shaping up to be the second most intense one, so I was in no mood to post or work.
For my game I want the following lighting scenarios:
- A directional light simulating the sun/bright moon used for days/bright night scenes, plus several point lights. This will produce very good visibility and the difference between shaded and unshaded areas will be small.
- A directional light plus point lights simulating darker environments, where the values are tuned so you have good visibility only when there is light because there is a big difference between shaded and unshaded.
- Ambient plus point lights, where ambient gives good visibility, but the main parts are lit by point lights. This will be default for interiors, especially houses, but also caves and other structures.
- Point lighting. This will be for very dark interiors, that have absolutely no light sources. If a light is not shining on something, it will be pitch black. In order to not make it annoying, most places will not use this lighting, and when they do, there will be a good reason for it.
Last time I showed scenario A, but with terrain not being illuminated by point lights. Let's fix this, but before, let us take care of scenario D, which is the most simple one:
In the above image one white point light is illuminating your surroundings. Ignore the thee canopies. Canopies are rendered by a permutation of the shaders that alpha blends and I always update them only at the end, when the normal shaders are perfect.
Some other textured terrain seems to have more color:
Terrain does not have specularity because I don't want to pay yet the cost for specular mapping for the terain because it is already more than expensive to render. Without specular mapping, only with standard specularity, I find terrain to be far too unrealistic and mirror like. Going to a grassy area gives even better color reproduction:
And finally, some soil:
The perception of light is not yet 100% identical for terrain and objects. If you look closely you may get the impression that there are two light sources with different intensity at the same position, one illuminating only objects and one illuminating only terrain. This needs to be tighten up, but I am generally happy with the results.
Now let's get back to scenario A:
This is a bright sunny day where you are holding a bright-ass light source. This plus bloom makes for the ridiculous brightness. Again, when in game, you will rarely turn on light source outside, but when you do, it will work.
And a couple of more shots showing lighting in action:
Now I need to add a hotkey to turn on or off your light source. I'm still not 100% sure on the equations. I also have a very annoying part of it, where the theory says 1 - N, but this gives bad results, so I am using 1 / N. Taking into consideration my educational background, this is driving me crazy. I need to write up a mathematical proof that one is correct and the other one is not.
After I need to figure out how many point lights can you squeeze in into a single pass. At least 8 with unrolled loops. And speaking of loops, why can't XNA set a single index for array of structure shader variables?
PS: I've also ran into an interesting issue. Running a version of the engine compiled on some other machine on my new giga beefy home computer runs like a charm. Running the engine compiled locally (Windows 8) gives horrible results, with terrible aliasing as if the render targets are scaled to some arbitrary value without any filtering and horrible performance. I need to figure out if I broke the code or the build environment is to be blamed.
No comments:
Post a Comment