guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Many mesh area lights causing impossible render times #154

Open danieldownes opened 1 year ago

danieldownes commented 1 year ago

I have an office interior with around 20 rooms. Each room has those square lights. In total there are around 500 to 600 arae lights in the building.

I've used a area light mesh for each square light, however when it comes to rendering it is taking over 1 day far and progress has been very slow, the progress bar looks like 0.2% to me... I am using a decent RTX card too (A4000).

Not sure what I am doing wrong or if this is an issue with Bakery. Settings are:

image

..you'll see I tried to bump down the scales, but after 1 day of rendering, still very little signs of progress.

For now I had to resort to Unity lightbaker which only took about 2 hours. The results are here: image

danieldownes commented 1 year ago

Note the last bake time was for a test I ran with about 200 lights. But the render time seems to be expotentially difficult, which is why even after 20 hours there was very little progress shown.

guycalledfrank commented 1 year ago

Bakery has some overhead per Light Mesh. Combining many Light Meshes in one (with many quads inside) should give you a very significant speed-up. I know Bakery should actually do it automatically! :) Will take a look this week. In the meantime, if you can send me a lightweight version of this project (without e.g. textures, scripts, etc, only geometry/lightmap density/light settings are important), that would be a nice benchmark for any changes.

guycalledfrank commented 1 year ago

So today I implemented some sort of automatic area light batching. Multiple lights having identical settings and affecting the same LMGroup list, will be combined, if their total sample count doesn't go beyond the customizable threshold (combing too many samples may result in driver being unresponsive for too long and the OS resetting it...)

If you try the latest patch ( https://geom.io/bakery/wiki/index.php?title=Github_access ) and go to Experimental settings -> Performance, you will see this new option:

image

Try baking your scene with it set to the maximum value.

I did a few tests, including rendering 500 area lights:

image

Here a non-batched version takes 7 min 18 sec to render (mostly spending time on switching between lights):

image

Batched version takes only 43 sec (note there is also other stuff off screen in this scene):

image

... which is a 10x speedup. Of course on a real complex scenes the numbers can be different, but give it a try :)