Jump to content
  • 0

Can someone explain PBR Occlusion/Metallic/Roughness to me like I'm a Golden Retriever?


Qie Niangao
 Share

You are about to reply to a thread that has been inactive for 196 days.

Please take a moment to consider if this thread is worth bumping.

Question

So I read this part of the "PBR Materials" page in the SL wiki:

Quote

Occlusion [R] / Roughness [G] / Metalness [B]

This texture is composed of 3 unrelated grayscale images stored in 3 different color channels of an RGB texture.
[R]: (Ambient) Occlusion is lighting data, removing the need to bake down shadows on to the Base Color map.
[G]: Roughness data ranges from 0 to 1.0, but the actual range of physical surfaces ranges from approximately 0.05 to 0.985. No surface is perfectly smooth or completely rough. The rougher a surface is the less mirror-like it behaves.
[B]: Metalness values are mostly black or white. Either the material is a conductive metal like copper, or it’s a non-metal like fabric. 0.0 is Non-Metallic, 1.0 is Metallic. There are almost no materials with gray metalness values.
The alpha channel is ignored, as per the glTF 2.0 specification.

which put some idea in my head of how it works and I wanted to test it, so I made this texture:

image.png.6f7bf416454d612f5016d36f832c1b99.png (the right half is full alpha but has RGB channels too)

and tried painting it on the Materials/Roughness glTF Material of a purple-tinted cube and lighting it with a projector and I saw this:

image.thumb.png.d5fa322814a3995150c170859c43b376.png

The alpha channel had no effect, exactly as expected from the spec, so that's cool. And I can understand the red channel's "occlusion" effect: the unlit side is still visible, corresponding to the glTF spec text: "The red channel of the texture encodes the occlusion value, where 0.0 means fully-occluded area (no indirect lighting) and 1.0 means not occluded area (full indirect lighting)." That's informative for me because I'd naively thought of Ambient Occlusion as a shading effect, when it's kind of the sign-reversal of that. So far, so good.

But I didn't expect what this shows for roughness (green) and metallic (blue). What I expected was the blue area very shiny and reflecting projected light as purple, the color the base color is tinted, or white, the base colormap itself. Instead, that part of the surface is black. The green "roughness" channel seems to slightly lighten the surface color where lit, but barely detectable…

… until I line up the lighting just right to really see the specular "shine" itself, and then I get some effect of both roughness and metallic, but with a strange roughness outline effect I don't understand:

image.thumb.png.f1ef2e30a39ec9b28c41e5c32a8e8dac.png

Here the blue/metallic channel does show the specular lighting reflection as a kind of purple glow, and the green/roughness channel looks completely matte to that specular lighting, so I guess that's just what metallic / roughness means. But the edge of roughness (both pure green and the green-inclusive white "alpha ->" text) shows that white outline when lit and I don't know how to think about that.

  • Thanks 1
Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0
5 hours ago, Qie Niangao said:

I get some effect of both roughness and metallic, but with a strange roughness outline effect I don't understand

This may be related to your text having anti-aliasing on it, which causes different Roughness values for the outline. Not exactly sure why it shows up like that visually, though.

image.png.a5db87c4e6b95bc32d87e7b43acd47cc.png

Edited by Wulfie Reanimator
  • Thanks 1
Link to comment
Share on other sites

  • 0
3 hours ago, Qie Niangao said:

But I didn't expect what this shows for roughness (green) and metallic (blue)

Roughness is EXACTLY the same as the Specular Tightness system in ALM Materials with a glossyness number modified by an alpha channel in one of the materials maps, it controls the tightness and brightness of specular highlights.

LOW values give soft, diffused highlights, which since the specular colour is fixed as "white" iin PBR, tends to lighten the whole damn surface, you are literally giving the surface a thin translucent coat of white paint.

HIGH values give smaller tighter specular highlights, a bright glossy spot on the surface.

REAL PBR allows custom specular colours, so you can tone down the white paint effect with a gray specular colour, or do fancy fabrics that have weird metallic style specular that do not match the diffuse, like some velvets, black cloth with red specular, for example.

 

LL's cut down PBR,  last I heard, doesn't allow this.

 

Metalness, is a simple on off system. Black areas mean the surface is NON metallic, and uses a Plastic shader so any specular highlights will be greyscale (ie white), and white areas mean it's a metallic surface, and uses a Metallic shader, so any specular highlights will be tinted by the diffuse colour of the metal, that PBR calls 'ambient map".

