Clustered forward rendering works similarly, but avoids the extra additive passes at the cost of slightly more setup. In it, you load all info for the lights affecting the scene into an array stored in GPU memory (an array that can be reused with slight alterations between frames as you move). You divide the viewport into NxMxD sections and build a list of n indices for which lights affect each section (simple bounds testing on basic shapes). Then in the pixel shader, you use the pixel's x/y/z coordinate to calculate which section it's in and get that section's list of lights. After calculating the diffuse color and normal for the pixel, you iterate over the n lights indexed in the list and add their contributions.AnyOldName3 wrote: ↑10 Dec 2017, 00:27The benefits of deferred shading and lighting are that you don't have to do anything with lights at all until you're at a point when you know exactly which lights will affect each pixel and then for each individual light, you can do a single additive pass over the existing framebuffer to add its contribution to each pixel.
This also has the benefit of working with translucent surfaces, since it doesn't depend on a depth buffer to retrieve the pixel location after the diffuse pass (if multiple surfaces can occupy the same pixel, a single depth value isn't sufficient). Similar for the normal buffer, if there's multiple overlapping surfaces a single normal wouldn't be sufficient.
I don't think per-pixel lighting in Morrowind is that bad. There's a few minor oddities with specific light sources, but nothing particularly garish or game breaking (it's a result of the game expecting per-vertex lighting with relatively large polygons, which was the norm in the late 90s and early 2000s; enabling per-pixel lighting on most games expecting per-vertex lighting would probably expose similar oddities). Mods could even fix those minor issues.This isn't an issue for most games as per-pixel lighting is more realistic, but when you have the collection of hacks resembling a game engine that Bethesda produced and assets designed with that engine in mind, issues appear.