Bakery - GPU Lightmapper (v1.96) + RTPreview [RELEASED]

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:
https://docs.unity3d.com/Manual/LightMode-Mixed-Shadowmask.html
https://docs.unity3d.com/Manual/LightMode-Mixed-DistanceShadowmask.html
- 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.

3531261--282964--fdlm.jpg 3531261--282965--ftareafixed.jpg 3531261--282971--ftprobes.jpg 3531261--282972--texarea.jpg 3531261--282973--image_2018-06-06_00-18-19.jpg

26 Likes

IES lights example:

3531510--283026--fties.jpg

8 Likes

Wow. Can't wait to use it!
Great work !

There is the possibility to join the beta?

3 Likes

"Render selected" button, as well as only re-baking certain lights."
Yes please!

Can´t wait for it!

2 Likes

Both my current projects use realt-time GI for now, and we do the same at work, but I’m willing to test most things at work so we’ll most likely be purchasing this, because it looks great!

[quote=“guycalledfrank”, post:1, topic: 704890]

  • Getting rid of all baking artifacts (seams, leaks, noise…).
    [/quote]

My main question is, how is one person able to do what several large corporations have failed to? Are you a genius? :slight_smile:

5 Likes

Fantastic idea, count me as a sale!!!

1 Like

Thanks everyone!

Well, it’s almost done. I’m thinking of releasing the beta for a cheaper price (think early access) and then improving it over time with final version being more expensive.

[quote=“Cascho01”, post:4, topic: 704890]
Can´t wait for it!
[/quote]
I should mention that at the moment it doesn’t render exactly only selected objects. It renders texture atlases to which selected objects belong. But other atlases are not updated.
Also I didn’t mention, but I have a special component to manually put objects into their own named lightmaps, if automatic atlases don’t suit you or when you want to switch lightmaps on certain objects. When you actually use it, current Render Selected is more useful.
I will eventually update this feature to only update parts of atlases.

Also, other limitations of the current version (which I’m going to fix though):

  • //No Terrain support yet. [EDIT: terrain support was implemented]
  • No SpeedTree support yet.
  • No customized shader albedo/alpha/emission support yet. Color/alpha/emission are taken directly from material’s colors/textures (using the same naming convention Standard shader uses).

[quote=“eobet”, post:5, topic: 704890]
how is one person able to do what several large corporations have failed to
[/quote]
Too much free time.

5 Likes

[quote=“guycalledfrank”, post:7, topic: 704890]
… I have a special component to manually put objects into their own named lightmaps, if automatic atlases don’t suit you or when you want to switch lightmaps on certain objects. …
[/quote]

Great!
(Never understood why Unity didn´t so…)

By the way, here is the current state of UI:

3532843--283199--ftui1.jpg
3532843--283200--ftui2.jpg
3532843--283201--ftui3.jpg
3532843--283202--ftui4.jpg

1 Like

Terrain support was easier than I thought, finished in a day :)

3533418--283290--ftterrain.jpg
3533418--283291--ftterrain2.jpg

4 Likes

hello,
Can support with asset bundle?

nice! can't use it yet as I'm on a mac, but watching where this goes! very well done!

1 Like

[quote=“TechnicalArtist”, post:11, topic: 704890]
hello,
Can support with asset bundle?
[/quote]
Good point, didn’t test that yet. Will see if it works.

1 Like

And its compatible with U5.6, i guess :)

[quote=“guycalledfrank”, post:13, topic: 704890]
Good point, didn’t test that yet. Will see if it works.
[/quote]

Thanks

[quote=“sledgeman”, post:14, topic: 704890]
And its compatible with U5.6, i guess :slight_smile:
[/quote]
Yes. I’m working on 5.6 myself. Also testing it on latest 2018.

1 Like

I think a fair amount might end up with the 2017.4 LTS versions too.

For sure if you can make it work with 5.6 2017 and 2018 obviously the best :-)

I don't have the numbers but i would assume the majority are 2017.4

Am very excited about this! I have a feeling this can make you lots of $$$!

2 Likes

Here are some pics of the automatic UV seam fixer results:

3534315--283387--uvfix.jpg 3534315--283388--uvfix2.jpg 3534315--283389--photo_2018-06-11_14-12-56.jpg

8 Likes

Hi, I am working on a game where a house is generated at runtime, and I was look for something like this to bake my scene and improve the performance. If you need a tester or any kind of help, please contact me. I will be very happy to contribute to your project

[quote=“hugopok”, post:19, topic: 704890]
Hi, I am working on a game where a house is generated at runtime, and I was look for something like this to bake my scene and improve the performance. If you need a tester or any kind of help, please contact me. I will be very happy to contribute to your project
[/quote]
Hi hugopok. If it’s generated at runtime, high quality lightmapping won’t work. It still takes from a few seconds to several minutes to bake a scene (depending on complexity), and my particular solution also requires specific Nvidia hardware. So it’s not really a good idea to run it on a player’s machine, it’s more about using it by devs for static maps.

1 Like