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.

vfx_render.wgsl

Bindings

view

#
@group(0)
@binding(0)
var<uniform> view: View

sim_params

#
@group(0)
@binding(1)
var<uniform> sim_params: SimParams

particle_buffer

#
@group(1)
@binding(0)
var<storage, read> particle_buffer: ParticleBuffer

indirect_buffer

#
@group(1)
@binding(1)
var<storage, read> indirect_buffer: IndirectBuffer

spawners

#
@group(2)
@binding(0)
var<storage, read> spawners: array<Spawner>

prefix_sum

#
@group(2)
@binding(1)
var<storage, read> prefix_sum: array<u32>

batch_info

#
@group(2)
@binding(2)
var<storage, read> batch_info: BatchInfo

Structures

Particle

#
struct Particle {
particles: array<Particle> ,
}

VertexOutput

#
struct VertexOutput {
@builtin(position)
position: vec4<f32> ,
@location(0)
color: vec4<f32> ,
@location(1)
uv: vec2<f32> , 🟢 NEEDS_UV
@location(2)
normal: vec3<f32> , 🟢 NEEDS_NORMAL
@location(3)
slab_particle_index: u32 , 🟢 NEEDS_PARTICLE_FRAGMENT
}

EffectLocation

#

Location of an effect in a slab.

struct EffectLocation {
effect_index: u32 ,
base_particle: u32 ,
update_index: u32 ,
}

Functions

get_camera_position_effect_space

#
fn get_camera_position_effect_space ()

get_camera_rotation_effect_space

#
fn get_camera_rotation_effect_space ()

unpack_compressed_transform

#

Unpack a compressed transform stored in transposed row-major form.

fn unpack_compressed_transform (
compressed_transform: mat3x4<f32>
) -> mat4x4<f32>

unpack_compressed_transform_3x3_transpose

#

Unpacks a compressed transform and transposes is.

fn unpack_compressed_transform_3x3_transpose (
compressed_transform: mat3x4<f32>
) -> mat3x3<f32>

transform_position_simulation_to_world

#

The simulation space depends on the effect’s SimulationSpace value, and is either the effect space (SimulationSpace::Local) or the world space (SimulationSpace::Global).

fn transform_position_simulation_to_world (
sim_position: vec3<f32>
) -> vec4<f32>

transform_normal_simulation_to_world

#
fn transform_normal_simulation_to_world (
sim_normal: vec3<f32>
) -> vec3<f32>

transform_position_simulation_to_clip

#

The simulation space depends on the effect’s SimulationSpace value, and is either the effect space (SimulationSpace::Local) or the world space (SimulationSpace::Global). The clip space is the final [-1:1]^3 space output from the vertex shader, before perspective divide and viewport transform are applied.

fn transform_position_simulation_to_clip (
sim_position: vec3<f32>
) -> vec4<f32>

inverse_transpose_mat3

#
fn inverse_transpose_mat3 ( ) -> mat3x3<f32>

find_location_from_particle

#

Requirements: - var batch_info : BatchInfo - var prefix_sum : array

fn find_location_from_particle (
slab_particle_index: u32
) -> EffectLocation

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
@builtin(instance_index)
instance_index: u32
@location(0)
vertex_position: vec3<f32>
@location(1)
vertex_uv: vec2<f32>
@location(2)
vertex_normal: vec3<f32>
) -> VertexOutput