Shader Explorer
Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

displace.wgsl

Import path

Structures

CurveResult

#
struct CurveResult {
local_pos: vec3<f32> ,
slope: vec3<f32> ,
twist: f32 ,
height_factor: f32 ,
local_wind_dir: vec3<f32> ,
}

Functions

displace_vertex_and_calc_normal

#
fn displace_vertex_and_calc_normal (
wind: Wind
vertex_pos: vec3<f32>
static_bend: vec2<f32>
tangent: vec4<f32>
) -> DisplacedVertex

calculate_macro_curve

#
fn calculate_macro_curve (
local_pos: vec3<f32>
wind: Wind
static_bend: vec2<f32>
) -> CurveResult

apply_micro_details

#
fn apply_micro_details (
curve_data: CurveResult
wind: Wind
) -> vec3<f32>

billboarding

#
fn billboarding (
wind: Wind
local_displaced_pos: vec3<f32>
total_offset: vec3<f32>
) -> vec3<f32>

calculate_billboard_matrix

#
fn calculate_billboard_matrix (
instance_position: vec4<f32>
camera_world_pos: vec3<f32>
world_from_local: mat4x4<f32>
) -> mat3x3<f32>

calculate_edge_correction

#
fn calculate_edge_correction (
world_pos: vec3<f32>
world_normal: vec3<f32>
uv_x: f32
edge_correction_factor: f32
) -> vec3<f32>