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.

Constants

DITHER_THRESHOLD_MAP

#
const DITHER_THRESHOLD_MAP: vec4<u32> = vec4( 0x0a020800, 0x060e040c, 0x09010b03, 0x050d070f )

Structures

SampleBias

#

Biasing info needed to sample from a texture. How this is done depends on whether we’re rendering meshlets or regular meshes.

struct SampleBias {
@if(MESHLET_MESH_MATERIAL_PASS)
ddx_uv: vec2<f32> ,
@if(MESHLET_MESH_MATERIAL_PASS)
ddy_uv: vec2<f32> ,
@else()
mip_bias: f32 ,
}

Functions

visibility_range_dither

#
fn visibility_range_dither (
frag_coord: vec4<f32>
, 
dither: i32
)

alpha_discard

#
fn alpha_discard (
material_flags: u32
, 
alpha_cutoff: f32
, 
output_color: vec4<f32>
) -> vec4<f32>

prepare_world_normal

#
fn prepare_world_normal (
world_normal: vec3<f32>
, 
double_sided: bool
, 
is_front: bool
) -> vec3<f32>

winding_corrected_front_facing

#
fn winding_corrected_front_facing (
mesh_flags: u32
, 
is_front: bool
) -> bool

calculate_tbn_mikktspace

#
fn calculate_tbn_mikktspace (
world_normal: vec3<f32>
, 
world_tangent: vec4<f32>
) -> mat3x3<f32>

apply_normal_mapping

#
fn apply_normal_mapping (
standard_material_flags: u32
, 
TBN: mat3x3<f32>
, 
double_sided: bool
, 
is_front: bool
, 
in_Nt: vec3<f32>
) -> vec3<f32>

bend_normal_for_anisotropy

#
fn bend_normal_for_anisotropy (
lighting_input: LightingInput>
)

calculate_view

#

NOTE: Correctly calculates the view vector depending on whether the projection is orthographic or perspective.

fn calculate_view (
world_position: vec4<f32>
, 
is_orthographic: bool
) -> vec3<f32>

calculate_diffuse_color

#

Diffuse strength is inversely related to metallicity, specular and diffuse transmission

fn calculate_diffuse_color (
base_color: vec3<f32>
, 
metallic: f32
, 
specular_transmission: f32
, 
diffuse_transmission: f32
) -> vec3<f32>

calculate_F0_dielectric

#

Remapping [0,1] reflectance to F0 for dielectrics

fn calculate_F0_dielectric (
reflectance: vec3<f32>
) -> vec3<f32>

calculate_F0

#
fn calculate_F0 (
base_color: vec3<f32>
, 
metallic: f32
, 
reflectance: vec3<f32>
) -> vec3<f32>

calculate_contact_shadow

#
fn calculate_contact_shadow (
world_position: vec3<f32>
, 
frag_coord: vec2<f32>
, 
light_dir: vec3<f32>
, 
contact_shadow_steps: u32
) -> f32

apply_pbr_lighting

#
fn apply_pbr_lighting (
in: PbrInput
) -> vec4<f32>

apply_fog

#
fn apply_fog (
fog_params: Fog
, 
input_color: vec4<f32>
, 
fragment_world_position: vec3<f32>
, 
view_world_position: vec3<f32>
, 
frag_coord_xy: vec2<f32>
) -> vec4<f32>

premultiply_alpha

#
fn premultiply_alpha (
standard_material_flags: u32
, 
color: vec4<f32>
) -> vec4<f32>

main_pass_post_lighting_processing

#

fog, alpha premultiply for non-hdr cameras, tonemapping and debanding

fn main_pass_post_lighting_processing (
pbr_input: PbrInput
, 
input_color: vec4<f32>
) -> vec4<f32>
Contents