Ambient occlusion PBR

editor
viewer
3d

(Klaasnienhuis) #1

Hi,

I'm trying to set up a scene with materials which have an albedo color and a lightmap texture. The lightmap texture contains baked light and allows me to change the color on the model without having to render the lighting again.

When I do this with the classic lighting mode it works fine. In the texture dropdown for the lightmap I pick the RGB option instead of the Luminance and my lightmap is multiplied with the diffuse color. So far so good.

When I try this in PBR mode my lightmap goes black. So I look for the RGB option again in the texture dropdown, but it isn't there. Is there a special way I have to render my lightmaps to make them work in PBR?


(Stephomi) #2

Sorry, it's not possible (and I don't think it's planned either).

You have to use the albedo or the emissive channel instead.


(Klaasnienhuis) #3

Hi @stephomi,

That doesn't make sense to me. Let me illustrate.

In the classic lighting mode I use this setup. Notice the dropdown of the lightmap texture. It contains a Format setting. Only when I set this format to RGB the lightmap and diffuse are properly multiplied resulting in a good material.

This is PBR where I try to accomplish the same. I use the Ambient Occlusion channel. In this case the texture in the AO channel doesn't have the Format option and my entire shader turns black.

If this doesn't work by design, what is the purpose and correct use of the AO channel in the PBR shader then?


(Klaasnienhuis) #4

One thing I'd like to note is the fact that if I set up my shader like described here in Classic mode (where the lightmap texture mode is RGB) and then switch to PBR mode, the texture format seems to be sticky. In that case my shader looks good in the editor. But when I save my settings and exit the editor, the model looks black again.

So it seems there's a hint of this setup being supported, but it's not consistent.


(Stephomi) #5

The AO is a forced-greyscale channel.
There was a similar thread about it https://forum.sketchfab.com/t/lightmaps-pbr-is-there-a-way/6817/4.

Do you have a way to reproduce (model url, etc..)? it should be consistent between the editor and viewer.
In the shader the AO is a single component so I'm quite surprised.


(Klaasnienhuis) #6

I just reproduced it on another model using this texture as lightmap/AO map

1 Start in Classic mode (lit, not shadeless)
2 Set the diffuse to a color (I used red)
3 Switch the Lightmap channel on
4 Add the lightmap texture. Make sure it's format is set to RGB
You should have something like this


5 Now, switch to PBR (lit, not shadeless)
If it's the first time you do this, the base color should stay the same, but the AO channel is turned off. That looks like this

6 Turn on the AO channel. By default the lightmap we just added in the classic shader should be in here already.
Now you should have this result

This looks like PBR, lit mode, albedo and a working lightmap.
7a Save the settings in the editor and exit the editor.
The shader now looks very different from the one in the editor

You can also do it the other way round
1 Start in PBR lit mode
2 set the base color to a color
3 switch on the AO channel and add the lightmap
This looks like this


4 Switch to Classic lit mode (the shader is still black)
5 Open the texture dropdown on the lightmap channel. It tells you the format is set to Luminance

6 Switch the format to RGB and voila: the lightmap works again

May I ask what the purpose of the AO channel in the PBR shader is if it doesn't work. Or am I missing something very obvious?


(Stephomi) #7

The scenario 1 is working fine for me. Are you using firefox 46?


(Klaasnienhuis) #8

Yes ff 46.0. But I am using the "new" viewer. Maybe that's causing this?

When you say "Working fine". What does that mean?

And could you explain the use of the AO channel in the PBR shader?


(Stephomi) #9

The use of the AO in the PBR shader is the same as in Unity, Marmoset, UE4, etc any pbr shader.
It's just a single channel texture (luminance) that represents the ambient occlusion (so no light baking in it, just ambient occlusion).

Can you try with chrome instead please (or any other browser)?
Last stable version of firefox (46) introduced a severe bug.
Hopefully it will be fixed soon : https://bugzilla.mozilla.org/show_bug.cgi?id=1268442


(Klaasnienhuis) #10

Well, that works! In chrome I can use the AO channel normally. Also in classic mode, when I switch the lightmap channel texture format to luminance, my shader doesn't turn black anymore.
So it seems the luminance calculation is going wrong in ff 46.


(Stephomi) #11

I think the bug occurs on every luminance channel that is using trilinear filtering.
But it's best to just wait for the FF fix.