laurenth-personal / lightmap-switching-tool

Tool that allows switching different baked lightmap sets on a unity scene at runtime.
MIT License
657 stars 88 forks source link

Lighting scenario blending [enhancement] #32

Open ArieLeo opened 3 years ago

ArieLeo commented 3 years ago

Any chance to have a blending feature between lighting scenario, not full switch but controllable crossfade between 2 scenario?

laurenth-personal commented 3 years ago

Hi ArieLeo, I've been thinking about this recently and it would require major modifications to support blending. As far as I know the lightmaps still have to be Texture2D assets which are a bit annoying to update, using Texture assets would open the possibility to use RenderTexture which would be easier to update. I have not tried light probes blending but I imagine someone with good programming skills could blend light probes in a performant way, but maybe that requires knowledge of high performance code. In the end, it might be easier to solve this by storing GI in a 3D texture which could be blended. This means baking the GI with the lightmapper's custom bake API and providing the 3D texture GI to a custom shader or shader graph.

If I do experiment something it would be most likely the last option as it sounds easier for me, but it would take a while and I have not started yet, also it would be completely incompatible with the current tool.

laurenth-personal commented 3 years ago

@ArieLeo do you have an opinion on what solution you would prefer ? Do you see other possibilities ?

ArieLeo commented 3 years ago

Well if we can have a 3d texture lightmap i assume it would become some kind of irradiance volume? i prefer the 3d volume solution as it would be possible to sample the lightmap for folliages and dynamic objects, they should have more unified lighting looks compared to 2dTex lightmap with lightprobe. The only tricky part is sampling the irradiance volume, i doubt it is a good idea to sample whole scene 3d volume all the time.

ArieLeo commented 3 years ago

on second thought, the solution above can become purely custom GI solution :D

laurenth-personal commented 4 months ago

It looks like this is now possible to do with unity's adaptive probe volumes. It seems still a bit experimental, but maybe it works already