Asset store link:
https://assetstore.unity.com/packages/tools/level-design/bakery-gpu-lightmapper-122218
Link to RTPreview plugin for Bakery: https://assetstore.unity.com/packages/tools/level-design/bakery-real-time-preview-164462
Hi everyone!
I’m really excited to announce that I’m going to release the GPU lightmapper I was working on (for quite some time) on the asset store
It’s called Bakery. Because why not.
My aim is to create a production-ready, hassle-free, flexible solution that I would like to use myself. I was rendering lightmaps all my life - in 3dsmax default scanline, in Vray, in Beast, in Enlighten and so on, and I never was fully satisfied with the results and flexibility.
Or maybe reinventing the wheel is just my hobby.
The focus of the project is:
- Getting rid of all baking artifacts (seams, leaks, noise…).
- Baking very customized lightmaps and mixing/switching them at runtime (e.g. any combination of direct/indirect/shadowmask/RNM/etc).
- Getting physically accurate results. For that purpose I carefully compared it against Mitsuba using it as reference (fun fact: Unity’s default light falloff is fake and not physically correct).
- Getting maximum baking speed without going noticeably fake.
The focus of the project is NOT:
- Any kind of real-time GI. I’ll leave it to others.
Anyway, here is the list of features already implemented:
- Global illumination.
- Light sources: directional, sky (color and HDRI), mesh (any shape and texture), IES, spot (any cookie texture), point.
- Materials: supports albedo, opacity and emission textures/colors.
- Baking direct/indirect/mixed lighting.
- Baking shadowmasks.
- Baking ambient occlusion.
- Supports directional baking (bump/specular) with 4 modes: dominant direction (compatible with most shaders), Radiosity Normal Mapping, per-pixel spherical harmonics, as well as simply baking normal maps to diffuse.
- Denoising, based on Nvidia’s amazing AI Denoiser.
- Automatic fixing of UV seams on smooth surfaces and various lighting leaks.
- Can bake lighting to 3D textures as well.
- Baking Light Probes.
- Automatic atlas packing + UV padding adjustment.
- Bicubic lightmap filtering shader (can be patched to all default/custom shaders).
- 2 lighting falloff modes: Unity-like and a realistic inverse-squared one. Also ability to patch default shaders to make Unity use inverse-square.
- Mesh and terrain support.
- Can also bake lighting into vertex colors.
- Lightmapped prefabs.
Workflow is already pretty smooth - you just add Bakery light components to lights, mark stuff Static as usual, and hit Render.
As for baking speed, it’s already quite faster than Enlighten and Progressive (at least in 5.6 and on GTX1060).
Features to come soon:
-̶ ̶G̶I̶ ̶f̶r̶o̶m̶ ̶c̶u̶s̶t̶o̶m̶ ̶s̶h̶a̶d̶e̶r̶s̶.̶ [Added in v1.1]
-̶ ̶S̶h̶a̶d̶o̶w̶m̶a̶s̶k̶ ̶s̶u̶p̶p̶o̶r̶t̶.̶[Added in v1.2]
-̶ ̶L̶O̶D̶ ̶s̶u̶p̶p̶o̶r̶t̶.̶ ̶[Added in v1.3]
-̶ ̶D̶i̶r̶e̶c̶t̶i̶o̶n̶a̶l̶ ̶l̶i̶g̶h̶t̶m̶a̶p̶s̶ ̶s̶u̶p̶p̶o̶r̶t̶ ̶(̶b̶u̶m̶p̶,̶ ̶s̶p̶e̶c̶u̶l̶a̶r̶)̶.̶[Added in v1.4]
-̶ ̶A̶ ̶n̶e̶w̶ ̶l̶i̶g̶h̶t̶ ̶p̶r̶o̶b̶e̶ ̶s̶y̶s̶t̶e̶m̶.̶ [Added as BakeryVolumes in v1.8]
- Runtime switchable/blendable lightmaps support.
- ̶̶̶P̶̶̶r̶̶̶e̶̶̶v̶̶̶i̶̶̶e̶̶̶w̶̶̶ ̶̶̶c̶̶̶a̶̶̶m̶̶̶e̶̶̶r̶̶̶a̶̶̶ ̶̶̶p̶̶̶a̶̶̶t̶̶̶h̶̶̶ ̶̶̶t̶̶̶r̶̶̶a̶̶̶c̶̶̶e̶̶̶r̶̶̶.̶̶̶ [Added as a separate asset]
Currently it only works on Nvidia (GeForce 6xx or newer) / Windows though, because it’s based on OptiX/CUDA/D3D11 code. If there will be demand, I’ll look into widening the platform support.
A̶n̶o̶t̶h̶e̶r̶ ̶p̶r̶o̶b̶l̶e̶m̶ ̶i̶s̶ ̶v̶i̶d̶e̶o̶ ̶m̶e̶m̶o̶r̶y̶ ̶u̶s̶a̶g̶e̶.̶ ̶C̶u̶r̶r̶e̶n̶t̶ ̶G̶I̶ ̶s̶o̶l̶u̶t̶i̶o̶n̶ ̶c̶a̶n̶ ̶e̶a̶t̶ ̶t̶o̶o̶ ̶m̶u̶c̶h̶ ̶m̶e̶m̶o̶r̶y̶,̶ ̶a̶n̶d̶ ̶I̶’̶m̶ ̶g̶o̶i̶n̶g̶ ̶t̶o̶ ̶d̶o̶ ̶s̶o̶m̶e̶t̶h̶i̶n̶g̶ ̶a̶b̶o̶u̶t̶ ̶i̶t̶.̶(fixed) Having more than 2 GB VRAM is advised (but not required, it works on 1 GB with smaller scenes).
Here I’m just posting updates and pics. I’m also interested in what you guys think about this kind of project, what you were missing in built-in lightmappers, and what you’d like to see
Documentation: https://geom.io/bakery/wiki/
FAQ
Q: Does it have realtime GI?
A: No.
Q: What about mixed lighting?
A: Yes! Bakery supports baking indirect separately to use with real-time lights, and also baking static shadows (shadowmask) and combining them with dynamic.
Q: I can’t get shadowmask to work
A: Check following things:
- Bakery’s Render Mode is set to Shadowmask
- Masked lights have both Unity and Bakery light components on them.
- Masked Bakery light components have “shadowmask” checkbox enabled on them.
Q: I rendered shadowmasks, but all shadows are dynamic
A: You’re in Distance Shadowmask mode, it’s expected
- Read about the difference:
Unity - Manual: Lighting Mode: Shadowmask
Unity - Manual: Lighting Mode: Shadowmask - To switch between two modes, you can use “Distance Shadowmask” checkbox in Bakery main window.
- If you’re on 5.6, go to Window->Lighting->Mixed Lighting->Lighting Mode to switch the mode.
Q: What about bump/specular in shadowed areas?
A: Yep, use directional lightmaps for that. Setting “Directional Mode” to “Dominant Direction” would be the most straightforward way, but also read the manual about other modes (RNM and SH) and check the example scenes to see what’s best for you
Q: How do I make a lightmapped prefab?
A: Use the Lightmapped Prefab component.
Q: How do I use git/collab/other version control system with Bakery?
A: Since v1.45 it should Just Work. However, if you are using Unity 5.x, you might need a few extra steps. Also you don’t need to commit Bakery folders, only your own project files. Refer to the manual for details.
Q: How do I bake using my own UVs without any alterations to them?
A: Read about Lightmap Groups in the manual.
Q: Which platforms are supported?
A: You can ship games with Bakery lightmaps on any platform. But for using Bakery you will need a 64-bit Windows (7+) machine with a Nvidia (6xx or newer) card.
Q: Is it progressive? Does it show lightmap updates in real time?
A: No. Just a progress bar.
Q: How do I share a scene with someone who doesn’t have Bakery installed?
A: Apart from the scene and its lightmaps you also have to include a few scripts, namely:
- ftLightmaps.cs
- ftLightmapsStorage.cs
- ftLocalStorage.cs
- ftGlobalStorage.cs
- ftModelPostProcessor.cs
Q: Denoiser throws error 505.
A: Update the drivers.