Questions about Physical based shading(PBS)?

Started by
25 comments, last by 51mon 7 years, 4 months ago

Hi guys

Recently, i do some research on Physical based shading(PBS,PBR).Finally i got two articles which has implementation details.

(1) http://www.codinglabs.net/article_physically_based_rendering.aspx

(2) Advance Lighting and Shading in Direct3D 9 from book [ShaderX2 Introduction and Tutorial with DirectX 9] (i am sorry, i can not found this article in internet)

In (1), it use environment map to do light calculation. And in (2) it use light that we define (just like point light, directional light) to do light calculation.

My question is:

(1) What difference between two method?

(2) In my understanding, (1) do the indirect lighting, (2) do the direct lighting, are they?

(3) If so, do i need both of them in my light calculation? and how to combine them in the final result?

If anyone know about this, please teach me.

Thanks very much!

Advertisement

I would not call the first method physically based since it does not even trace the path of photons.

Physically based rendering in my definition is forward ray-tracing so that a water surface can focus light to create bright spots of light.

Backward ray-tracing is a cheap trick to save performance but will not look realistic.

http://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracing/types.html

Not many games use forward ray-tracing because it is very slow from missing a lot of light that is never comming to the camera.

The scientifically correct way to use both reflection map and light sources is to add them together but since reflection maps are often reused approximations, you can multiply them instead so that a shiny object in a dark place will not glow from having a static reflection map.

I would not call the first method physically based since it does not even trace the path of photons.

Physically based rendering in my definition is forward ray-tracing so that a water surface can focus light to create bright spots of light.

Backward ray-tracing is a cheap trick to save performance but will not look realistic.

http://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracing/types.html

Not many games use forward ray-tracing because it is very slow from missing a lot of light that is never comming to the camera.

The scientifically correct way to use both reflection map and light sources is to add them together but since reflection maps are often reused approximations, you can multiply them instead so that a shiny object in a dark place will not glow from having a static reflection map.

Thank you for your reply.

What you say is ray-tracing, as i know, it is not real-time, so i can not use it in game engine.

What i really want to know here is physical based shading, just like lighting calculation in Unreal and Unity.

http://blog.selfshadow.com/publications/s2014-shading-course/ This link is what i talk about.

I am sorry if i misunderstand Physical based shading and Physical based Rendering, but as i know PBS is the approximate way to PBR, am i right?

I would not call the first method physically based since it does not even trace the path of photons.

Physically based doesn't mean physically accurate, just that it is based on real physics (unlike, e.g. Phong shading, which was based on intuition, or the standard implementation of Blinn-Phong which is based on a solid theoretical foundation but blatantly violates the conservation of energy).

However, yes, comparing any PBR technique to the real world lets us measure how correct it is. Or, in games we often compare our PBR renderers to existing film-quality PBR renderers :lol:

PBS is the approximate way to PBR, am i right?

No. Rendering covers the whole system (lighting, geometry, shadows, shading, post processing, etc) whereas shading is just the interaction between lights and materials.
PBS is a small part of PBR.


In (1), it use environment map to do light calculation. And in (2) it use light that we define (just like point light, directional light) to do light calculation.

My question is:

(1) What difference between two method?

(2) In my understanding, (1) do the indirect lighting, (2) do the direct lighting, are they?

(3) If so, do i need both of them in my light calculation? and how to combine them in the final result?

I haven't read your two articles yet, but just to be clear, PBS/PBR are not nouns / they are not a specific thing. PBS/PBR are adjectives that can be used to describe endless things.
Two different games might both say "We do PBR!", but their algorithms/shaders/code are probably completely different from each other, because what they mean is "our renderer uses some algorithms that are based on approximations of physics".

As for combining direct vs indirect lighting - all lighting is additive. Indirect lighting is just another type of light source such as spot, point, directional, etc...

In the real world there is a lot of indirect lighting going on. When you reproduce a real world material using PBS, but only light it with direct lights (point, spot, etc) they tend to look very wrong, as this lighting situation is unrealistic... So once you have PBS, figuring out a way to do more and more PBR (such as indirect lighting) becomes important.

There is no one standard implementation of PBS, but the most common techniques at the moment are covered in the Unreal 4 rendering course notes by Brian Karis.

Give me about a month and I'll get back to you on it. We're studying it in class this semester. I just have to get that far in the class.

I would not call the first method physically based since it does not even trace the path of photons.

Physically based rendering in my definition is forward ray-tracing so that a water surface can focus light to create bright spots of light.

Backward ray-tracing is a cheap trick to save performance but will not look realistic.

http://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracing/types.html

Not many games use forward ray-tracing because it is very slow from missing a lot of light that is never comming to the camera.

The scientifically correct way to use both reflection map and light sources is to add them together but since reflection maps are often reused approximations, you can multiply them instead so that a shiny object in a dark place will not glow from having a static reflection map.

Thank you for your reply.

What you say is ray-tracing, as i know, it is not real-time, so i can not use it in game engine.

What i really want to know here is physical based shading, just like lighting calculation in Unreal and Unity.

http://blog.selfshadow.com/publications/s2014-shading-course/ This link is what i talk about.

I am sorry if i misunderstand Physical based shading and Physical based Rendering, but as i know PBS is the approximate way to PBR, am i right?

Nvidia made a realtime raytracing demo a few years ago that runs on regular graphics cards.

Lots of hobby programmers show their realtime raytracers on YouTube in 20 to 30 FPS.

There is custom hardware for realtime raytracing called "ray tracing board" if GPU performance is not enough.

