Naxela / The_Lightmapper

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

Lighting seems to only get baked on some objects #59

Closed rienheuver closed 3 years ago

rienheuver commented 3 years ago

Still working on my maze, making progress. I added an object that has some emitting texture. The first screenshot below is of the 'Material Preview' after building the lightmaps. The second screenshot is the 'Rendered' version (using Cycles). Why is it that the light appears so clearly on the floor but not on the walls? The zip below contains the blend-file. scene.zip

Screenshot from 2020-12-26 00-34-52 Screenshot from 2020-12-26 00-35-09

Thanks again for your amazing work on this plugin, it's awesome!

Naxela commented 3 years ago

Hi,

Sorry for not replying sooner. The problem with the material preview is that you it uses it's own internal hdri maps for the specular reflections if you don't toggle on scene world in the viewport settings panel:

image

The way Eevee and the Cycles render works in terms of light ranges are different (Eevee is generally much darker with the baked results), and I generally recommend using emission nodes with values over 1, as they otherwise get very dark when cycles bakes the lightmaps. In your case, I would perhaps also use 512 resolutions or maybe 1024, as the denoiser smudges out the lighting instead in that case.

Also, a lot of the light you see is actually specular lights (reflections of the light, rather than diffuse contribution) which isn't baked by the lightmapper. In order to see these in Eevee/Material preview, they need to be toggled on in the viewport panel mentioned above (Scene lights)

I hope this helps

rienheuver commented 3 years ago

Thanks again! I'll try it out later to see if that changes. Does that have effect on the gltf-export too? Because the export I currently have looks exactly like my current material preview.

rienheuver commented 3 years ago

Hey Naxela,

I just checked with my scene again: the emission strength on the lights is way higher than 1; it's actually 54.9. I also changed the 'Scene World' lighting and upped the resolution to 512. However, the lighting is still only visible on the floor and not on the walls. I understand that a lot of the lighting you see in Cycles-mode is because of reflections, but surely there should be some lighting on the walls directly right?

Thanks either way of course for your help again. If you can point me in the right direction to get more lighting on the walls I would be very grateful!

rienheuver commented 3 years ago

I did some more testing today and it indeed seems like it will only bake some models. It depends on the position of my lamp whether or not it is baked into the texture. But not in a way that would make sense to be honest. Below is two pictures: in the first one the light is baked onto the walls as you can see, but it is not baked on the floor. In the second one it is baked on the floor, but not on the walls. The only difference is the position of the lamp. I simply lowered the lamp a little bit so it would be below the top edge of the wall. I also attached the blender-file to this comment so you can have a look for yourself if you want: scene.zip

If you could help me find an explanation that would be great. If there is things I can change to make this work or at least try out I would love to hear it. Please let me know and thanks again for the great plugin!

image Image above: light baked on walls (not floor), lamp is slightly higher than the walls Image below: light baked on floor (not walls), lamp is slightly below the top edge of the walls image

Naxela commented 3 years ago

Hi,

I experimented a bit with your scene and the biggest issue seems to be UV-utilization, in general when you see your UV-maps you have to imagine how many pixels can fit within that specific face:

billede

In case of your walls, the UV-face for the wall-side was flat, which I imagine was because it was extruded upwards after the UV-map was already made (the one called UVMap_Lightmap):

billede

In general, carefully trying to optimize the UV maps is quite the most boring part of it all, but it can be rewarding to experiment a bit with the various automatic UV mapping algorithms, for instance with your square walls the "lightmap" option worked best:

billede

As for the emission, I think it's because I'm using Blender 2.83 LTS (which I generally recommend, but doesn't have the newer principled bsdf emission thingy), but the addon should support 2.9+ just fine

billede

A few other tips:

I've uploaded the scene with some of these changes:

billede

scene2.zip

I hope this helps :) - The lightmapper can have a bit of a steep learning curve with a lot of yet-undocumented features and issues, so feel free to ask

rienheuver commented 3 years ago

Hey Naxela,

Thanks for the elaborate response, that's awesome! My experience so far with UV maps is very minor, so a fuck up on that end would definitely explain a lot. My assumption was that the UV-maps would be regenerated whenever I would bake the lightmaps and/or clear the lightmaps.

Either way, I just experimented with some of your suggestions and the results are already so much better than what I had! Thanks a lot! Deleting faces the player will never see was a very logical but good point, that saves a lot of unnecessary space. I don't yet know how to manually improve the UV map, so I'll have to look into that if I want the results to improve further.

I ran into some other problems as well, so I'll try to figure that out later and if I can't get it to work I'll let it know. Thanks again for the great help and the wonderful plugin!