6995b0429c
Various fixes to UV2 unwrapping and the GPU lightmapper. Listed here for context in case of git blame/bisect: * Fix UV2 unwrapping on import, also cleaned up the unwrap cache code. * Fix saving of RGBA images in EXR format. * Fixes to the GPU lightmapper: - Added padding between atlas elements, avoids bleeding. - Remove old SDF generation code. - Fix baked attenuation for Omni/Spot lights. - Fix baking of material properties onto UV2 (wireframe was wrongly used before). - Disable statically baked lights for objects that have a lightmap texture to avoid applying the same light twice. - Fix lightmap pairing in RendererSceneCull. - Fix UV2 array generated from `RenderingServer::mesh_surface_get_arrays()`. - Port autoexposure fix for OIDN from 3.x. - Save debug textures as EXR when using floating point format.
87 lines
2 KiB
GLSL
87 lines
2 KiB
GLSL
#define LIGHT_BAKE_DISABLED 0
|
|
#define LIGHT_BAKE_DYNAMIC 1
|
|
#define LIGHT_BAKE_STATIC 2
|
|
|
|
struct LightData { //this structure needs to be as packed as possible
|
|
vec3 position;
|
|
float inv_radius;
|
|
|
|
vec3 direction;
|
|
float size;
|
|
|
|
vec3 color;
|
|
float attenuation;
|
|
|
|
float cone_attenuation;
|
|
float cone_angle;
|
|
float specular_amount;
|
|
bool shadow_enabled;
|
|
|
|
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
|
|
uint mask;
|
|
float shadow_volumetric_fog_fade;
|
|
uint bake_mode;
|
|
vec4 projector_rect; //projector rect in srgb decal atlas
|
|
};
|
|
|
|
#define REFLECTION_AMBIENT_DISABLED 0
|
|
#define REFLECTION_AMBIENT_ENVIRONMENT 1
|
|
#define REFLECTION_AMBIENT_COLOR 2
|
|
|
|
struct ReflectionData {
|
|
vec3 box_extents;
|
|
float index;
|
|
vec3 box_offset;
|
|
uint mask;
|
|
vec3 ambient; // ambient color
|
|
float intensity;
|
|
bool exterior;
|
|
bool box_project;
|
|
uint ambient_mode;
|
|
uint pad;
|
|
//0-8 is intensity,8-9 is ambient, mode
|
|
mat4 local_matrix; // up to here for spot and omni, rest is for directional
|
|
// notes: for ambientblend, use distance to edge to blend between already existing global environment
|
|
};
|
|
|
|
struct DirectionalLightData {
|
|
vec3 direction;
|
|
float energy;
|
|
vec3 color;
|
|
float size;
|
|
float specular;
|
|
uint mask;
|
|
float softshadow_angle;
|
|
float soft_shadow_scale;
|
|
bool blend_splits;
|
|
bool shadow_enabled;
|
|
float fade_from;
|
|
float fade_to;
|
|
uvec2 pad;
|
|
uint bake_mode;
|
|
float shadow_volumetric_fog_fade;
|
|
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;
|
|
vec4 shadow_color1;
|
|
vec4 shadow_color2;
|
|
vec4 shadow_color3;
|
|
vec4 shadow_color4;
|
|
vec2 uv_scale1;
|
|
vec2 uv_scale2;
|
|
vec2 uv_scale3;
|
|
vec2 uv_scale4;
|
|
};
|