Physically Based Shading (PBS) FAQ


#1

Hi All,

We just introduced Physically Based Shading (PBS) and now what? Hopefully your models are looking slightly better or maybe not and you would really like to understand how to fix it, what this PBR thing is all about and how do i get this to be less shinny! Let’s try to help you here and bring peace, beauty & harmony in the metaverse…
Big thanks to the alpha users who tested the early builds the PR SeventyOneNinetyOne and helped us refine the behavior, in particular @Menithal and @OmegaHeron.
Thanks much to the usual suspects at hifi for all the contribution & support…

Please post your questions here in the thread and we will make this a living FAQ about PBS.

What this is all about?
PBS is a broad term describing the shading algorithm of a material surface which is much more realistic compared to traditional shading equation and material model (Gouraud, Blinn or Phong). PBS is now commonly used in the best graphics engine such as Unreal, CryEngine or Unity and many others and is probably what you are looking at in any AAA game on console or PC. In Hifi, we were using Phong up until this PR and we finally adjusted our pipeline to migrate to PBR.
Need before after capture

Migrating to PBS improves our modeling tool chain from the modeling software Blender and Maya with a better export to FBX and then into Hifi. You can now take advantage of better tools to generate the required textures and material description such as SubstancePainter.

What are the fundamental properties of hifi PBR Material ?

  • Albedo: The color of the surface expressed as sRGB, same as the standard diffuse color if non metallic, the actual metal “fresnel” color if metallic.

  • Metallic: 0 or 1, with this 2 kinds of material we can cover a wide range of materials encountered in everyday life. For now, values in the range ]0,1[ are simply rounded to 0 or 1 with no other side effect. The metallic property can be think of the “specular color” in the traditional phong model.

  • Roughness: The roughness (opposite of smoothness) of a surface, if 0 then surface is perfectly flat behaving like a mirror, if 1 then surface is infinitely rough. Roughness is the most important property of the material affecting the look of the specular highlight on the surface and the way it “spreads”. Very rough surface infinitely spread the highlight whereas smooth surface concentrate more and more the reflection highlight to the point of a perfect mirror. Roughness is the inverse of the “smouthness” or “glossiness” or “specularPower” used in legacy material model.

Extra Material Properties supported
Aside from the core properties Albedo, Metallic & Roughness the hifi Material also support:
Need the details

  • NormalMap
  • Emissive
  • Occlusion
  • Lightmap

Is there an official Material export reference to now how materials are defined from the modeling tool to hifi ?
Yes, this document Version 03/2016 list all the material fields used by hifi, how they are imported from FBX file and lastly how the modeling tool are exporting their material to fbx.
This document is our current reference to check if the behavior of an exported model material is correct or not.
We are working on creating reference models for each individual cases, to be continued…

In Blender, how do i create a PBR material that works in Hifi ?
The recommended path to export models from Blender is to export to FBX file.
Working in Blender Render, simply use regular Material and Texture assignments and use the following properties:

  • About Diffuse

    – Diffuse.Color => Albedo color
    – Diffuse.ColorMap => Albedo Texture color
    The constant color is multiplied by the texture so put white in the constant color to avoid any unexpected coloring of the map. The recommended format of the map is PNG, the Alpha channel can be used to encode mask or transparency, at load time, hifi will detect if the alpha channel is useful for the transparency property of the Material. The"Intensity" field or the “name” of the diffuse model is not used by Hifi.
  • About Specular

    – Specular.Intensity => Metallic value
    – Specular.IntensityMap => Metallic Texture
    – Specular.Hardness => Smouthness value
    Blender Hardness value range is [0, 512] which is remapped to [0,1] in the fbx smoothness property which we convert to rougnhess at load time in Hifi
    – Specular.HardnessMap => Smoothness Texture
    When loading the Smoothness texture from a Material, hifi, invert the pixel values to convert it into a Roughess map
  • About Emissive & Lightmap
    – Emit => Emissive
    – Ambient => Lightmap
    – Occlusion map is not supported from blender at the moment

How can i check and debug the values used for a model in the Hifi Engine
The script tool “debugFramebuffer.js” located (for now) in utilities/tools/render/ let’s you see the different channels of material as used by the lighting in a split screen. This information comes from the deferred buffer so you only see the Opaque fragments information.
The split screen boundary can be dragged to see less or more of the debug view.
Here is an example of the tool used when looking at an object and trying to understand the roughness information:


And now looking at the normal information:

References
If you are interested to know more and understand the fundamentals of PBR I would highly recommend all the Siggraph courses organized in particular by Naty Hoffman and then Stephen Hill
We also spend a lot of time in Sebastien Lagarde’s blog and many other graphics developers’ blogs and presentations from GDC and Siggraph.
Detail our implementation and the reference giants


Quixel is 40% off
It's dark around here! (problem traced to likely be user platform)
debugFramebuffer not show the menu on screen
Support for procedurally rendered spheres and boxes added
#2

I’d add the following :slight_smile:

What values go from Blender to the High Fidelity PBR values?:

In Blender, using the texture Assignment tab within the Property values, you can assign textures to all the maps within High Fidelity:

  • Diffuse Color maps to Albedo
  • Specular Intensity maps to Metallic
  • Specular Hardness as a Glossiness map, maps to Roughness (Hifi handles the conversion)
  • Emit maps to Emissive
  • Ambient maps to Lightmap (Not sure if this is intended, should this be occlusion? @sam)

#3

It’s cool tek that I will enjoy using once my rage of having to fix everything has abated.

oh @Menithal does your pitchfork support pbr?


#4

I haven’t update the texture yet. I’ll do it after I get from work and update the torch as well for you lol


#5

For Reference:

https://cgcookie.com/2015/05/20/pbr-in-blenders-viewport/

Two of the article links I have recreated below as some folks can’t be wasting time reading the article.

The demo .blend file used in the video above is available for download here!

The video file is available for download here!


#6

can you read it to me?


#7

side topic reminder: slideshow with n.v.d.a. piped into HiFi = bot reader?


#8

like i have the time to read 2 links XD


#9

Just to note, whicle cycles is brilliant for the PBR within Blender, you wont be able export the materials made in Cycles into FBX (this is a limitation of fbx, and Blender natively not exporting these as custom params values in the fbx, although could technically be done )


#11

@sam this is great, thank you for all the added support and notes.

January 2015 I was struggling with model imports to HiFi, @judas made a video and I was able to follow along and repeat the process.

I’m all for a bit of friendly competition, but believe we will have many more “contestants” if you or @Menithal put together a short but sweet tutorial video. I have no shame in my own ignorance so I use my experience as an example…

to myself - “I know… I’ll just rez a cube in blender and make it into glass block. I tried this in SL once, and it never really looked right. I bet this would be a trivial process now!”

((20 min later))

“I’d better go consult the gang…”


#12

So this video shows how to use nodes in blender render, not cycles, will this system of nodes in blender render export to Hifi as suggested in the video?


#13

No, i didnt even suggest that video. That just shows how to use the cycle component and how make nodes. Cycles does not export the nodes when you export it as FBX. Instead you have to use the old school binds, but using the above map definitions.


#14

Oh I thought you were referring to that video, I just watched it and he is using nodes but in blender render not cycles and I was wondering if it will work because its not using cycles?


#15

I was referring to the video as a method to preview textures within blender. But it is not the workflow to export them into High Fidelity. Ill make a quick video demonstrating how it is done since it seems there is confusion around it.


#16

Here you go guys.


#17

Just catching up after travel… updated server and interface in place as of today and I am seeing a VERY BRIGHT view in the Interface. Could this relate to the new rendering at all or shall I look for another cause?

Avatar renders correctly, but all the domain object textures are there for the skydome (with blue sky and clouds) and the wrinkle paper terrain but they are almost washed out. Has some new graphics setting happened while I was away that needs to be adjusted from the default?


#18

Yes, they switched the rendering shaders. Generally speaking, its lighter, but if you have any emit maps that will cause stuff to go white, the emit map now takes color information, and generally the skybox map is now reflected off surfaces.

I just checked your domain, You have emit on everything

,
that will definitely cause it :slight_smile:


#19

I see you there… but we have the usual damned issue with no common text chat.

Wonder how we fox things so they look “normal” then? Evereything was added with earliesr object add mechanisms.


#20

Simply remove all the emit textures that were assigned to the entities. That will solve it. dunno why your objects have emit in the first place.


#21

Sorry to be dumb… but I just looked at for example the skydome its a VERY simple object with just one jpg attached as the texture. I cannot see any options to change the texture display. I cannot remove the image/texture of course or it will no longer be a skybox.