Now this raises some questions and I’d love to hear your opinion on how to handle such a game.
Lighting
Currently there is just one directional light, which casts no shadow. I baked the environment settings in the lighting setting and raised the environment lightning multiplier to get some ambient light everywhere. This is obviously pretty performant, but I want to add small lightsources for example to each wall in the picture below.
This would be way less performant, especially since the player might create many many rooms with a continuos growing count of lights. Do you have an idea how to handle many lightsources efficiently? Another thread suggested using deferred rendering path.
Occlusion Culling
I read the docs. Obviously OC is impossible if the player places and creates structures. Do you know any similar technic that would work? Maybe from the asset store? I couldn’t find anything so far.
Realtime GI
Does realtime GI work for structures that the players created during the game? I’m unsure.
Do you guys have any experience with this kind of game, you would want to share?
I would be very grateful for any ideas, tips and look forward to a nice discussion. Thanks in advance!
You could try something like prebaked prefabs, but it could cause more problem. Realtime gi although not true would be better. Maybe add something called ambient occulusion for better results.
Deferred rendering will be a big boost here (provided you don’t run into any buffer issues, but that’s really not a suuuper big problem on modern hardware), but I suppose a question is whether or not your light sources will be affecting objects around them or if you could get away with an emissive texture situation, maybe with the emissive strength being a material property.
If you’re not really dealing with them being actual lights, it’s really just another bit of data to add that’d still be really performant.
Deferred is a good possibility, but the engine will down scale lighting complexity if there are too many lights.
You can also use glowing objects with postprocessing stack with screen space reflections and bloom enabled. While it won’t light up the level, it can provide enough details.
You’ll need to write your own.occlusion system. Given that you’re basically using a grid, this would be easier than if your objects were a poly soup.
It doesn’t. Realtime GI in unity requires baking and static geometry. Because you’re building structures on the fly, there’s no static geometry.
In theory you could possibly connect something like NVidia VXGI, as it doesn’t depend on baking, but this won’t be easy.
Check out SEGI (Sonic Ether’s Global Illumination). It’s a fully dynamic voxel-based global illumination system. It went open source a few years ago and hasn’t been updated since so your mileage may vary.
The room walls in the example pic above already use emissive materials. However the effect is not really visible though… maybe post-processing could improve that?
Thanks for this detailed answer! I’ll try your suggestion for pps + bloom. If I remember correctly, reflections probes should be more peformant than the screen space reflection effect usually. But placing a real time reflection probe per tile, even with good performance settings might be to much? I’ll test that and compare using the profiler.
Definitely too much, Each real-time RP is an additional 2 cameras rendering. (one for each hemisphere of the probe).
I would recommend you make a system to detect when there’s an important lighting change in a tile and update the probe only on those occasions. If that creates fps spikes, limit the updates to N probes per frame and use a queue. Also, if you don’t plan on having extremely smooth and reflective surfaces, you can get away with lower resolution probes.
Screen space reflections are not reflection probes, work on any geometry, and can liven your scene up. They require deferred lighting, though.
^^^ See the reflections on floor? That’s screen space reflection.
You can acquire effect stack from package manager, I believe.
You CAN, of course place reflection probes at runtime in your scene as well in critically important places, if you really want to, but like you said, there will be a performance penalty.
A good practical example is “Satifactory” game (not a unity tilte though). They allow massive base construction and in practice they only have very small number of lights in the scene. Most of the time there is only one light - sun. Occasionally there are two lights in the scene - player flaslight and the sun. That’s because of MASSIVE amount of player-placed objects in the game. Scene objects that glow do that using emissive textures, and the glow doesn’t light the scene up.
However, they can do this:
As far as I’m aware, stuff on the ground is not a reflection probe, but screen space reflection.
Similar approach is used in subnautica below zero (Unity title this time). In this game, floors have reflective surfaces, and reflection is done using screen space reflection tehcnique.
When you building game you do not need to have everything lit up correctly. It could be like a ‘blue print.’
That way when u play the game the realtime light penalty does not incur, because you are loading level with occulusion culling. My friend Warthos recommend something called SECTR.
Best solution is realtime gi, but to date no reliable one for unity. SE and successors are no way productuion viable i feel, raytraced solutions and vsgi still too new i feel.