2021-04-25 23:36:39 +02:00
#define LIGHT_BAKE_DISABLED 0
2021-11-26 17:47:37 +01:00
#define LIGHT_BAKE_STATIC 1
#define LIGHT_BAKE_DYNAMIC 2
2021-03-10 22:23:55 +11:00
struct LightData { //this structure needs to be as packed as possible
2025-05-28 11:58:07 -03:00
vec3 position;
float inv_radius;
2021-03-10 22:23:55 +11:00
2025-05-28 11:58:07 -03:00
vec3 direction;
float size;
2021-03-10 22:23:55 +11:00
2025-05-28 11:58:07 -03:00
vec3 color;
float attenuation;
2021-03-10 22:23:55 +11:00
2025-05-28 11:58:07 -03:00
float cone_attenuation;
float cone_angle;
float specular_amount;
float shadow_opacity;
2021-03-10 22:23:55 +11:00
2025-05-28 11:58:07 -03:00
vec4 atlas_rect; // rect in the shadow atlas
mat4 shadow_matrix;
float shadow_bias;
float shadow_normal_bias;
float transmittance_bias;
float soft_shadow_size; // for spot, it's the size in uv coordinates of the light, for omni it's the span angle
float soft_shadow_scale; // scales the shadow kernel for blurrier shadows
2021-03-10 22:23:55 +11:00
uint mask;
2025-05-28 11:58:07 -03:00
float volumetric_fog_energy;
2021-04-25 23:36:39 +02:00
uint bake_mode;
2025-05-28 11:58:07 -03:00
vec4 projector_rect; //projector rect in srgb decal atlas
2021-03-10 22:23:55 +11:00
};
#define REFLECTION_AMBIENT_DISABLED 0
#define REFLECTION_AMBIENT_ENVIRONMENT 1
#define REFLECTION_AMBIENT_COLOR 2
struct ReflectionData {
2025-05-28 11:58:07 -03:00
vec3 box_extents;
float index;
vec3 box_offset;
2021-03-10 22:23:55 +11:00
uint mask;
2025-05-28 11:58:07 -03:00
vec3 ambient; // ambient color
float intensity;
float blend_distance;
2021-03-10 22:23:55 +11:00
bool exterior;
bool box_project;
uint ambient_mode;
2022-07-31 16:20:24 -07:00
float exposure_normalization;
2024-12-03 12:08:36 +01:00
float pad0;
float pad1;
float pad2;
2021-03-10 22:23:55 +11:00
//0-8 is intensity,8-9 is ambient, mode
2025-05-28 11:58:07 -03:00
mat4 local_matrix; // up to here for spot and omni, rest is for directional
2021-03-10 22:23:55 +11:00
// notes: for ambientblend, use distance to edge to blend between already existing global environment
};
struct DirectionalLightData {
2025-05-28 11:58:07 -03:00
vec3 direction;
float energy; // needs to be highp to avoid NaNs being created with high energy values (i.e. when using physical light units and over-exposing the image)
vec3 color;
float size;
float specular;
2021-03-10 22:23:55 +11:00
uint mask;
2025-05-28 11:58:07 -03:00
float softshadow_angle;
float soft_shadow_scale;
2021-03-10 22:23:55 +11:00
bool blend_splits;
2025-05-28 11:58:07 -03:00
float shadow_opacity;
float fade_from;
float fade_to;
2021-04-25 23:36:39 +02:00
uvec2 pad;
uint bake_mode;
2025-05-28 11:58:07 -03:00
float volumetric_fog_energy;
vec4 shadow_bias;
vec4 shadow_normal_bias;
vec4 shadow_transmittance_bias;
vec4 shadow_z_range;
vec4 shadow_range_begin;
vec4 shadow_split_offsets;
mat4 shadow_matrix1;
mat4 shadow_matrix2;
mat4 shadow_matrix3;
mat4 shadow_matrix4;
vec2 uv_scale1;
vec2 uv_scale2;
vec2 uv_scale3;
vec2 uv_scale4;
2021-03-10 22:23:55 +11:00
};