Glassix 2 - Dev log #10 - Let there be light
Hey guys!
So, the new Glassix 2 version didn't not contain new content since I've been trying to improve the lighting among other things and I'd like to share a bit about the process.
So, the new Glassix 2 version didn't not contain new content since I've been trying to improve the lighting among other things and I'd like to share a bit about the process.
Let's start by some simple light physics: light travel in a straight line from its point of origin, bounce or passthrough surfaces and absorb the surface color it collides with. Roughly...
Not let's see how Unity handle lighting:
- Ambient light: This lighting setting simply brightens the whole scene models equally. This gives some easy control when we want a day or night time scene.
- Light sources: As the name suggest, we can create a light source which will behave in different manners depending on its settings. For example, we have a simple directional light, our "sun" and "moon" which brightens all the textures in the direction of the light. We have some point lights which would be a lamp in a room and we have some spot lights which are used for the street lights. There are other types but you get the point.
- Global illumination: The last way Unity handles lighting and which is the most important for realism is the global illumination which is the process of calculating how our light sources will bounce over our models. This process can be done before hand (baked) usually for static scenes or in real time which will be calculated every frame.
Another important aspect of Unity to know is the render pipeline which is basically a way to calculate how stuff appears on screen. For Glassix 2, I chose the HDRP (HD for high definition and RP for render pipeline) which offers the best visual quality at the cost of performance. One of the flaw of this render pipeline I was not aware of was that it does not handle real time global illumination... And since Glassix 2 loads ALL its models dynamically from our mod folders, I can't use the bake method either.
Which leads to the current situation where our in game lighting appears really flat... I currently use some basic ambient light + directional light but those do not bounce at the moment.
Luckily, I found an asset on the Unity store which handles real time global illumination but due to the complexity of the topic and the particularity of Glassix 2 (everything is loaded dynamically + the time changes) I haven't figured out how to make it work in game yet. But we'll get it right sooner or later.
To showcase the current situation with images, here is a sample scene with the current flat Glassix 2 lighting.
We can see the ambient light in effect lighting everything equally in the room plus the directional light coming into the room and brightening in a straight line, no bounce
Now, what I'm trying to achieve is to get a more realistic lighting system where we would disable the ambient light for indoor scenes like so:
The whole room is dark as expected and we still see the "sky" from the window in the back. What is missing here is the global illumination feature which the asset I purchased should solve, like so:
As you can see, this feels more realistic than what we currently have in Glassix 2 and what I hope to achieve. Of course the intensity of the sun would impact the indoor lighting which would give a more realistic approach to the time of day, being super bright at noon and slowly getting darker in the late afternoon.
But such a result is quite tricky to achieve. It works fine in the static demo scene offered in the purchased asset but implementing in Glassix 2 is trickier when the time of day changes and involves new understanding of photography in the form of exposure and light intensity which I've only barely getting into for the last two months.
So you can see the importance of global illumination for quality lighting and why Glassix 2 looks currently flat. Once I figure this out, this should enhance the quality of the game by a lot I hope. And we'll also have new buttons to control indoor lighting when the current location is too dark even with our sun light or fully closed indoor locations (who said basement sex dungeon? :D)
Note that outdoor locations (none in the game currently but we could have in the future) and the city map are not really affected by this problem since everything is already brightened quite equally when outdoors.
And on another side note, if you played my other 3D game, Lust Complex, you might notice the same issue with lighting. The difference would be that Lust Complex uses the Unity built-in render pipeline which actually handles real time global illumination, I just didn't understand how lighting worked in Unity at that time but if I get the chance, I might update the game to fix the lighting. Maybe I'll release a separate poll about it in the future. We'll see.
That's it for this dev log. Not sure how much time I'll need to fix this part, plus I'm still planning to release a poll for you to vote on the most urgent aspect I should work on for Glassix 2 next version, so keep an eye on future posts ;)
Thanks for your time and support!