Simple version:

Mettalness map black, gold coloured plastic with white highlights.

Metalness map white, gold coloured metal with golden highlights.

 

Link to comment
Share on other sites

  • 0

That's an interesting observation. Perhaps intermediate "roughness" reflects more light somehow.

I thought I might learn something relevant to that hypothesis using this texture I made with overlapping green and blue gradients:

image.png.b47dd9e1df30040a02c12907ce3c4e05.png

which kinda worked in the sense that the green side was definitely less shiny or "rougher" than the non-green side:

image.png.7cb27076ceaffbf2f5f027953963eec0.png

They said that metallic is pretty much all-or-nothing in practice, and I'm not sure how to go about even looking for intermediate metalicness effects.

Fiddling with lighting and camera, I got the metallic lighting flare in the base color like before, but this time observed a darkened outline effect for metallic:

image.png.b626d7e85be8ca48f3f2dbf4b3c3b519.png

The "B" is on the side with minimal (green-coded) roughness, and you can see it's pretty shiny up there (and naturally the black lettering itself has no roughness), and the metal characteristic hue-matching of the flare is visible on the (blue-coded) metallic part but reverts to white on the lettering. That part all makes sense, but that black outline of the "B" is as mysterious to me as the white outline of the "G" (as before) :

image.png.92fbd456f8e8d1dcd58f070713b62cf9.png

What I don't see are similar darkening and brightening effects of intermediate metallic and roughness values across the gradient. The outlines seem like a contrast effect of some sort, but maybe it's all based on some physics of light scattering on the surface. I have to say, having sniffed around Appendix B of the glTF spec, I don't think this Golden Retriever has the nose for decades of the Cult of SIGGRAPH Archives.

Link to comment
Share on other sites

  • 0
21 hours ago, Wulfie Reanimator said:

This may be related to your text having anti-aliasing on it, which causes different Roughness values for the outline.

I don't know why I did the whole thing with the metallic and roughness channel gradients when I could have tested the theory directly:

image.png.0a70ac4092a6f7825bc81f9f7a7c5025.pngimage.png.94ee49e26df0a9fb28b9b961e0f15ff6.png

So the outline depends on there being different adjacent values, not on intermediate values.

Also, a little more testing convinces me that the black outline I saw at the metallic (blue coded) transition was actually just this roughness transition where there was a hint of green even in that supposedly blue corner of the crossed gradients. I can't replicate the dark outline with pure blue/black transitions, and when there's that hint of green the dark and bright outlines are the same areas on the surface, showing dark or light depending on angle of specular lighting and camera.

The only reason I'm obsessing about this outline thing is that, because it's so stark, there must be something basic I'm not understanding.

Link to comment
Share on other sites

  • 0
1 hour ago, Qie Niangao said:

there must be something basic I'm not understanding.

Looking at the pictures, showing specular tightness/roughness, and plastic vs metallic shaders not performing as expected, I'm guessing the missing element is :

 

"LL's cut down implementation of Basic PBR is a buggy kludge coded hot mess, that's NOWHERE near ready for rollout"

 

Link to comment
Share on other sites

  • 0
2 hours ago, Qie Niangao said:

The only reason I'm obsessing about this outline thing is that, because it's so stark, there must be something basic I'm not understanding.

Blender PBR shader agrees with SL PBR: white text on black, white-to-black gradient below, mapped to roughness channel on a blue cube. The outlining happens on aliased text as well because SL texture sampling is always linear (i.e. blends pixels) so intermediate values always exist. In real life you could make the transition between the roughness levels arbitrarily small, but when you're on a texture you're limited to the texture's resolution and higher resolutions make the transition band more narrow. Being able to specify nearest neighbor sampling per texture in SL would be neat, but don't hold your breath I guess.

image.png.67a6f8f506bb816acd53e06c561b247c.png

Now, let's dissect how roughness looks at the exact same conditions:

image.png.8b9075ea59baacb3071122f3b98b1bac.png

As you can see the intermediate values *are* supposed to look brighter than the extremes when the angle of lighting doesn't change (I'm sure some physicist can explain precisely why better than I, but my guess: absolutely high roughness absorbs more of the diffuse light, hence appears darker) but there certainly doesn't seem to be a bug present unless the PBR material standard itself is broken which is quite unlikely.

Edit: one last comparison, plain old diffuse-normal-specular glossiness (so the texture is inverted and mapped to normal map alpha instead) in SL does the same:

