Debian Codegraph @

servers/rendering/renderer_rd/shaders/scene_data_inc.glsl

raw
1 // Scene data stores all our 3D rendering globals for a frame such as our matrices
2 // where this information is independent of the different RD implementations.
3 // This enables us to use this UBO in our main scene render shaders but also in
4 // effects that need access to this data.
5
6 #define SCENE_DATA_FLAGS_USE_AMBIENT_LIGHT (1 << 0)
7 #define SCENE_DATA_FLAGS_USE_AMBIENT_CUBEMAP (1 << 1)
8 #define SCENE_DATA_FLAGS_USE_REFLECTION_CUBEMAP (1 << 2)
9 #define SCENE_DATA_FLAGS_USE_ROUGHNESS_LIMITER (1 << 3)
10 #define SCENE_DATA_FLAGS_USE_FOG (1 << 4)
11 #define SCENE_DATA_FLAGS_USE_UV2_MATERIAL (1 << 5)
12 #define SCENE_DATA_FLAGS_USE_PANCAKE_SHADOWS (1 << 6)
13 #define SCENE_DATA_FLAGS_IN_SHADOW_PASS (1 << 7)
14
15 struct SceneData {
16 mat4 projection_matrix;
17 mat4 inv_projection_matrix;
18 mat3x4 inv_view_matrix;
19 mat3x4 view_matrix;
20
21 #ifdef USE_DOUBLE_PRECISION
22 vec4 inv_view_precision;
23 #endif
24
25 // only used for multiview
26 mat4 projection_matrix_view[MAX_VIEWS];
27 mat4 inv_projection_matrix_view[MAX_VIEWS];
28 vec4 eye_offset[MAX_VIEWS];
29
30 // Used for billboards to cast correct shadows.
31 mat4 main_cam_inv_view_matrix;
32
33 vec2 viewport_size;
34 vec2 screen_pixel_size;
35
36 // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted.
37 vec4 directional_penumbra_shadow_kernel[32];
38 vec4 directional_soft_shadow_kernel[32];
39 vec4 penumbra_shadow_kernel[32];
40 vec4 soft_shadow_kernel[32];
41
42 vec2 shadow_atlas_pixel_size;
43 vec2 directional_shadow_pixel_size;
44
45 float radiance_pixel_size;
46 float radiance_border_size;
47 vec2 reflection_atlas_border_size;
48
49 uint directional_light_count;
50 float dual_paraboloid_side;
51 float z_far;
52 float z_near;
53
54 float roughness_limiter_amount;
55 float roughness_limiter_limit;
56 float opaque_prepass_threshold;
57 uint flags;
58
59 mat3 radiance_inverse_xform;
60
61 vec4 ambient_light_color_energy;
62
63 float ambient_color_sky_mix;
64 float fog_density;
65 float fog_height;
66 float fog_height_density;
67
68 float fog_depth_curve;
69 float fog_depth_begin;
70 float fog_depth_end;
71 float fog_sun_scatter;
72
73 vec3 fog_light_color;
74 float fog_aerial_perspective;
75
76 float time;
77 float taa_frame_count;
78 vec2 taa_jitter;
79
80 float emissive_exposure_normalization;
81 float IBL_exposure_normalization;
82 uint camera_visible_layers;
83 float pass_alpha_multiplier;
84 };