2022-09-07 21:23:01 +10:00
|
|
|
// Scene data stores all our 3D rendering globals for a frame such as our matrices
|
|
|
|
|
// where this information is independent of the different RD implementations.
|
|
|
|
|
// This enables us to use this UBO in our main scene render shaders but also in
|
|
|
|
|
// effects that need access to this data.
|
|
|
|
|
|
2024-06-13 15:16:18 -07:00
|
|
|
#define SCENE_DATA_FLAGS_USE_AMBIENT_LIGHT (1 << 0)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_AMBIENT_CUBEMAP (1 << 1)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_REFLECTION_CUBEMAP (1 << 2)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_ROUGHNESS_LIMITER (1 << 3)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_FOG (1 << 4)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_UV2_MATERIAL (1 << 5)
|
|
|
|
|
#define SCENE_DATA_FLAGS_USE_PANCAKE_SHADOWS (1 << 6)
|
|
|
|
|
#define SCENE_DATA_FLAGS_IN_SHADOW_PASS (1 << 7)
|
|
|
|
|
|
2022-09-07 21:23:01 +10:00
|
|
|
struct SceneData {
|
2025-05-28 11:58:07 -03:00
|
|
|
mat4 projection_matrix;
|
|
|
|
|
mat4 inv_projection_matrix;
|
2025-06-23 23:06:11 -07:00
|
|
|
mat3x4 inv_view_matrix;
|
|
|
|
|
mat3x4 view_matrix;
|
|
|
|
|
|
|
|
|
|
#ifdef USE_DOUBLE_PRECISION
|
|
|
|
|
vec4 inv_view_precision;
|
|
|
|
|
#endif
|
2022-09-07 21:23:01 +10:00
|
|
|
|
|
|
|
|
// only used for multiview
|
2025-05-28 11:58:07 -03:00
|
|
|
mat4 projection_matrix_view[MAX_VIEWS];
|
|
|
|
|
mat4 inv_projection_matrix_view[MAX_VIEWS];
|
|
|
|
|
vec4 eye_offset[MAX_VIEWS];
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2023-01-31 22:53:54 -05:00
|
|
|
// Used for billboards to cast correct shadows.
|
2025-05-28 11:58:07 -03:00
|
|
|
mat4 main_cam_inv_view_matrix;
|
2023-01-31 22:53:54 -05:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
vec2 viewport_size;
|
|
|
|
|
vec2 screen_pixel_size;
|
2022-09-07 21:23:01 +10:00
|
|
|
|
|
|
|
|
// Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted.
|
2025-05-28 11:58:07 -03:00
|
|
|
vec4 directional_penumbra_shadow_kernel[32];
|
|
|
|
|
vec4 directional_soft_shadow_kernel[32];
|
|
|
|
|
vec4 penumbra_shadow_kernel[32];
|
|
|
|
|
vec4 soft_shadow_kernel[32];
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
vec2 shadow_atlas_pixel_size;
|
|
|
|
|
vec2 directional_shadow_pixel_size;
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2025-06-13 16:03:49 -03:00
|
|
|
float radiance_pixel_size;
|
|
|
|
|
float radiance_border_size;
|
|
|
|
|
vec2 reflection_atlas_border_size;
|
|
|
|
|
|
2022-09-07 21:23:01 +10:00
|
|
|
uint directional_light_count;
|
2025-05-28 11:58:07 -03:00
|
|
|
float dual_paraboloid_side;
|
|
|
|
|
float z_far;
|
|
|
|
|
float z_near;
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
float roughness_limiter_amount;
|
|
|
|
|
float roughness_limiter_limit;
|
|
|
|
|
float opaque_prepass_threshold;
|
|
|
|
|
uint flags;
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
mat3 radiance_inverse_xform;
|
2024-06-13 15:16:18 -07:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
vec4 ambient_light_color_energy;
|
2024-06-13 15:16:18 -07:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
float ambient_color_sky_mix;
|
|
|
|
|
float fog_density;
|
|
|
|
|
float fog_height;
|
|
|
|
|
float fog_height_density;
|
2024-06-13 15:16:18 -07:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
float fog_depth_curve;
|
|
|
|
|
float fog_depth_begin;
|
|
|
|
|
float fog_depth_end;
|
|
|
|
|
float fog_sun_scatter;
|
2024-06-13 15:16:18 -07:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
vec3 fog_light_color;
|
|
|
|
|
float fog_aerial_perspective;
|
2022-09-07 21:23:01 +10:00
|
|
|
|
2025-05-28 11:58:07 -03:00
|
|
|
float time;
|
|
|
|
|
float taa_frame_count;
|
2022-09-07 21:23:01 +10:00
|
|
|
vec2 taa_jitter;
|
|
|
|
|
|
2024-06-13 15:16:18 -07:00
|
|
|
float emissive_exposure_normalization;
|
2022-09-18 00:31:43 -05:00
|
|
|
float IBL_exposure_normalization;
|
2022-10-12 19:33:06 -07:00
|
|
|
uint camera_visible_layers;
|
2023-09-22 18:38:02 -03:00
|
|
|
float pass_alpha_multiplier;
|
2022-09-07 21:23:01 +10:00
|
|
|
};
|