Bleed per-pixel light up when rendering walls#7812
Conversation
There are a couple problems with that approach, illustrated by your example.
|
|
Thinking about it again, so long as the midpoint for the green lines is at least halfway up from the bottom of the tile, you would actually be able to extend those green lines all the way to the bottom of the bounding box for the base tile and just copy light values from there. Since the lightmap doesn't actually care about the shape of any given CEL, it should have light data for those pixels even if the current CEL wouldn't actually render there. So my second bullet point isn't correct. It really is only a question of whether it actually makes any real difference to choose the green lines instead of the red lines. Since the technique of copying light values up is more of a low-effort approximation than an actual shading technique, I don't think it would really make much of a difference. |
|
KP's suggestion would require different rendering for floor and wall tiles or floor tiles would not blend any longer, we do already indicate where most of these are, but even then some tiles a re bit of a hybrid and there would be a tile seam around any tile that doesn't have walls on both sides, which would actually be quite frequent. I think doing better then what this PR does would require making masks for all tiles that splits tiles in to 3 lighting types: I do consider what's done in this PR to be roughly the best that can be done for lighting with 2D rendering techniques and just the original data, at least while staying faithful to the look. |
47b86ec to
211645a
Compare
211645a to
71217ac
Compare
|
I made a debug tile set for the cathedral with no graphics: levels.zip |




This PR bleeds light up from the top edge of the base diamond to the top of wall/ceiling tiles, as described in #7809.
For this to work, we first need to copy light data for the base diamond of the wall tile from the per-pixel lightmap into a new 64x32 buffer. As we do this, we also compute where the top edge of the base diamond is so we can bleed data up from there to the top of the buffer. This new buffer becomes the source for light data used when rendering the base diamond. Then, when rendering the rest of the CEL data above the base diamond, we simply reuse the top row of the 64x32 buffer for every rendering instruction, allowing us to apply the same lighting to the rest of the graphic.
This effect really does make the lighting on walls and ceilings look remarkably similar to the tile-based lighting.
DevilutionX-2025-03-06_01.20.28.mp4
Unfortunately, it does reintroduce some banding between ceiling tiles. The best way to resolve this is to differentiate between wall tiles and ceiling tiles, which will require some work to add additional tile properties and/or masks for each tile graphic. That will be outside the scope of this PR.
This resolves #7809