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

Dynamic to Baked Lighting Switch #12

Closed wildstyle007 closed 6 years ago

wildstyle007 commented 6 years ago

Apologies if this is not the right place to ask -- your lightmap-switching tool looks really interesting, I've been reviewing the code to understand how it works. By the looks of things the switch between light maps is sudden? I've not tested it yet, but the change would be sudden and incur a performance hit on larger / multiple changing / loading of maps?

I'm trying to find a smooth solution to go from a non-baked daytime scene (single dynamic light-source), that transitions to night-time and switch the lighting and maps at night to a baked configuration. I've actually got this working already (kind of), but the main issue I'm encountering is that when the light maps change there is a frame hitch so it's noticeable.

Ideally there would be someway to smoothly transition from one lighting configuration to the other. Do you have any thoughts on this kind of use-case?

laurenth-personal commented 6 years ago

Regarding the performance, I wonder if there isn't actually a constant overhead with my tool : the lightmaps to load are referenced by an entity in the scene so they are probably always loaded. I have tested it on ps4 with a bigger level that has 6 directional lightmaps (so 12 maps) and it was fast, but I admit you can have more demanding scenarios and I haven't tested that.

Regarding the sudden switch, I have tried blending between lightmap sets but it seems right now with the tooling available in unity it's very heavy on the cpu. Probably fading from a single color to a lightmap might be a bit lighter, but I guess what you want is blending from lightprobe lighting to lightmap lighting and I don't know how to do that (because I believe that's what happens when you swich from dynamic lighting to lightmapped scene, with dynamic lighting you always have at least the skybox lightprobe affecting the ambient lighting of all your objects right ?).

wildstyle007 commented 6 years ago

Thanks for reply @laurenth-unity -- makes sense that there may be some overhead, based on your comments. That said having the lightmaps in memory is preferable (for me at least) to the cost and performance implications of loading them on-demand.

Agree on the blending, was wondering if there was a way to do it that was less intensive. I'll shelve this for now and come back to it, once my project is further along. Thanks!