Today we’ve launched a new feature which we’ve been beta testing for a while.
Runtime Lightmap Generation
With runtime lightmap generation you can enable lightmap baking directly on light components from with in the editor. The lightmaps are generated in the browser at runtime so you avoid potentially costly texture downloads.
On simple scenes it seems to work great. Haven’t tried complex ones, but Sponza demo speaks for itself.
Since lightmaps are baked at runtime using special shader, it’s relatively easy to get shadowmap bias artifacts. On small shadowmap resolutions they show up as random texel noise, on big ones - as lines. But it’s fixable by tweaking bias and stuff.
Baking workflow is a little bit confusing. At first I didn’t know that ‘Bake Lightmaps’ button exists in the main menu, so I had some initial problems with everything being dark. Second, when you want to change some light and rebake, you need to have ‘Affect LIghtmapped’ checked on it, so when you go from Baked to Dynamic state for this light, you could see your adjustments in realtime. When you go back to Baked state, this ‘Affect Lightmapped’ becomes grayed out, so it may be confusing for some people. But actually, incremental lightmapping can be done surprisingly well with this approach. Add base lights -> bake -> add secondary -> bake -> add fake GI -> bake, etc.
Would be really great to have some sort of static AO calculated in the lightmapping shader as well. It’s usually possible to create a pleasing GI approximation with additional lights, but AO can’t be faked, unfortunately. Without it scenes can look bland.
Regarding #2, it always will be a trouble, for baked and non-baked lights unfortunately. So yes, tweaking bias and normal offset is the way to go.
About #3, there is a button on left panel, that has “Auto Rebake” checkbox. This might work for you, and should rebake when relevant properties and stuff is changed. Additionally you can use a hotkey Ctrl/Cmnd + B for rebaking at any time you need
And #4. Global Illumination and Ambient Occlusion are the things we really want, indeed. But in comparison to lightmaps, those will have to be baked in advance, into smaller resolution textures. GI needs way small texture size, but takes way longer to bake. We are looking into option of baking it in Editor into atlas textures, and they will be downloaded on loading times. As GI will be in atlases and way smaller resolution, it wont be that big comparing to lightmaps.
AO though, needs good resolution usually, but we always do decent R&D to find what works and what not, and trying to find best for most cases solutions. We surely will come up with something
Thanks for testing again. If you will make any cool and pretty demo, feel free to share it around!
I was thinking rather about some sort of multipass SSAO, but rendered from light’s perspective (with depth tricks and such) and then applied to visible lightmap texels. Yeah, it’s far from ideal approach, and resulting AO would be visible only in areas lit by some baked light, but that could actually work, I believe. What do you think?
As for testing - sure, will try to test it out on more advanced scenes in upcoming days!
Ambient Occlusion actually affects mostly stuff in shadow, rather than in light.
And rendering it from perspective of light, would make it probably a little bit weird, as there will be AO in corners where stuff is lit, and not in shadow.
Although visually it should be more opposite, where more AO is apparent in darker areas, while less in bright.
So we need a solution that is not light relevant, but simply global to scene and environment. That is achievable by many ways, and finding an efficient and fast approach - is a challenge we need to solve
UV1 unwrapping is still far from ideal, unfortunately. Generated lightmap was showing artifacts until I cranked the size multiplier up to 64, resulting in 512 size. Any ideas on how to deal with it?
While transitioning from dynamic to baked, there is no 1:1 parity in intensity. Dynamic lights seem to be 10-20% brighter compared to when they’re baked. Seems like it’s a downside of PBR material and it’s approximated energy conservation?
Indeed, writing proprietary UV1 unwrapper, can prove to be very very challenging some of decent 3D authoring tools do as bad job today. So our UV1 unwrapper is just a convenience feature. If project has an artist, they will unwrap it for best results.
Is it related to actual light information, or that specularity is not yet available for lightmaps, so in dynamic you have specularity and in baked not, so it looks different.
I can see very subtle difference, will have to look a bit closer to that.
And BTW, it is always better to supply AO map as separate texture, as it is mixed with light and specularity in a different way, affecting it more in a PBR manner.
Regarding ETA for specularity. We generally hate of giving dates, as it limits our abilities for striving for high quality, which requires extra time investment and effort. So this is something we are already working on and will be released as soon as quality and results are satisfying. We are talking weeks/months here, not too many though