It seems that to develop excellent lighting system you need to develop excellent shader too
In this shader I need to avoid a lot of ‘if’ instructions to establish various light types, many cycles and etc…
Multiple lights are really where shaders muff up.
I estimated all lights and now I have 7 different light types. Each of them brings 3 potential samplers into shader – a 2d shadow map, a cube shadow map, and a projected cube map. Naturally, lighting shader has 4 samplers, that are already engaged – base texture maps: ColorMap, NormalMap, SpecularMap and HeightMap. Therefore, I used all possible 16 samplers very rationally. Oh, by the way last week I made Motion Blur (currently I am blending only one previous frame):
Soldier motion blur Camera (fast movement) motion blur
Of course, it is not the “real” motion blur, but it requires just few adjustments to achieve the real one (blend several frames with accumulation buffer…).
In conclusion – some person’s reaction of the CryEngine2 technology trailer:
- “Why this video is exceptional?”
- “I don’t notice anything there that I haven’t seen before.”
Did everybody game-players/developers degraded? Oh well… What does the future hold in store for us?


That looks great! You could put the heightmap in the normal map’s alpha chanel, that way you’ll save one sampler, one “SetTexture()”, one texture lookup in the shader and a lot of memory ;)
Oh really, I will do it! Thanks :)
Yeah! That rocks! But i was just wondering what is the performance when all these effects are made in real time? What effect takes most of GPU time? It would be nice if you post what fps do you achieve in those screenies. Thanks.
Oh, thanks for comment :) In this scene the fps is average between 32 and 80 on my second-rater - gf6200 256Mb. The scene has: two animated (skeletal) characters, two lights (omni and spot with projected cube map) with soft shadow mapping, some physic models - barrels, bricks; particle emitter (with volumetric lighting), and all of effects - parallax mapping, gloss mapping, bloom, motion blur… In my opinion, the effect that eats a fair amount of GPU time now is 'bloom', because it isn't optimize with shaders yet.
I think from now on this is going to be my favourite blog by a lithuanian. Keep it up. Oh and sorry for my useless comment.
Thanx =]
Damn it, post something! I need inspiration ;)
Now lots of time takes variuos tasks mostly my studies, so i will post some new information a little bit later. Thank you for your interest :)
what are you studying ?
Currently I'am studying at VGTU University and seeking a bachelor’s degree in Engineering Informatics.
Well, a good way to handle multiple-lights in a dynamic environment is to precompile shaders for 0, 1, 2, 3, 4, … lights and attach the correct one according to number of lights, illuminating the objects for shading (use some sort of sphere-sphere collision test, to disable lights too far away / too dark).
Hmm. Is it true? :-)