Haven't posted in a thousand years, but figured I had something I could talk about that was worth sharing finally. Finally got a chance to try out the God of War 3 E3 demo and noticed a couple things while playing the demo for a few minutes. I could easily be wrong about this, but I think I figured out a little of what they're doing in the game to deal with real-time lighting. All of this is conjecture on my part, and like I said, this is based on maybe 5 minutes of goofing around with the demo.
The environment is prelit. The environment can also be dynamically lit by Kratos's actions. But, interestingly, not both at the same time on the same triangle. This is easy to see if you study the specular highlights as the dynamic lighting dies off. So here's what I think they're doing (more or less).
- They're on a per-vertex basis categorizing whether a triangle is within the range of attenuated brightness of the dynamic lights. If it is, any vert outside of the range is set to brightness of zero. Add that triangle to a list for the particular object for the dynamic lighting path.
- If the triangle is entirely outside the attenuated brightness range add it to a list for the particular object to be processed through prelighting.
- Normally categorizing things like this per-triangle might seem rather dangerously expensive and strange, but if you're routing everything through the SPU (which as a PS3 exclusive they sure as hell are) it wouldn't really be that big of a deal.
The reason I assume all of this is it appears that when dynamic lighting appears, prelighting disappears. The fade rate of the transition between the two also appears to be along poly - not pixel - boundaries. Doing this would have a few obvious and huge advantages:
1) it's cheap! Any surface undergoing dynamic lighting is not going through the prelighting path. This means that they can be balanced out pretty well against each other as the complexity of some per-pixel prelit solution (say, Valve RNM hemispherical basis, or typical SH stuff) is going to be pretty equivilent to a handful of per-pixel point lights. So your worst case scenario is quite well structured!
2) it looks more dramatic. I did something not dissimilar to this back in some of the last-gen MK titles when using effect lights on characters. I found that throwing effect lights, given hardware T&L fixed function per-vert lighting, would mean that lighting would very quickly saturate to white. This would make the effect lights hard to see in brighter environments, or when the characters happened to be full on in light. Solution - dim the standard lighting on the character inversely proportional to the attenuation of the effect lights. So essentially, as the effect light gets closer, the real lighting fades off making the effect lights much more dramatic and powerful. Worked brilliantly (heh, literally) and make the effect lighting really pop.
GPU Zen Two CFP, and LAA
2 weeks ago