Rendu
A lightweight rendering engine for experimentations
|
Common pbr general shader. More...
Classes | |
struct | Light |
Analytic light data. Some members might only be valid for some types of lights. More... | |
struct | Probe |
Environment probe data. More... | |
Public Member Functions | |
vec3 | F (vec3 F0, float VdotH) |
vec3 | iorToFresnel (vec3 internalIOR, vec3 externalIOR) |
float | iorToFresnel (float internalIOR, float externalIOR) |
vec3 | fresnelToIor (vec3 F0) |
vec3 | iridescenceSensitivity (float opd, float shift) |
vec3 | iridescenceF0 (vec3 F0, float LdotH, float ior, float thickness, float externalIOR) |
float | D (float NdotH, float alpha) |
float | DAnisotropic (float NdotH, float TdotH, float BdotH, float alphaT, float alphaB) |
float | DCharlie (float NdotH, float alpha) |
float | V (float NdotL, float NdotV, float alpha) |
float | Vfast (float NdotL, float NdotV, float alpha) |
float | VAnisotropic (float NdotL, float NdotV, float TdotV, float BdotV, float TdotL, float BdotL, float alphaT, float alphaB) |
float | VKelemen (float LdotH) |
float | VNeubelt (float NdotL, float NdotV) |
vec3 | ggx (vec3 n, vec3 v, vec3 l, vec3 h, vec3 F0, float roughness) |
float | ggxClearCoat (vec3 n, vec3 v, vec3 l, vec3 h, float roughness, out float clearCoatFresnel) |
vec3 | ggxAnisotropic (vec3 n, vec3 v, vec3 l, vec3 h, vec3 F0, Material material) |
vec3 | ggxSheen (vec3 n, vec3 v, vec3 l, vec3 h, Material material) |
vec3 | radiance (vec3 r, vec3 p, float roughness, textureCube cubeMap, Probe probe) |
float | probeWeight (vec3 p, Probe probe) |
vec3 | applySH (vec3 wn, vec4 coeffs[9]) |
float | approximateSpecularAO (float diffuseAO, float NdotV, float roughness) |
void | ambientLighting (Material material, vec3 worldP, vec3 viewV, mat4 inverseV, Probe probe, textureCube envmap, vec4 envSH[9], texture2D brdfLUT, out vec3 diffuse, out vec3 specular) |
void | directBrdf (Material material, vec3 n, vec3 v, vec3 l, out vec3 diffuse, out vec3 specular) |
bool | applyPointLight (Light light, vec3 viewSpacePos, vec3 viewSpaceN, textureCubeArray shadowMap, out vec3 l, out float shadowing) |
bool | applyDirectionalLight (Light light, vec3 viewSpacePos, vec3 viewSpaceN, texture2DArray shadowMap, out vec3 l, out float shadowing) |
bool | applySpotLight (Light light, vec3 viewSpacePos, vec3 viewSpaceN, texture2DArray shadowMap, out vec3 l, out float shadowing) |
Common pbr general shader.
|
inline |
Evaluate the lighting contribution from an analytic light source.
material | the surface point material parameters |
worldP | the surface position (in world space) |
viewV | the outgoing view direction (in view space) |
inverseV | the transformation matrix from view to world space |
probe | the environment probe parameters |
envmap | the environment probe texture |
envSH | the environment probe irradiance coefficients |
brdfLUT | the preintegrated BRDF lookup table |
diffuse | will contain the diffuse ambient contribution |
specular | will contain the specular ambient contribution |
|
inline |
Compute a directional light contribution for a given scene point.
light | the light information |
viewSpacePos | the point position in view space |
viewSpaceN | the normal in view space |
shadowMap | the 2D shadow maps |
l | will contain the light direction for the point |
shadowing | will contain the shadowing factor |
|
inline |
Compute a point light contribution for a given scene point.
light | the light information |
viewSpacePos | the point position in view space |
viewSpaceN | the normal in view space |
shadowMap | the cube shadow maps |
l | will contain the light direction for the point |
shadowing | will contain the shadowing factor |
|
inline |
Evaluate the ambient irradiance (as SH coefficients) in a given direction.
wn | the direction (normalized) in world space |
coeffs | the SH coefficients |
|
inline |
Compute a spot light contribution for a given scene point.
light | the light information |
viewSpacePos | the point position in view space |
viewSpaceN | the normal in view space |
shadowMap | the 2D shadow maps |
l | will contain the light direction for the point |
shadowing | will contain the shadowing factor |
|
inline |
Estimate specular ambient occlusion. Based on "Moving Frostbite to Physically Based Rendering".
diffuseAO | diffuse visbility factor |
NdotV | visibility/normal angle |
roughness | linear material roughness |
|
inline |
GGX Distribution term.
NdotH | angle between the half and normal directions |
alpha | the roughness squared |
|
inline |
Anisotropic GGX distribution term. Described by B. Burley in "Physically-Based Shading at Disney", 2012, (https://www.disneyanimation.com/publications/physically-based-shading-at-disney/)
NdotH | angle between the half and normal directions |
TdotH | angle between the half and tangent directions |
BdotH | angle between the half and bitangent directions |
alphaT | the roughness squared in the tangent direction |
alphaB | the roughness squared in the bitangent direction |
|
inline |
Sheen-specific "Charlie" distribution. Described by A.-C. Estevez and C. Kulla in "Production Friendly Microfacet Sheen BRDF", 2017, (http://www.aconty.com/pdf/s2017_pbs_imageworks_sheen.pdf)
NdotH | angle between the half and normal directions |
alpha | the roughness squared |
|
inline |
Evaluate the lighting contribution from an analytic light source.
material | the surface point material parameters |
n | the surface normal (in view space) |
v | the outgoing view direction (in view space) |
l | the incoming light direction (in view space) |
diffuse | will contain the diffuse direct contribution |
specular | will contain the specular direct contribution |
|
inline |
Fresnel approximation.
F0 | fresnel based coefficient |
VdotH | angle between the half and view directions |
|
inline |
Convert a Fresnel coefficient to an internal IOR, assuming the external medium is air (IOR 1.0)
F0 | the Fresnel coefficient |
|
inline |
Evaluate the GGX BRDF for a given normal, view direction and material parameters.
n | the surface normal |
v | the view direction |
l | the light direction |
h | the half vector between the view and light |
F0 | the Fresnel coefficient |
roughness | the surface roughness |
|
inline |
Evaluate the anisotropic GGX BRDF for a given normal, view direction, frame and material parameters.
n | the surface normal |
v | the view direction |
l | the light direction |
h | the half vector between the view and light |
F0 | the Fresnel coefficient |
material | the surface parameters |
|
inline |
Evaluate a simplified GGX BRDF for a given normal, view direction and material parameters.
n | the surface normal |
v | the view direction |
l | the light direction |
h | the half vector between the view and light |
roughness | the surface roughness |
clearCoatFresnel | will contain the value of the Fresnel coefficient |
|
inline |
Sheen specific BRDF, with a constant Fresnel coefficient.
n | the surface normal |
v | the view direction |
l | the light direction |
h | the half vector between the view and light |
material | the surface parameters |
|
inline |
Estimate the Fresnel coefficient at an interface based on the internal and external media IORs.
internalIOR | the internal IOR |
externalIOR | the external IOR |
|
inline |
Estimate the Fresnel coefficient at an interface based on the internal and external media IORs.
internalIOR | the internal IOR |
externalIOR | the external IOR |
|
inline |
Evaluate the new Fresnel coefficient generated by the interferences caused by a thin film on top of a dieletric or conductor. This approximation that accounts for multiple reflections inside the thin film while accounting for spectral variations has been described by L. Belcour and P. Barla in "A Practical Extension to Microfacet Theory for the Modeling of Varying Iridescence", 2017, (https://belcour.github.io/blog/research/publication/2017/05/01/brdf-thin-film.html). Additional simplifications have been described by S. Lagarde and E. Golubev in "The Road toward Unified Rendering with Unity’s High Definition Render Pipeline", 2015, (http://advances.realtimerendering.com/s2018/index.htm#_9hypxp9ajqi).
F0 | the base surface Fresnel coefficient |
LdotH | the dot product between the light and the half vector |
ior | the thin film index of refraction |
thickness | the thin film thickness (in nm) |
externalIOR |
|
inline |
Approximation of the Fourier transform of the sensitivity for iridescent materials, using four gaussian lobes. This encompasses the sensitivity resulting from all light paths with the input path difference and phase.
opd | optical path difference |
shift | phase of the signal |
|
inline |
Compute the contribution of a probe to a given point in the scene, based on the probe effect box size, position and fading settings.
p | the position in the scene (world space) |
probe | the probe parameters |
|
inline |
Return the (pre-convolved) radiance for a given direction (in world space) and material parameters.
r | the direction to query (world space) |
p | the surface point (world space) |
roughness | the surface roughness |
cubeMap | the environment map texture |
probe | the probe parameters |
|
inline |
Visibility term of GGX BRDF, V=G/(n.v)(n.l)
NdotL | dot product of the light direction with the surface normal |
NdotV | dot product of the view direction with the surface normal |
alpha | squared roughness |
|
inline |
Visibility term of the anisotropic GGX BRDF. Described by B. Burley in "Physically-Based Shading at Disney", 2012, (https://www.disneyanimation.com/publications/physically-based-shading-at-disney/)
NdotL | dot product of the light direction with the surface normal |
NdotV | dot product of the view direction with the surface normal |
TdotV | dot product of the tangent direction with the view direction |
BdotV | dot product of the bitangent direction with the view direction |
TdotL | dot product of the tangent direction with the light direction |
BdotL | dot product of the bitangent direction with the light direction |
alphaT | squared roughness in the tangent direction |
alphaB | squared roughness in the bitangent direction |
|
inline |
Linearized visibility term of GGX BRDF, V=G/(n.v)(n.l)
NdotL | dot product of the light direction with the surface normal |
NdotV | dot product of the view direction with the surface normal |
alpha | squared roughness |
|
inline |
Simplified visibility term described by Kelemen in "A Microfacet Based Coupled Specular-Matte BRDF Model with Importance Sampling", 2001
LdotH | dot product of the light direction and the half vector |
|
inline |
Sheen-specific visibility term. Described by D. Neubelt and M. Pettineo in "Crafting a Next-Gen
Material Pipeline for The Order: 1886", 2014, (https://www.gdcvault.com/play/1020162/Crafting-a-Next-Gen-Material)
NdotL | dot product of the light direction with the surface normal |
NdotV | dot product of the view direction with the surface normal |