image.png.1ec204a56989d52216b438a735d84d4d.png

Edited by Frionil Fang
  • Thanks 1
Link to comment
Share on other sites

  • 0
4 hours ago, Qie Niangao said:
4 hours ago, Wulfie Reanimator said:

 

Done. Seems way more likely that I don't know what I'm doing than there being an actual bug here, but we'll see.

You probably want to try assembling a glTF and viewing it in a reference viewer, such as -

Those should give you a preview to a correctly rendered glTF. If these also display the same, then SL is doing things correctly.

3 hours ago, Zalificent Corvinus said:

"LL's cut down implementation of Basic PBR is a buggy kludge coded hot mess, that's NOWHERE near ready for rollout"

This isn't true - the actual PBR implementation is based on a reference PBR implementation adapted for use in SL's rendering pipeline, so it's fairly predictable with PBR content. A lot of bugs came out due to SL's handling of assets (normal maps being compressed) and old rendering paths (old meshes don't retain tangents, normal map space was Lengyl instead of Mikkt which most programs use) - Those issues have been addressed, but the tangents issue is something that can't be fixed retroactively (as the uploader on non-PBR viewers stripped tangents at upload time, and the viewer would reconstuct them as a box), so some older content might not look 100% accurate to a rendering in Blender or Substance until the mesh is reuploaded.

  • Thanks 3
Link to comment
Share on other sites

  • 0
5 hours ago, Frionil Fang said:

Blender PBR shader agrees with SL PBR: white text on black, white-to-black gradient below, mapped to roughness channel on a blue cube. The outlining happens on aliased text as well because SL texture sampling is always linear (i.e. blends pixels) so intermediate values always exist.

I guess without really thinking about it, I'd figured that roughness would apply at the pixel level of the image source. Now I suppose that's nothing like how stuff really gets rendered.

Your observation that Blender sees it the same way, and even the pre-PBR SL does too, convinces me that it's not a bug. If we use tools to create these maps rather than trying to manipulate them directly, probably there's no need to understand the physics behind the effect.

2 hours ago, Jenna Huntsman said:

You probably want to try assembling a glTF and viewing it in a reference viewer…

Thanks, I can see that would definitively confirm it one way or another. I'm afraid it's just all beyond this Golden Retriever.

Link to comment
Share on other sites

  • 0

This is functioning to pbr spec as far as I can tell.  Here is antialiased text, and blurred text, with the light source (technically environment hdri) rotating around it, in substance painter, basically reproducing the behavior you're seeing:

https://gyazo.com/e9b1746a7b838315425c086f7e3814f5

 


As far as "why", that is a good question though.  Would love someone to correct me here but my understanding (intuition or guess really) has been.... Imagine we have a board and paint it with 3 strips,

A. a flat, matte paint,

B. An eggshell or "medium glossiness" paint, and

C. A very shiny 3rd example paint, satin or wet satin paint even. 

Point a spotlight at that board.  You'd expect the light hitting C to be the most "shiny" or have sharper and more accurate highlights, while A would still exhibit a highlight but much bigger, softer, more washed out almost... and B would be somewhere in the middle.

So with that in mind, here's a mockup (but with 5 "Strips" instead of 3)

https://gyazo.com/ca0097cf0557fe61400bc3294acaeb1d

So, watching the mockup animation, notice about 1/3rd of the way in... the 2nd strip from the right shows as "brighter" overall or reflecting more light across the entire surface, because of the angle the light is hitting it at, at least in the area where the arrow is pointing in the screenshot below.  I feel like that is the same sort of thing...

 

image.jpeg.8447d12168d34b4664cabf15baf2326a.jpeg

 

With that in mind, watching the 1st animation above again notice how the blurred text kinda "pops" or... how the light first hits the edge/halo, then lights up the bulk of the text itself...

Here's a polycount post discussing the same kind of behavior too, from what I can tell, and also attributing it to contrast or different adjacent values:

https://polycount.com/discussion/184534/pbr-smoothness-bleeding-issue

 

Edit: Chatgpt claims that this is called "Specular aliasing", briefly googling that term does seem to show more instances and confirmation.

 

TL;DR;GR2GR (too long, didn't retrieve, Golden retriever to golden retriver 😆)

    - This is sadly how PBR works across the board afaik, as a visual artist using PBR materials you'll usually just want to "fake it" and blur, smudge, or paint roughness over areas like this.

 

 

 

Edited by Logan Bauer
Formatting, adding term "specular aliasing"
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 196 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...