Simplify the window light creation and use the correct minimum value when calculating room light intensities
Hello! Sooner than I expected the weird ambient light flicking issues that happened when rooms affected by light sources from multiple other rooms seem to be resolved. That puts an end to the light saga for the time being. On to new things. 🙂
Hi! Every tile can keep track of up to 10 different light sources that can affect it. Until now, every light source was taken into consideration (read: the first ten), so if a room (or more likely the great outdoors) had more than ten light sources, every light source above that threshold would have no visible effect. This is now remedied by simply sorting the possible light sources by distance. While doing that, I also did a fair share of profiling to discover a lot of updates to these index values even though they didn’t change on every tick, that too is now remedied as well as some minor optimisations. So I will deem this good enough for the time being. That means for now the remaining problem are some rather unfortunate recursive ambient light calculation issues when rooms are connected through windows. The end of this topic is finally in sight 🙂
Hello! This takes the whole lighting topic bit closer to the phase of dotting some Is (optimisation) and crossing some Ts (making sure to only take the closest light sources into consideration). That luckily means there probably aren’t going to be any major changes in the current approach, so without any further ado, the current state:
Hello! Finally some visual progress is being made, the entire lighting topic starts to come together. There is still a lot of smaller and bigger tasks until I’ll consider it done, but hopefully that shouldn’t take more than a few more weeks. Enjoy a picture of the current state, byeeee.
– Fix GPU memory synchronisation problems when adding/removing light sources – Make olives compile with the current release of libvulkan – Move some code into a utility class that was awkwardly shared between two classes before – Very WiP implementation of better lighting for floor and wall tiles   Â
Hello! I finally got around to update libvulkan to the newest version so that it would compile again properly without constantly downgrading to the prior version. I also fixed some broken (or plain missing) logic to properly update the light information being copied to GPU memory and fixing some bits and pieces all around the code. That should hopefully lead to some screenshot soon!
Hi! Basically comes as adverties, this adds a second storage buffer which contains solely the light information and copies the already existing data into it. While doing so a bug or two has been fixed as the code was basically unused up to that point. As a proof of concept the data was made available on the floor (fragment) shader, but for the time being that is it, nothing usable is happening with it yet, that will be the next step. 🙂
Hello! After a bit of back and forth I present: Reasonable facsimile of a lamp
The next task coming up will probably entail jumping a bit back into the renderer side of things in order to prepare one or two more visual effects in relation to light. Let’s see! 🙂
Hello! This commit finishes the (preliminary) implementation of per-room ambient light calculation, but see for yourself:
What is clearly still missing is a new model for, well, lamps. That as well as adding support for ambient light changes caused by windows are the next steps on the agenda. Bye! 🙂
Hi! The mighty light chair is returning for another appearance. This time, it seems after some quick testing, it seems tearing down and adding new walls works properly in regards to light sources being associated with the right positions. Turns out having a std::map that cannot work properly due to a faulty condition in operator<() in a containing type is not a good thing that may lead to overlapping mappings. While debugging that I had a minor epiphany about a potential off-by-one problem, but the code broke before that even mattered. Now both should be fixed though. 🙂
Still wrong is the calculation that should take the size of the containing room into consideration when calculating the ambient light intensity, same goes for light colour, which is not used at all yet. One step at a time. Bye!