If a simple refection map is physically based then I don't know what is not physically based. The term is commonly used in game engines that have grainy graphics, focal blur that cannot be removed and low framerates.

An example of physically based shading is the Arauna game engine.

If a simple refection map is physically based then I don't know what is not physically based.

A simple reflection map is not physically based. A complex IBL system can be.
e.g. instead of just taking an environment map and texturing it on there to get a gloss effect (which will intuitively look good, but is not going to match the real world), if you ray-traced that environment as a surrounding sphere and integrated a thousand different rays using a physically-based BRDF and importance sampling, then your results would come close to matching the real world. The key is using a Physically-based BRDF to represent the surface, as 'shading' is all about surfaces.

Modern games do do the above, but with some clever approximations. The result of importance sampling that sphere can be done ahead of time and stored in a big look up table... The problem is that it's many-dimensional and would be way too big, so the common approximation basically stores it as a 4D cube array plus a 2D error correction table.
The final implementation looks like simple reflection mapping, but the inner workings are based on physically plausible BRDFs, ray-tracing and importance sampling (or unbiasedMonte carlo sampling if you like), and most importantly, in many cases the results get quite close to the ground truth, similar to the hideously expensive true ray tracing renderers but at a fraction of the cost.
I got far enough with my modeling class to cover PBR, but it really just brought up more questions than it answered so far.

I found this video. It looks like it may answer a lot of questions. I just started watching it. The way this explains it, PBR gets into substantially better physics models of how light actually works than we've previously used in video games.

When I looked for PBR on Amazon, about the only thing I turned up was this book. I've had the older version of this book sitting on my shelf for years. I've never really read it yet though. Is it possible the answer has been sitting on my shelf for years? I'm going to have to take another look at this book.

This guy seems to really sum up what PBR is pretty succinctly starting about 2:13 in the video.

The PBR book I linked above basically starts out by saying that PBR is ray tracing1. Looks like ray tracing is finally coming to the world of game programming. The examples I'm seeing look more impressive than computer graphics that I'm used to, but my eye has seen so much of that over the years that I can still tell the difference between it and the real world. Although some of the examples are pretty impressive. There are some examples here. And just look at the examples on those book covers.

I'm still trying to figure it out, but it looks to me like it's ray tracing in order to produce maps like color maps and specular maps and such, and then some new algorithms in your shader. That's just my impression so far after a brief introduction. Looks like I'm going to be getting very deep into this from the artist side over the next couple of months. I think I may try and make the time to get that new PBR book (since it's release date is in a couple weeks) and try and read through it and see if I can rewrite my GLSL to make use of it.


1In the section entitled "Overview and Goals" it says "pbrt is based on the ray-tracing algorithm." [I believe they mean Physically Based Rendering Technique and it's spelled in lower case in the book which is probably a typo since it starts a sentence and it's initials.]
Pharr, Matt; Humphreys, Greg. Physically Based Rendering: From Theory To Implementation (Kindle Locations 321-322). Elsevier Science. Kindle Edition.

The PBR book I linked above basically starts out by saying that PBR is ray tracing1.

No, they don't. pbrt is the name of the framework they walk you through in the book. You can find the accompanying source code here: https://github.com/mmp/pbrt-v3

The book walks you through the implementation of a ray tracing framework which uses physically based shading models. This doesn't mean that physically based shading is exclusive to ray tracing.

As mentioned before, physically based rendering is just an approach to shading and lighting with a foundation in the actual physics behind lighting and reflections, rather than working backwards from "what looks right" like we used to do in previous generations.

I gets all your texture budgets!

I would not call the first method physically based since it does not even trace the path of photons.

Physically based doesn't mean physically accurate, just that it is based on real physics (unlike, e.g. Phong shading, which was based on intuition, or the standard implementation of Blinn-Phong which is based on a solid theoretical foundation but blatantly violates the conservation of energy).

However, yes, comparing any PBR technique to the real world lets us measure how correct it is. Or, in games we often compare our PBR renderers to existing film-quality PBR renderers :lol:

PBS is the approximate way to PBR, am i right?

No. Rendering covers the whole system (lighting, geometry, shadows, shading, post processing, etc) whereas shading is just the interaction between lights and materials.
PBS is a small part of PBR.


In (1), it use environment map to do light calculation. And in (2) it use light that we define (just like point light, directional light) to do light calculation.

My question is:

(1) What difference between two method?

(2) In my understanding, (1) do the indirect lighting, (2) do the direct lighting, are they?

(3) If so, do i need both of them in my light calculation? and how to combine them in the final result?

I haven't read your two articles yet, but just to be clear, PBS/PBR are not nouns / they are not a specific thing. PBS/PBR are adjectives that can be used to describe endless things.
Two different games might both say "We do PBR!", but their algorithms/shaders/code are probably completely different from each other, because what they mean is "our renderer uses some algorithms that are based on approximations of physics".

As for combining direct vs indirect lighting - all lighting is additive. Indirect lighting is just another type of light source such as spot, point, directional, etc...

In the real world there is a lot of indirect lighting going on. When you reproduce a real world material using PBS, but only light it with direct lights (point, spot, etc) they tend to look very wrong, as this lighting situation is unrealistic... So once you have PBS, figuring out a way to do more and more PBR (such as indirect lighting) becomes important.

There is no one standard implementation of PBS, but the most common techniques at the moment are covered in the Unreal 4 rendering course notes by Brian Karis.

Thank you for your reply.

From your reply, i get some important points:

1. PBS is not a specific algorithm

2. In real world, lighting contains direct and indirect lighting, so if you want to make your graphics more realistic, you must implement as more indirect lighting as you can

This topic is closed to new replies.

Advertisement