Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Structures

LayerLightingInput

#

Input to a lighting function for a single layer (either the base layer or the clearcoat layer).

struct LayerLightingInput {
N: vec3<f32>,
R: vec3<f32>,
NdotV: f32,
perceptual_roughness: f32,
roughness: f32,
}

LightingInput

#

Input to a lighting function (point_light, spot_light, directional_light).

struct LightingInput {
layers: array<LayerLightingInput, 2>, STANDARD_MATERIAL_CLEARCOAT
layers: array<LayerLightingInput, 1>, !STANDARD_MATERIAL_CLEARCOAT
P: vec3<f32>,
V: vec3<f32>,
diffuse_color: vec3<f32>,
F0_: vec3<f32>,
F_ab: vec2<f32>,
clearcoat_strength: f32, STANDARD_MATERIAL_CLEARCOAT
anisotropy: f32, STANDARD_MATERIAL_ANISOTROPY
Ta: vec3<f32>, STANDARD_MATERIAL_ANISOTROPY
Ba: vec3<f32>, STANDARD_MATERIAL_ANISOTROPY
}

DerivedLightingInput

#

Values derived from the LightingInput for both diffuse and specular lights.

struct DerivedLightingInput {
H: vec3<f32>,
NdotL: f32,
NdotH: f32,
LdotH: f32,
}

Functions

getDistanceAttenuation

#

light radius is a non-physical construct for efficiency purposes, because otherwise every light affects every fragment in the scene

fn getDistanceAttenuation (
distanceSquare: f32,
inverseRangeSquared: f32
) -> f32

D_GGX

#

D_GGX_anisotropic

#

V_SmithGGXCorrelated

#

Visibility function (Specular G) V(v,l,a) = G(v,l,α) / { 4 (n⋅v) (n⋅l) } such that f_r becomes f_r(v,l) = D(h,α) V(v,l,α) F(v,h,f0) where V(v,l,α) = 0.5 / { n⋅l sqrt((n⋅v)^2 (1−α2) + α2) + n⋅v sqrt((n⋅l)^2 (1−α2) + α2) } Note the two sqrt’s, that may be slow on mobile, see https://google.github.io/filament/Filament.html#listing_approximatedspecularv

fn V_SmithGGXCorrelated (
roughness: f32,
NdotV: f32,
NdotL: f32
) -> f32

V_GGX_anisotropic

#

V_Kelemen

#

F_Schlick_vec

#

F_Schlick

#

fresnel

#

specular_multiscatter

#

derive_lighting_input

#

compute_specular_layer_values_for_point_light

#

Returns L in the xyz components and the specular intensity in the w component.

fn compute_specular_layer_values_for_point_light (
input: ptr<function, LightingInput>,
layer: u32,
V: vec3<f32>,
light_to_frag: vec3<f32>,
light_position_radius: f32
) -> vec4<f32>

specular

#

Cook-Torrance approximation of the microfacet model integration using Fresnel law F to model f_m f_r(v,l) = { D(h,α) G(v,l,α) F(v,h,f0) } / { 4 (n⋅v) (n⋅l) }

fn specular (
input: ptr<function, LightingInput>,
derived_input: ptr<function, DerivedLightingInput>,
specular_intensity: f32
) -> vec3<f32>

specular_clearcoat

#

specular_anisotropy

#

Fd_Burley

#

F_AB

#

EnvBRDFApprox

#

perceptualRoughnessToRoughness

#

point_light

#

spot_light

#

directional_light

#
Contents