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.
1struct ClusteredLight {
2 /// For point lights: the lower-right 2x2 values of the projection matrix [2][2] [2][3] [3][2] [3][3]
3 /// For spot lights: the direction (x,z), spot_scale and spot_offset
4 light_custom_data: vec4<f32>,
5 color_inverse_square_range: vec4<f32>,
6 position_radius: vec4<f32>,
7 /// 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options.
8 flags: u32,
9 shadow_depth_bias: f32,
10 shadow_normal_bias: f32,
11 spot_light_tan_angle: f32,
12 soft_shadow_size: f32,
13 shadow_map_near_z: f32,
14 decal_index: u32,
15 range: f32,
16};
18const POINT_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u << 0u;
19const POINT_LIGHT_FLAGS_SPOT_LIGHT_Y_NEGATIVE: u32 = 1u << 1u;
20const POINT_LIGHT_FLAGS_VOLUMETRIC_BIT: u32 = 1u << 2u;
21const POINT_LIGHT_FLAGS_AFFECTS_LIGHTMAPPED_MESH_DIFFUSE_BIT: u32 = 1u << 3u;
22const POINT_LIGHT_FLAGS_CONTACT_SHADOWS_ENABLED_BIT: u32 = 1u << 4u;
23const POINT_LIGHT_FLAGS_SPOT_LIGHT_BIT: u32 = 1u << 5u;
24const POINT_LIGHT_FLAGS_RECT_LIGHT_BIT: u32 = 1u << 6u;
26struct DirectionalCascade {
27 clip_from_world: mat4x4<f32>,
28 texel_size: f32,
29 far_bound: f32,
32struct DirectionalLight {
33 cascades: array<DirectionalCascade, constants::MAX_CASCADES_PER_LIGHT>,
34 color: vec4<f32>,
35 direction_to_light: vec3<f32>,
36 /// 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options.
37 flags: u32,
38 soft_shadow_size: f32,
39 shadow_depth_bias: f32,
40 shadow_normal_bias: f32,
41 num_cascades: u32,
42 cascades_overlap_proportion: f32,
43 depth_texture_base_index: u32,
44 decal_index: u32,
45 sun_disk_angular_size: f32,
46 sun_disk_intensity: f32,
47};
49const DIRECTIONAL_LIGHT_FLAGS_SHADOWS_ENABLED_BIT: u32 = 1u << 0u;
50const DIRECTIONAL_LIGHT_FLAGS_VOLUMETRIC_BIT: u32 = 1u << 1u;
51const DIRECTIONAL_LIGHT_FLAGS_AFFECTS_LIGHTMAPPED_MESH_DIFFUSE_BIT: u32 = 1u << 2u;
52const DIRECTIONAL_LIGHT_FLAGS_CONTACT_SHADOWS_ENABLED_BIT: u32 = 1u << 3u;
54struct RectLight {
55 color: vec4<f32>,
56 position: vec3<f32>,
57 width: f32,
58 right: vec3<f32>,
59 height: f32,
60 up: vec3<f32>,
61 range: f32,
62};
64struct Lights {
65 /// NOTE: this array size must be kept in sync with the constants defined in bevy_pbr/src/render/light.rs
66 directional_lights: array<DirectionalLight, u32(constants::MAX_DIRECTIONAL_LIGHTS)>,
67 ambient_color: vec4<f32>,
68 /// x/y/z dimensions and n_clusters in w
69 cluster_dimensions: vec4<u32>,
70 /// xy are vec2<f32>(cluster_dimensions.xy) / vec2<f32>(view.width, view.height)
71 ///
72 /// For perspective projections:
73 /// z is (cluster_dimensions.z - 1) / log(far / near)
74 /// w is (cluster_dimensions.z - 1) * log(near) / log(far / near)
75 ///
76 /// For orthographic projections:
77 /// NOTE: near and far are +ve but -z is infront of the camera
78 /// z is -near
79 /// w is cluster_dimensions.z / (-far - -near)
80 cluster_factors: vec4<f32>,
81 n_directional_lights: u32,
82 spot_light_shadowmap_offset: i32,
83 ambient_light_flags: u32,
84 n_rect_lights: u32,
85 rect_lights: array<RectLight, u32(constants::MAX_RECT_LIGHTS)>,
86};
88const AMBIENT_LIGHT_FLAGS_AFFECTS_LIGHTMAPPED_MESHES_BIT: u32 = 1u << 0u;
90struct Fog {
91 base_color: vec4<f32>,
92 directional_light_color: vec4<f32>,
93 /// `be` and `bi` are allocated differently depending on the fog mode
94 ///
95 /// For Linear Fog:
96 /// be.x = start, be.y = end
97 /// For Exponential and ExponentialSquared Fog:
98 /// be.x = density
99 /// For Atmospheric Fog:
100 /// be = per-channel extinction density
101 /// bi = per-channel inscattering density
102 be: vec3<f32>,
103 directional_light_exponent: f32,
104 bi: vec3<f32>,
105 mode: u32,
108// Important: These must be kept in sync with `fog.rs`
109const FOG_MODE_OFF: u32 = 0u;
110const FOG_MODE_LINEAR: u32 = 1u;
111const FOG_MODE_EXPONENTIAL: u32 = 2u;
112const FOG_MODE_EXPONENTIAL_SQUARED: u32 = 3u;
113const FOG_MODE_ATMOSPHERIC: u32 = 4u;
115@if(AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
116struct ClusteredLights {
117 data: array<ClusteredLight>,
118};
119@if(AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
120struct ClusterableObjectIndexLists {
121 data: array<u32>,
122};
123@if(AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
124struct ClusterOffsetsAndCounts {
125 data: array<array<vec4<u32>, 2>>,
126};
127@if(!AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
128struct ClusteredLights {
129 data: array<ClusteredLight, 204u>,
130};
131@if(!AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
132struct ClusterableObjectIndexLists {
133 /// each u32 contains 4 u8 indices into the ClusterableObjects array
134 data: array<vec4<u32>, 1024u>,
135};
136@if(!AVAILABLE_STORAGE_BUFFER_BINDINGS__GE_3)
137struct ClusterOffsetsAndCounts {
138 /// each u32 contains a 24-bit index into ClusterableObjectIndexLists in the high 24 bits
139 /// and an 8-bit count of the number of lights in the low 8 bits
140 data: array<vec4<u32>, 1024u>,
141};
143/// Whether this light probe contributes diffuse light to lightmapped meshes.
144const LIGHT_PROBE_FLAG_AFFECTS_LIGHTMAPPED_MESH_DIFFUSE: u32 = 1;
145/// Whether this light probe has parallax correction enabled.
146const LIGHT_PROBE_FLAG_PARALLAX_CORRECT: u32 = 2;
148struct LightProbe {
149 /// This is stored as the transpose in order to save space in this structure.
150 /// It'll be transposed in the `environment_map_light` function.
151 light_from_world_transposed: mat3x4<f32>,
152 /// The falloff region, specified as a fraction of the light probe's
153 /// bounding box.
154 falloff: vec3<f32>,
155 bounding_sphere_radius: f32,
156 /// The boundaries of the simulated space used for parallax correction,
157 /// specified as *half* extents in light probe space.
158 parallax_correction_bounds: vec3<f32>,
159 intensity: f32,
160 world_position: vec3<f32>,
161 cubemap_index: i32,
162 /// Various flags that apply to this light probe.
163 flags: u32,
164};
166struct LightProbes {
167 /// This must match `MAX_VIEW_LIGHT_PROBES` on the Rust side.
168 reflection_probes: array<LightProbe, 8u>,
169 irradiance_volumes: array<LightProbe, 8u>,
170 reflection_probe_count: i32,
171 irradiance_volume_count: i32,
172 /// The index of the view environment map cubemap binding, or -1 if there's
173 /// no such cubemap.
174 view_cubemap_index: i32,
175 /// The smallest valid mipmap level for the specular environment cubemap
176 /// associated with the view.
177 smallest_specular_mip_level_for_view: u32,
178 view_rotation: vec4<f32>,
179 /// The intensity of the environment map associated with the view.
180 intensity_for_view: f32,
181 /// Whether the environment map attached to the view affects the diffuse
182 /// lighting for lightmapped meshes.
183 view_environment_map_affects_lightmapped_mesh_diffuse: u32,
184};
186/// Settings for screen space reflections.
187///
188/// For more information on these settings, see the documentation for
189/// `package::ssr::ScreenSpaceReflections`.
190struct ScreenSpaceReflectionsSettings {
191 min_perceptual_roughness: f32,
192 min_perceptual_roughness_fully_active: f32,
193 max_perceptual_roughness_starts_to_fade: f32,
194 max_perceptual_roughness: f32,
195 edge_fadeout_fully_active: f32,
196 edge_fadeout_no_longer_active: f32,
197 thickness: f32,
198 linear_steps: u32,
199 linear_march_exponent: f32,
200 bisection_steps: u32,
201 use_secant: u32,
202};
204/// See the `ContactShadows` rust struct.
205struct ContactShadowsSettings {
206 linear_steps: u32,
207 thickness: f32,
208 length: f32,
209 @if(SIXTEEN_BYTE_ALIGNMENT)
210 _padding: f32,
211};
213struct EnvironmentMapUniform {
214 /// Transformation matrix for the environment cubemaps in world space.
215 transform: mat4x4<f32>,
216};
218/// Shader version of the order independent transparency settings component.
219struct OrderIndependentTransparencySettings {
220 sorted_fragment_max_count: u32,
221 fragments_per_pixel_average: f32,
222 alpha_threshold: f32,
223};
225struct OitFragmentNode {
226 color: u32,
227 depth_alpha: u32,
228 next: u32,
229};
231struct ClusteredDecal {
232 local_from_world: mat4x4<f32>,
233 base_color_texture_index: i32,
234 normal_map_texture_index: i32,
235 metallic_roughness_texture_index: i32,
236 emissive_texture_index: i32,
237 world_position: vec3<f32>,
238 bounding_sphere_radius: f32,
239 tag: u32,
240 pad_a: u32,
241 pad_b: u32,
242 pad_c: u32,
245struct ClusteredDecals {
246 decals: array<ClusteredDecal>,
Contents