Physically Based Rendering Encyclopedia

2 Likes

Well this is useful. I am a little out of the loop on this PBR stuff, am I right in saying you require an image, kinda like a skybox, to use for image based lighting as part of it? If it’s not required, is PBR any better than standard specular and so on. If it is required - how do you deal with indoor scenes which vary a lot? I ask because almost EVERY example of PBR I’ve seen has been in the center of some giant area - be it a large room or an outside scene with a lovely sky.

1 Like

PBR per se doesn’t require an env map. There are 2 things at play:

  1. Standard specular lighting uses Phong lighting. Here the lighting uses a more physically probable BRDF (bidirectional reflectance diffusion funcion… yeah I know…). We use something called Cook Torrence for the engine. It gives better specular reflection, and the inputs are the roughness of the material (is it smooth or soft) the metalness (is it metallic or not).

  2. On top of that we use Image Based Lighting (IBL). This is very often used with PBR and that’s why it’s often conflated with it. IBL is using the color information coming from an env map as a light source. And we use the same cook torrence equation to compute the reflection.

Note that the diffuse lighting is computed the same way as before with a brdf called “Lambert”.

EDIT: about the indoor question: We use LightProbes. LightProbes are scattered inside your environment and actually captures the Ambient lighting in an env map. Ideally the objects around this probes are rendered using it as a light source. And any moving object switch env probe to render.
For now in the engine we just roughly switch to the nearest probe. There are several technique to make smooth transitions, but they are not implemented yet in the engine. Also none of them is a “catch them all” solution, they have pros and cons and should be different depending on your scene.

1 Like

Can PBR in engine auto generate env map for indoor scenes or we should bake them for each scene ourselves (for example using blender cube map baker)?

Post can’t be empty… so I will add this text.

I mean this

should we provide this env map ourselves or it is auto generated ?

1 Like

The engine can generate them.
There is an EnvCamera class that can capture the current environment into a cube map.
I even made a ui in the SDK to do it. Idk if @Darkchaos merged the change yet though because it needs JME master.

Basically the workflow would be: create your environment, a scene with a cube map (use a HDR cube map for better IBL).
then place the Env camera where you want to put a probe, and render the env map. This will create a LightProbe, and the engine will use it for IBL.

In the SDK you just have to create a LightProbe as you would create any light, and all the EnvCamera shebang is done in the background for you.

Note that the Map rendering + baking is taking some time and using this at run time can be a challenge. It’s highly multithreaded but takes around 2 seconds with a quad core. More cores could do the difference, because there are 7 threads. Though, it’s all done on the CPU and there might be some ways to do it on the GPU. That would be quite faster I guess.

Also it’s not just classic cube maps. They are prefiltered, meaning some lighting information is baked into it so we don’t have to compute them at runtime.
There are 2 maps :

  • an irradiance map (used to compute diffuse lighting), basically it could be replaced with spherical harmonics,at the expanse of computation time. It’s kind of a blurry version of the env map.
  • A prefiltered env map (used for specular lighting). This is the env map with some lighting information baked into it. Also, it uses the texture mip maps to have several blurred versions of the env maps and picks the right one depending on the metalness/roughness of the material.
3 Likes

Pretty cool,
Got it.

Thanks

Here is what the Light-probe inside my warehouse scene looks like:


and

(it’s a little screwy but you get the idea)

5 Likes

Thanks that was very helpful!

Would it be possible ot have something like this running in the background? Or does it require the jme thread?

Eg something like a slowly (eg 10+sec) automatic background updating probe, which would allow to handle changing lighting (sun night)

it doesn’t need the JME thread nope. So yeah I guess one could do that in the background. But it’s still CPU intensive so it might hinder the perfs anyway.

1 Like