feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ layout(set = 1, binding = 1) uniform sampler linear_sampler_mipmaps;
|
|||
|
||||
#define HISTORY_BITS 10
|
||||
|
||||
#define SKY_MODE_DISABLED 0
|
||||
#define SKY_MODE_COLOR 1
|
||||
#define SKY_MODE_SKY 2
|
||||
#define SKY_FLAGS_MODE_COLOR 0x01
|
||||
#define SKY_FLAGS_MODE_SKY 0x02
|
||||
#define SKY_FLAGS_ORIENTATION_SIGN 0x04
|
||||
|
||||
layout(push_constant, std430) uniform Params {
|
||||
vec3 grid_size;
|
||||
|
|
@ -67,12 +67,12 @@ layout(push_constant, std430) uniform Params {
|
|||
ivec2 image_size;
|
||||
|
||||
ivec3 world_offset;
|
||||
uint sky_mode;
|
||||
uint sky_flags;
|
||||
|
||||
ivec3 scroll;
|
||||
float sky_energy;
|
||||
|
||||
vec3 sky_color;
|
||||
vec3 sky_color_or_orientation;
|
||||
float y_mult;
|
||||
|
||||
bool store_ambient_texture;
|
||||
|
|
@ -265,17 +265,22 @@ void main() {
|
|||
}
|
||||
}
|
||||
|
||||
} else if (params.sky_mode == SKY_MODE_SKY) {
|
||||
} else if (bool(params.sky_flags & SKY_FLAGS_MODE_SKY)) {
|
||||
// Reconstruct sky orientation as quaternion and rotate ray_dir before sampling.
|
||||
float sky_sign = bool(params.sky_flags & SKY_FLAGS_ORIENTATION_SIGN) ? 1.0 : -1.0;
|
||||
vec4 sky_quat = vec4(params.sky_color_or_orientation, sky_sign * sqrt(1.0 - dot(params.sky_color_or_orientation, params.sky_color_or_orientation)));
|
||||
vec3 sky_dir = cross(sky_quat.xyz, ray_dir);
|
||||
sky_dir = ray_dir + ((sky_dir * sky_quat.w) + cross(sky_quat.xyz, sky_dir)) * 2.0;
|
||||
#ifdef USE_CUBEMAP_ARRAY
|
||||
light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(ray_dir, 0.0), 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
|
||||
light.rgb = textureLod(samplerCubeArray(sky_irradiance, linear_sampler_mipmaps), vec4(sky_dir, 0.0), 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
|
||||
#else
|
||||
light.rgb = textureLod(samplerCube(sky_irradiance, linear_sampler_mipmaps), ray_dir, 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
|
||||
light.rgb = textureLod(samplerCube(sky_irradiance, linear_sampler_mipmaps), sky_dir, 2.0).rgb; // Use second mipmap because we don't usually throw a lot of rays, so this compensates.
|
||||
#endif
|
||||
light.rgb *= params.sky_energy;
|
||||
light.a = 0.0;
|
||||
|
||||
} else if (params.sky_mode == SKY_MODE_COLOR) {
|
||||
light.rgb = params.sky_color;
|
||||
} else if (bool(params.sky_flags & SKY_FLAGS_MODE_COLOR)) {
|
||||
light.rgb = params.sky_color_or_orientation;
|
||||
light.rgb *= params.sky_energy;
|
||||
light.a = 0.0;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ layout(push_constant, std430) uniform Params {
|
|||
vec4 projection; // only applicable if not multiview
|
||||
vec3 position;
|
||||
float time;
|
||||
vec3 pad;
|
||||
vec2 pad;
|
||||
float luminance_multiplier;
|
||||
float brightness_multiplier;
|
||||
}
|
||||
params;
|
||||
|
||||
|
|
@ -57,8 +58,9 @@ layout(push_constant, std430) uniform Params {
|
|||
vec4 projection; // only applicable if not multiview
|
||||
vec3 position;
|
||||
float time;
|
||||
vec3 pad;
|
||||
vec2 pad;
|
||||
float luminance_multiplier;
|
||||
float brightness_multiplier;
|
||||
}
|
||||
params;
|
||||
|
||||
|
|
@ -106,9 +108,11 @@ layout(set = 0, binding = 3, std140) uniform DirectionalLights {
|
|||
directional_lights;
|
||||
|
||||
#ifdef MATERIAL_UNIFORMS_USED
|
||||
layout(set = 1, binding = 0, std140) uniform MaterialUniforms{
|
||||
/* clang-format off */
|
||||
layout(set = 1, binding = 0, std140) uniform MaterialUniforms {
|
||||
#MATERIAL_UNIFORMS
|
||||
} material;
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
layout(set = 2, binding = 0) uniform textureCube radiance;
|
||||
|
|
@ -187,7 +191,7 @@ void main() {
|
|||
vec3 cube_normal;
|
||||
#ifdef USE_MULTIVIEW
|
||||
// In multiview our projection matrices will contain positional and rotational offsets that we need to properly unproject.
|
||||
vec4 unproject = vec4(uv_interp.x, -uv_interp.y, 0.0, 1.0); // unproject at the far plane
|
||||
vec4 unproject = vec4(uv_interp.x, uv_interp.y, 0.0, 1.0); // unproject at the far plane
|
||||
vec4 unprojected = sky_scene_data.view_inv_projections[ViewIndex] * unproject;
|
||||
cube_normal = unprojected.xyz / unprojected.w;
|
||||
|
||||
|
|
@ -196,7 +200,7 @@ void main() {
|
|||
#else
|
||||
cube_normal.z = -1.0;
|
||||
cube_normal.x = (cube_normal.z * (-uv_interp.x - params.projection.x)) / params.projection.y;
|
||||
cube_normal.y = -(cube_normal.z * (-uv_interp.y - params.projection.z)) / params.projection.w;
|
||||
cube_normal.y = -(cube_normal.z * (uv_interp.y - params.projection.z)) / params.projection.w;
|
||||
#endif
|
||||
cube_normal = mat3(params.orientation) * cube_normal;
|
||||
cube_normal = normalize(cube_normal);
|
||||
|
|
@ -247,17 +251,14 @@ void main() {
|
|||
#endif //USE_CUBEMAP_PASS
|
||||
|
||||
{
|
||||
|
||||
#CODE : SKY
|
||||
|
||||
}
|
||||
|
||||
frag_color.rgb = color;
|
||||
frag_color.a = alpha;
|
||||
|
||||
// For mobile renderer we're multiplying by 0.5 as we're using a UNORM buffer.
|
||||
// For both mobile and clustered, we also bake in the exposure value for the environment and camera.
|
||||
frag_color.rgb = frag_color.rgb * params.luminance_multiplier;
|
||||
// Apply environment 'brightness' setting separately before fog to ensure consistent luminance.
|
||||
frag_color.rgb = frag_color.rgb * params.brightness_multiplier;
|
||||
|
||||
#if !defined(DISABLE_FOG) && !defined(USE_CUBEMAP_PASS)
|
||||
|
||||
|
|
@ -278,6 +279,10 @@ void main() {
|
|||
|
||||
#endif // DISABLE_FOG
|
||||
|
||||
// For mobile renderer we're multiplying by 0.5 as we're using a UNORM buffer.
|
||||
// For both mobile and clustered, we also bake in the exposure value for the environment and camera.
|
||||
frag_color.rgb = frag_color.rgb * params.luminance_multiplier;
|
||||
|
||||
// Blending is disabled for Sky, so alpha doesn't blend.
|
||||
// Alpha is used for subsurface scattering so make sure it doesn't get applied to Sky.
|
||||
if (!AT_CUBEMAP_PASS && !AT_HALF_RES_PASS && !AT_QUARTER_RES_PASS) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ layout(push_constant, std430) uniform Params {
|
|||
}
|
||||
params;
|
||||
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
layout(set = 1, binding = 1) volatile buffer emissive_only_map_buffer {
|
||||
uint emissive_only_map[];
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ layout(set = 1, binding = 2, std140) uniform SceneParams {
|
|||
}
|
||||
scene_params;
|
||||
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
layout(set = 1, binding = 3) volatile buffer density_only_map_buffer {
|
||||
uint density_only_map[];
|
||||
};
|
||||
|
|
@ -77,9 +77,11 @@ layout(r32ui, set = 1, binding = 4) uniform volatile uimage3D light_only_map;
|
|||
#endif
|
||||
|
||||
#ifdef MATERIAL_UNIFORMS_USED
|
||||
layout(set = 2, binding = 0, std140) uniform MaterialUniforms{
|
||||
/* clang-format off */
|
||||
layout(set = 2, binding = 0, std140) uniform MaterialUniforms {
|
||||
#MATERIAL_UNIFORMS
|
||||
} material;
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
#GLOBALS
|
||||
|
|
@ -117,7 +119,7 @@ void main() {
|
|||
if (any(greaterThanEqual(pos, scene_params.fog_volume_size))) {
|
||||
return; //do not compute
|
||||
}
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint lpos = pos.z * scene_params.fog_volume_size.x * scene_params.fog_volume_size.y + pos.y * scene_params.fog_volume_size.x + pos.x;
|
||||
#endif
|
||||
|
||||
|
|
@ -222,7 +224,7 @@ void main() {
|
|||
density *= cull_mask;
|
||||
if (abs(density) > 0.001) {
|
||||
int final_density = int(density * DENSITY_SCALE);
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
atomicAdd(density_only_map[lpos], uint(final_density));
|
||||
#else
|
||||
imageAtomicAdd(density_only_map, pos, uint(final_density));
|
||||
|
|
@ -236,7 +238,7 @@ void main() {
|
|||
uvec3 emission_u = uvec3(emission.r * 511.0, emission.g * 511.0, emission.b * 255.0);
|
||||
// R and G have 11 bits each and B has 10. Then pack them into a 32 bit uint
|
||||
uint final_emission = emission_u.r << 21 | emission_u.g << 10 | emission_u.b;
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint prev_emission = atomicAdd(emissive_only_map[lpos], final_emission);
|
||||
#else
|
||||
uint prev_emission = imageAtomicAdd(emissive_only_map, pos, final_emission);
|
||||
|
|
@ -252,7 +254,7 @@ void main() {
|
|||
if (any(overflowing)) {
|
||||
uvec3 overflow_factor = mix(uvec3(0), uvec3(2047 << 21, 2047 << 10, 1023), overflowing);
|
||||
uint force_max = overflow_factor.r | overflow_factor.g | overflow_factor.b;
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
atomicOr(emissive_only_map[lpos], force_max);
|
||||
#else
|
||||
imageAtomicOr(emissive_only_map, pos, force_max);
|
||||
|
|
@ -267,7 +269,7 @@ void main() {
|
|||
uvec3 scattering_u = uvec3(scattering.r * 2047.0, scattering.g * 2047.0, scattering.b * 1023.0);
|
||||
// R and G have 11 bits each and B has 10. Then pack them into a 32 bit uint
|
||||
uint final_scattering = scattering_u.r << 21 | scattering_u.g << 10 | scattering_u.b;
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint prev_scattering = atomicAdd(light_only_map[lpos], final_scattering);
|
||||
#else
|
||||
uint prev_scattering = imageAtomicAdd(light_only_map, pos, final_scattering);
|
||||
|
|
@ -283,7 +285,7 @@ void main() {
|
|||
if (any(overflowing)) {
|
||||
uvec3 overflow_factor = mix(uvec3(0), uvec3(2047 << 21, 2047 << 10, 1023), overflowing);
|
||||
uint force_max = overflow_factor.r | overflow_factor.g | overflow_factor.b;
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
atomicOr(light_only_map[lpos], force_max);
|
||||
#else
|
||||
imageAtomicOr(light_only_map, pos, force_max);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ params;
|
|||
#ifndef MODE_COPY
|
||||
layout(set = 0, binding = 15) uniform texture3D prev_density_texture;
|
||||
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
layout(set = 0, binding = 16) buffer density_only_map_buffer {
|
||||
uint density_only_map[];
|
||||
};
|
||||
|
|
@ -287,7 +287,7 @@ void main() {
|
|||
if (any(greaterThanEqual(pos, params.fog_volume_size))) {
|
||||
return; //do not compute
|
||||
}
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint lpos = pos.z * params.fog_volume_size.x * params.fog_volume_size.y + pos.y * params.fog_volume_size.x + pos.x;
|
||||
#endif
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ void main() {
|
|||
vec3 total_light = vec3(0.0);
|
||||
|
||||
float total_density = params.base_density;
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint local_density = density_only_map[lpos];
|
||||
#else
|
||||
uint local_density = imageLoad(density_only_map, pos).x;
|
||||
|
|
@ -362,7 +362,7 @@ void main() {
|
|||
total_density += float(int(local_density)) / DENSITY_SCALE;
|
||||
total_density = max(0.0, total_density);
|
||||
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint scattering_u = light_only_map[lpos];
|
||||
#else
|
||||
uint scattering_u = imageLoad(light_only_map, pos).x;
|
||||
|
|
@ -370,7 +370,7 @@ void main() {
|
|||
vec3 scattering = vec3(scattering_u >> 21, (scattering_u << 11) >> 21, scattering_u % 1024) / vec3(2047.0, 2047.0, 1023.0);
|
||||
scattering += params.base_scattering * params.base_density;
|
||||
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
uint emission_u = emissive_only_map[lpos];
|
||||
#else
|
||||
uint emission_u = imageLoad(emissive_only_map, pos).x;
|
||||
|
|
@ -513,6 +513,7 @@ void main() {
|
|||
shadow_sample.z = 1.0 + abs(shadow_sample.z);
|
||||
vec3 pos = vec3(shadow_sample.xy / shadow_sample.z, shadow_len - omni_lights.data[light_index].shadow_bias);
|
||||
pos.z *= omni_lights.data[light_index].inv_radius;
|
||||
pos.z = 1.0 - pos.z;
|
||||
|
||||
pos.xy = pos.xy * 0.5 + 0.5;
|
||||
pos.xy = uv_rect.xy + pos.xy * uv_rect.zw;
|
||||
|
|
@ -710,7 +711,7 @@ void main() {
|
|||
final_density = mix(final_density, reprojected_density, reproject_amount);
|
||||
|
||||
imageStore(density_map, pos, final_density);
|
||||
#ifdef MOLTENVK_USED
|
||||
#ifdef NO_IMAGE_ATOMICS
|
||||
density_only_map[lpos] = 0;
|
||||
light_only_map[lpos] = 0;
|
||||
emissive_only_map[lpos] = 0;
|
||||
|
|
|
|||
|
|
@ -128,38 +128,54 @@ void main() {
|
|||
int index = x + y * 4;
|
||||
float limit = 0.0;
|
||||
if (x < 8) {
|
||||
if (index == 0)
|
||||
if (index == 0) {
|
||||
limit = 0.0625;
|
||||
if (index == 1)
|
||||
}
|
||||
if (index == 1) {
|
||||
limit = 0.5625;
|
||||
if (index == 2)
|
||||
}
|
||||
if (index == 2) {
|
||||
limit = 0.1875;
|
||||
if (index == 3)
|
||||
}
|
||||
if (index == 3) {
|
||||
limit = 0.6875;
|
||||
if (index == 4)
|
||||
}
|
||||
if (index == 4) {
|
||||
limit = 0.8125;
|
||||
if (index == 5)
|
||||
}
|
||||
if (index == 5) {
|
||||
limit = 0.3125;
|
||||
if (index == 6)
|
||||
}
|
||||
if (index == 6) {
|
||||
limit = 0.9375;
|
||||
if (index == 7)
|
||||
}
|
||||
if (index == 7) {
|
||||
limit = 0.4375;
|
||||
if (index == 8)
|
||||
}
|
||||
if (index == 8) {
|
||||
limit = 0.25;
|
||||
if (index == 9)
|
||||
}
|
||||
if (index == 9) {
|
||||
limit = 0.75;
|
||||
if (index == 10)
|
||||
}
|
||||
if (index == 10) {
|
||||
limit = 0.125;
|
||||
if (index == 11)
|
||||
}
|
||||
if (index == 11) {
|
||||
limit = 0.625;
|
||||
if (index == 12)
|
||||
}
|
||||
if (index == 12) {
|
||||
limit = 1.0;
|
||||
if (index == 13)
|
||||
}
|
||||
if (index == 13) {
|
||||
limit = 0.5;
|
||||
if (index == 14)
|
||||
}
|
||||
if (index == 14) {
|
||||
limit = 0.875;
|
||||
if (index == 15)
|
||||
}
|
||||
if (index == 15) {
|
||||
limit = 0.375;
|
||||
}
|
||||
}
|
||||
if (frag_color.a < limit) {
|
||||
discard;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue