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

Alternative workflow for non-static scenes #11

Closed tantzygames closed 5 years ago

tantzygames commented 6 years ago

Thank you very much for this tool.

My requirements were different to your use case so I did things differently. I needed the same lighting conditions but with a dynamic map. I outlined my steps and the outcome on the Unity forum: https://forum.unity3d.com/threads/doom-e1m1.488128/

It would be great if this could be incorporated into your instructions, and maybe also your thinking for future development

laurenth-personal commented 6 years ago

Hi, I haven't read through the whole thread yet, but your use case it the door opening right ? you want to interpolate between a lightmap door closed and a lightmap door open ? Instead of switching the lightmaps, you could use a custom render texture as lightmap, and that custom render texture would evaluate a shader that blends between the different lightmaps corresponding to your different states. This is something I've been thinking about but I didn't really need it so I didn't spend time on it. If that's indeed what you need let me know and maybe I can draft an example.

tantzygames commented 6 years ago

Absolutely! That was going to be my next experiment, because of the limitation of sudden swapping (you need to hide the transition). It would be amazing if you were able to put something together as a starting point.

laurenth-personal commented 6 years ago

I've been giving it a go yesterday in a very rough test. It's definitely doable but the performance are not great on the CPU because you cannot use a render texture as lightmap out of the box, you have to render it into a texture 2D, and that's quite costly. I have to investigate why we cannot use the render texture as is in the lightmaps array.

tantzygames commented 6 years ago

Ouch, yes indeed. It would be great to have the flexibility to use render textures as lightmaps.

Thanks for the update :)