Elephant in the room: how to handle Specular while baking textures?

(Rezzy777) #21

PS: how do you quote someone’s comment on this forum? :grimacing:

0 Likes

(polygonsoul) #22

No, you can capture the color bleeding as well: simplest solution is to bake light & texture into one combined map, but this is for most cases not clever because texturemaps like wood/marble with high frequency detail need normally a way higher resolution than lightmaps…

There are methods to capture the color bleeding more efficiently, but it would be easier for me to help if you would post some screenshots of your project.

Lightbaking helps to reduce rendertimes, BUT it is considered as time demanding (preparing assets/UVs) and will cost additional RAM (Lightmap-textures) during rendering, so in times where you can rent an amazon server with cinebench score 5500 for 1,5-3$ per hour think twice about baking.

Quoting works copy and past and then use the " - Blockpost-Item from the texteditor header bar!

0 Likes

(Rezzy777) #23

There are methods to capture the color bleeding more efficiently, but it would be easier for me to help if you would post some screenshots of your project.

I just started a test project. Left is the original (with the Principled BSDF node) and on the right is the test object which should look about the same (but then with light mapping as you explained earlier).

I baked a 32 bits texture, btw.

0 Likes

(CarlG) #24

I wouldn’t worry too much about it if you don’t know about it. In my experience, it goes like this:

  1. In order to reduce noise, I turn off specular caustics.
  2. This reduces the energy bouncing around, making the image darker.
  3. So I compensate for that by increasing lighting, add fake lighting, or adding some value to primary surfaces.
  4. That due to this, only the diffuse part bounces light around, and that carries with it color information. And this color information is increased, while the glossy contribution which reflects white light is lacking, meaning the saturation of the bounced energy is increased - more color in the bounce than it should be.
  5. The super strong brightness of the sun is more likely to cause strong bleeds than just using the sky, as the sky also causes a lot of direct light rather than mostly just indirect (for interiors). For noise reasons alone, I prefer not having to deal with the sun if I can.

My hacks:

  1. Bright up the brightness with some AO.
  2. Reduce saturation of bounced diffuse using a final node group doing: If seen by diffuse ray, then use a diffuse only shader with a slightly desaturated version of the albedo color.

And no, these hacks aren’t about being physically correct. They’re hacks I use to compensate for a deliberate reduction of physically correctness as deadlines dictate :smiley:

I haven’t investigated much baking lights into textures, as I usually don’t have time to mess around with UV creation, and my projects keep changing.

As for baking texture generators, it’s something you might want to do if the node setup gets very complex to the point where shader compiling even starts to hurt, or when you use multiple generators with a high detail level - which, unfortunately, most youtube tutorials seem to do without thought. Also, you may setup a triplanar mapping that looks great, but it won’t deform onto an animated object unless you bake out the textures using proper UVs (I don’t animate, so I don’t have to). And of course there is mixing of various normal maps to a new normal map or converting bump information into normal map (fairly advanced stuff). So yeah, there are plenty of reasons to do it, but it’s normally something I don’t have to bother with. Oh, and the most obvious one (which I fail at), is baking high detail poly mesh into normal map for use with low poly mesh.

0 Likes

(Rezzy777) #25

Thanks, CarlG! It finally starts to dawn on me! :smiley:

0 Likes

(Rezzy777) #26

Do you use a ColorRamp node after your bake? I noticed that the baked light map doesn’t contain 100% white, so to get the original bright color (red) back I think I might need a bit more white in the multiplied light map…

Would you mind sharing one of your node setups? Even a test project will do… :wink:

0 Likes

(polygonsoul) #27

Here is a test file with packed lightmaps:

On Layer 1 (off) is the original scene, to make it render you need to turn off Layer 2, enable the sun and make the sky visible for diffuse etc. again (world>ray visibility>diffuse tec.) Turn up samples to 256.

Layer 2 is the baked scene, Sun is not enabled, Sky is here only visible for glossy. With 16 spp you should already have nice antialiasing and perfect reflections will look good at even lower sample counts, the more you increase the roughness parameter the more samples you will need.

Your node setup looks good, but you need to change the lightmap to non-colour data.

Some general advice for baking, Clamping direct/indirect will not be respected, denoising does not work and combined gpu+cpu rendering is broken or did never really work…

0 Likes

(CarlG) #28

Can’t help with that right now, my project is still rendering.
Sorry, I ment that as a reply to Rezzy777.

0 Likes

(Rezzy777) #29

Thank you, I will definitely look into that!

My little test project also started to work for me. You were right, I needed to switch to Non-color data! :wink:

When baking, what options do you check? I currently have ‘Direct’, ‘Indirect’ and ‘Diffuse’ checked. Is that enough?

0 Likes

(polygonsoul) #30

Yes, that´s all you need for the diffuse part!
Remember to switch off your lights before you render your baked scene :slight_smile:

0 Likes

(Rezzy777) #31

How do I set the quality of the light map? With samples? Or though the resolution of the light map?

0 Likes

(polygonsoul) #32

Both, common practice in game dev is to render really large lightmaps with lower (not lowest!) sample count then denoise when necessary and downscale factor 2-4, but it really depends on the visual fidelity you want achieve for lighting…

If you have small detail geometry and want to cast fine shadows on clean white walls you will need larger resolution and more sample, if you have an overcast lighting and lots of textured surfaces, you will find out that you can get away with way smaller lightmaps than you would think…

0 Likes

(Rezzy777) #34

Since a light map apparently is just about light information, can you also use it for glass? :thinking:

0 Likes

(polygonsoul) #35

For glass-objects you want to have view-dependent shading characteristics, like transparency, translucency, reflection and refraction, which are rendered for every new single frame, Realtime or offline… Lightmaps for Glass-objects do not really make sense.

0 Likes

(Rezzy777) #36

Got it. When you explain it like that, it’s quite logical indeed :wink:

How about Translucency? I mean, that’s an effect that appears to alter shadows (make them lighter) and thus has some influence on lighting. Do you add this as a baked texture on top of a Lightmap?

0 Likes

(Rezzy777) #37

Is it correct that, in order to use Lightmap baking for a scene, I am obliged to bake the entire scene for it to have the best effect?

I mean, you advised to disable lights after baking, but that means objects which weren’t baked (and thus are missing Emission) aren’t lit anymore… :thinking:

0 Likes