Do not confuse Phong shading with Phong lighting model - michaliskambi/x3d-tests GitHub Wiki
Do not confuse "Phong shading" with "Phong lighting model".
These are 2 independent things, that share a similar name, as they have been invented by the same person.
Bui Tuong Phong invented two concepts. They can be used together, but are technically independent :
-
Phong shading : https://en.wikipedia.org/wiki/Phong_shading
-
Phong lighting model : https://en.wikipedia.org/wiki/Phong_reflection_model
Shading
"Shading" determines where do you calculate the light equation, and there are only 2 sensible options:
-
Gouraud shading: calculate lighting equation per-vertex (and only interpolate the resulting color across a surface)
-
Phong shading: calculate lighting equation per-pixel (which means you need to interpolate normals and other stuff across a surface, and at each pixel calculate lighting).
AD 1 is much faster.
AD 2 is much prettier, and also necessary for some stuff (e.g. normal maps don't make sense in Gouraud shading).
Lighting model
"Lighting model" is an independent decision from shading. It determines what your lighting equation is. There are a number of useful options here:
-
Unlit:
Lighting(point) = constant color
(This happens when you use UnlitMaterial node in X3Dv4.)
-
Phong lighting model
Lighting(point) = emissive + sum_for_all_lights(ambientParameter + diffuseParameter * dot(normal, lightdir) + specularParameter * ....)
-
Blinn-Phong lighting model, which is like Phong lighting model but with small optimization, see https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_reflection_model . Equation is very similar, just the multiplier for specularParameter is a bit different.
(This happens when you use Material node in X3D, version 3 or 4.)
-
Physical lighting model, PBR:
Lighting(point) = emissive + sum_for_all_lights(use baseParameter, metallic, roughness etc. following glTF recommended model, which can be approximated in various ways)
(This happens when you use PhysicalMaterial node in X3Dv4.)
Actually there are a number of equations that are called Physically-Based Rendering. See https://github.com/michaliskambi/x3d-tests/wiki/What-is-PBR-and-why-do-we-want-it-in-X3D%3F . See also wikipedia: https://en.wikipedia.org/wiki/Physically_based_rendering . The term "PBR" doesn't yet indicate a specific equation, when talking about the general usage in computer graphics.
In the context of X3Dv4, the term "PBR" practically refers to concrete equations, which follow glTF spec recommendation and sample implementation, for "metallic-roughness" model. The point is to be 100% compatible with standard glTF "metallic-roughness" model, present in glTF spec.
In the context of glTF, the term PBR refers to either standard glTF "metallic-roughness", or extension glTF "specular-glossiness" model.
Note that no one (that I know about) implements PBR together with Gouraud shading. In general, if you want maximum speed (and not maximum realism), you can just use Gouraud shading + Phong lighting model. But the combination PBR + Gouraud shading is theoretically possible, after all you can just call the PBR equation per-vertex (and assume and textures are null) and interpolate resulting color.