Naxela / The_Lightmapper

Fast and easy baked GI Lightmaps for Blender and Cycles
GNU General Public License v3.0
713 stars 52 forks source link

Using command-line for AWS #51

Open samevision opened 4 years ago

samevision commented 4 years ago

Hello,

I really like your addon and I would love to bake the textures with AWS to accelerate the process. Is it possible to use the command line to open the .blend file, adjust some settings like quality, filtering, .., bake the lightmap and save it as hdr?

Thanks for you me advise :)

Naxela commented 4 years ago

Hi,

I haven't tried with AWS, but it should be possible to do just that although most of it is currently undocumented.

There was another person who asked something similar, and managed to get a background rendering process working, and I'm thinking it should work too. I personally managed to get it working with Azure, so AWS should work too: https://github.com/Naxela/The_Lightmapper/issues/45

Hope it helps, feel free to ask if you've any questions

samevision commented 3 years ago

Thanks for your reply. I will try that.

In addition to that can you tell me how to prevent the lightmap from getting gray? After baking my lightmap shows clearly the shadows that are casted by the object. Unfortunately the areas where it should be white it is lightgray wherefore my whole object gets darker after applying the lightmap to it. I am using just IBL and no other light sources. I don't know if that matters.

I would appreciate your help very much.

Naxela commented 3 years ago

Hi,

If I understood you correctly, the white areas (where the RGB is 1,1,1) of your lightmap becomes grey? It's quite rare that it ever becomes fully white without extreme light values, as they're HDR lightmaps. Visually it just depends on your exposure and tonemapping settings. Can you perhaps provide a screenshot of what you mean?

Regards, Naxela

samevision commented 3 years ago

Thanks for the hint. I adjusted the scene a little bit with tone mapping and now it looks good.

I have one more question: How to deal with metals? If I set metal to 1 the lightmaps get completely black. That would be fine if roughness equals 0 and it is 100% reflective but metals with roughness are able to receive shadows. My initial approach was to set metallness to 0 to create the lightmaps and after set back to 1. Is there a better way to handle this?

Best

Naxela commented 3 years ago

Hi,

Good to hear that it worked!

As for metals, a few people have been asking regarding it as the metal becomes dark when baked with Cycles regardless of the roughness values. Currently, the way you mention is the best approach sadly, although I plan to improve this both with emissive, transparent and metallic objects with some kind of automatic detection. There have been a few improvements in the 0.4 branch (https://github.com/Naxela/The_Lightmapper/tree/0.4), although it's not working in all cases:

image

samevision commented 3 years ago

I really appreciate your fast help!

Good to know. I am already using 0.4 but these options didn't work for me. I will stay with setting metallness = 0, that's fine.

samevision commented 3 years ago

Sorry, for recurring disturbing you. I try to bake the lightmaps of multiple objects in one texture.

Do know how to fix Xatlas? Or to use my own atlas uv? Or to fix bad shadows while using atlas? Baking several textures creates beautiful shadows.

Best

Naxela commented 3 years ago

Hi,

As for the first problem with the shadows, can you provide a screenshot of what is wrong? It sounds like either too low quality settings or unoptimized utilization of the UV space (Smart UV works best if the scale is applied), but in general Blender's native options leaves a lot to be desired.

As for Xatlas, it's an external application that I haven't tested thoroughly but it should work on Linux too last I tried, not sure if there's been some breaking changes though. I'm working on implementing RizomUV support as well in the future.

As for the the Lightmap option, it refers to the Lightmap UV method, but as for using your own UVmap for lightmap this should be perfectly doable - You just need to have it named as "UVMap_Lightmap" and not have the "Remove Lightmap UV" option toggled, it should then reuse the UV for the baking as long as it has the name ""UVMap_Lightmap"

I don't really know how to fix it, but maybe mattedicksoncom can help with that, he's the repo coder: https://github.com/mattedicksoncom/blender-xatlas

But yeah, using external UV mapping tools can be an approach worth taking - I often find myself using RizomUV or 3DS max for doing UVmaps that needs more than what Blender can provide.

Hope this helps

samevision commented 3 years ago

Hi,

yes, the bad shadows are definitely caused by the uv. It seems that the shadows are overlapping into other parts of the object so they are getting black. That is only a problem while using atlas. I noticed that the smart uv map created with blender is different to the one created with TLM.

You can see it in this picture (https://i.ibb.co/ZxDwHtn/Screenshot-2020-11-11-at-18-05-01.png). There are completely black parts but they are not correct.

That's what I thought. I create an UV with third-party applications and use it for my light maps. But setting atlas unwrap method to Lightmap always crashes blender. It is loading forever. (A percentage of the process would be very nice btw.)

Naxela commented 3 years ago

Hi,

That seems strange, does that still occur if you delete the UVMap_Lightmap layer, apply object scale (CTRL+A, apply scale) and rebuild it? - The SmartUV projection shouldn't be different, as it's the exact same operator that it uses

Hi, you don't need to set the unwrap method to Lightmap, as that uses the very slow Blender Lightmap projection algorithm (which is why I can't add a percentage thing, as that would require that to be coded natively for Blender). It works well enough to just select SmartUV project, by default it should generally ignore the unwrapping process if a uvlayer named "UVMap_Lightmap" is already present

Hope it helps

samevision commented 3 years ago

Hi,

yes, my object are scaled to 1. I tested it again. It definitely creates a different smart uv and it overwrites the uv "UVMap_Lightmap".

I did this:

UVMap_Lightmap is a new one and different to UVMap.

Are you able to reproduce this issue?

Naxela commented 3 years ago

Hi,

Oh sorry, I didn't catch that you meant using SmartUV project with the Atlas packing mode. I presume you mean the pre-packing mode, which will indeed not keep the existing UV map, as what it does is that it selects all the assigned objects and simultanously unwraps them thus letting the algorithm pack it between the objects. (I should properly document this at some point)

Postpacking mode on the other hand, is actually supposed to keep the existing UV layer if present, but it currently doesn't which is a bug that I will investigate.

If I understood you correctly, what you want to have is multiple objects with custom UV maps that are then packed together with their existing uv custom maps into a single atlas?

I've referenced a specific task issue for it here: https://github.com/Naxela/The_Lightmapper/issues/52

samevision commented 3 years ago

You're right, I was using prepacking.

Exactly, I want to create a custom uv map that includes information of multiple objects and use this for a single atlas. It would be very nice if you add/fix this 👍