Prefab Level Generation - Light Probe Support

TLDR: We need LightProbes.positions to not be read only.

We have a procedurally generated map (via rooms) and we want to take our game to the next level by baking lighting in those rooms. I figured out how to bake light maps and change them at runtime, but the only thing stopping us from moving forward is Light Probes. Light Probes can not be moved at run time, the code seems to be buried and hidden, directly from serialization. No way to change or recreate them.

I have been searching for a solution to this problem for weeks and I am really hoping to draw a bit of attention here, because at this moment, there are no tools, no source code, no work arounds that I can find for this problem, and I’m seeing a lot of people stuck in the same situation as me.

This presentation from The Elder Scrolls: Blades shows their solution to this exact problem. It is very nice, but from the looks of it they basically had to rewrite the lighting system. If I could, If I even knew where to begin, I would happily do the same. Are there any classes I can take? I feel the subject is too broad to be self-taught.

Unless I can get help, my current and only course of action is to rewrite the light probe system, and I’m not sure if I can do it alone.

Thank you for your time!

4 Likes

yes please

a good place to start learning is to just go to the Unity download archives and download the source code for the builtin shaders. just browse around, search for anything light probe related. skim through stuff like the ShadeSH9 macro.

I meant, to add the light probes in a procedural way, so we can add new proves via code and change their positions and so

Hey Levitas,

can you describe the way you procedurally generate your levels in a bit more detail? Are those spawned at regular positions? I.e. is this some kind of grid where you add rooms to other rooms at fixed positions?

Cheers

I just necroed a thread from 2012 in the general support forum (sorry for that) that asked the same question but is better placed here i guess.

In the thread robert from Unity gives an answer to why Lightprobes.positions is read-only.:

In Unity 2019.3 these missing functions were finally added: LightProbes.Tetrahedralize and LightProbes.TetrahedralizeAsync

So now it seems there is a way to recalculate the lightprobe data in runtime but Lightprobes.positions is still read-only. Is this just an oversight or am I missing something here?

2 Likes

As I understand it, I can load a set of light probes at run time and Tetrahedralize them, but I have to know where those light probes are going to be in world space beforehand.
This won’t work for us since we instantiate our room prefabs to create a random maze, so to speak.
We need a way to save the light probes per prefab and convert from local to world space after level gen.

So, in relation to the geometry around them, probes are fixed in the prefabs and have fixed lighting, it’s just that you want to instantiate those blocks of geometry to build the level, correct? I.e. each room is a kind of a closed lighting system?

The probe system never allowed for modification after baking. I recently changed that so you one can at least additively load probes with the re-tetrahedralization feature, but I think we can loosen that restriction even further for prefabs. I got this noted in the probe backlog, but unfortunately I have no solution right now you could use.

4 Likes

This is exactly what we need. Thank you very much for your time and effort here, it is greatly appreciated. We patiently wait for such an update.

yeah, the exact thing available to do with additive scene loading would be amazing with prefabs.

Anyways being able to change the positions so they are not readonly would make it easier to build our own procedural additive light probes
and even creating a dots powered version for runtime baking

Currently, if I want to do a transition between different backed light prove groups I’m restricted to change only the Spherical Harmonics and blend between them, but I can not do that with the positions nor creating my own randomizer for procedurally generated bake data

Probably an option would be making the light probe data being stored inside the LightproveGroup component instead of the Scene, so switching between different backed light proveGroups components/prefabs could be a solution

+1 for this, it would make workflow much easier!

1 Like

Anything to make GI + randomization not require lots of in depth knowledge or time trying to get it to work … gets a huge +1 from me :).

1 Like

+1 to runtime modification of light probe

1 Like

if you are PROgrammer, you can do AssetBundle.LoadFromMemory(bytes[ ]) on a runtime generated asset bundle that has your desired light probe layout

Another +1 for some way to use light probes in proc-gen layouts!

My project needs this API too. Is there a technical reason why implementing this has been postponed for so long? Is the laughably scuffed Asset Bundle workaround really what I’ll have to resort to?

+1. Without the ability to change light probe positions at runtime, it’s infeasible to use baked lighting in procedural games unless you’re willing to effectively create your own implementation of light probes.

Support for light probe groups in prefabs would be a magnificent addition.

You actually can, you just need to copy the whole light probe data of the scene, modify the position of the copied data, and then re apply that data as the current light probe data

7835580--992997--upload_2022-1-24_13-39-5.png

+1