Unity: Realtime Lightmap Blending Tool

Опубликовано: 29 Октябрь 2024
на канале: HULUSI
1,112
16

I made a tool that grabs two sets of lightmaps (or more) made for a scene and then creates an interface that allows the smooth blending between two different lightmap data. Blending can be done in the editor and also on runtime.

The user has to bake the lightmaps, use my interface, and be done with the effect; ready-for-use.

Important notice:
Having objects grouped as one mesh is important as the tech works with dedicated materials requiring meshes to have the same tiling X-Y and offset X-Y (UV2). Meaning: if there are 30 unique objects, there will be 30 unique materials generated for each... Mobile devices wouldn't like this idea.
If there are several groups of objects, static batching will interfere with the bake-blending tech(your results will be glitchy on play mode). Therefore, objects cannot be statically batched if this tech is used. (yet another reason to import objects as batches from 3DS Max, Maya etc.)

The optimal use case is:
4-5 groups of objects imported from a modeling software together ( all trees are imported as one object let's say). OR, they can be baked into one mesh in Unity with MeshBaker(?)
None of the meshes affected by this tool can be static-batched atm.
No special shaders can be used on baked objects because the tool works with its own shaders ( my shader can be edited for particular cases though)

+++ Shader itself requires a couple of adjustments (to reduce the over-exposure situation)


music:
Rafael Anton Irisarri ‎– A Fragile Geography