WIP: eevee-next-world-irradiance #108304
@ -17,14 +17,13 @@ void main()
|
||||
lP = pos[gl_VertexID % 6];
|
||||
int cell_index = gl_VertexID / 6;
|
||||
|
||||
ivec3 grid_resolution = textureSize(irradiance_a_tx, 0);
|
||||
ivec3 grid_res = grid_resolution;
|
||||
|
||||
cell = ivec3(cell_index / (grid_resolution.z * grid_resolution.y),
|
||||
(cell_index / grid_resolution.z) % grid_resolution.y,
|
||||
cell_index % grid_resolution.z);
|
||||
cell = ivec3(cell_index / (grid_res.z * grid_res.y),
|
||||
(cell_index / grid_res.z) % grid_res.y,
|
||||
cell_index % grid_res.z);
|
||||
|
||||
vec3 ws_cell_pos = lightprobe_irradiance_grid_sample_position(
|
||||
grid_to_world, grid_resolution, cell);
|
||||
vec3 ws_cell_pos = lightprobe_irradiance_grid_sample_position(grid_to_world, grid_res, cell);
|
||||
|
||||
vec3 vs_offset = vec3(lP, 0.0) * sphere_radius;
|
||||
vec3 vP = (ViewMatrix * vec4(ws_cell_pos, 1.0)).xyz + vs_offset;
|
||||
|
@ -25,7 +25,7 @@ vec3 lightprobe_irradiance_grid_atlas_coord(IrradianceGridData grid_data, vec3 l
|
||||
int brick_index = lightprobe_irradiance_grid_brick_index_get(grid_data, brick_coord);
|
||||
|
||||
IrradianceBrick brick = irradiance_brick_unpack(bricks_infos_buf[brick_index]);
|
||||
vec3 output_coord = vec3(brick.atlas_coord, 0.0) + brick_lP;
|
||||
vec3 output_coord = vec3(vec2(brick.atlas_coord), 0.0) + brick_lP;
|
||||
|
||||
return output_coord;
|
||||
}
|
||||
|
@ -33,12 +33,12 @@ void irradiance_capture(Surfel surfel_emitter, vec3 P, inout SphericalHarmonicL1
|
||||
|
||||
void main()
|
||||
{
|
||||
if (any(greaterThanEqual(gl_GlobalInvocationID, capture_info_buf.irradiance_grid_size))) {
|
||||
ivec3 grid_coord = ivec3(gl_GlobalInvocationID);
|
||||
|
||||
if (any(greaterThanEqual(grid_coord, capture_info_buf.irradiance_grid_size))) {
|
||||
return;
|
||||
}
|
||||
|
||||
ivec3 grid_coord = ivec3(gl_GlobalInvocationID);
|
||||
|
||||
vec3 P = lightprobe_irradiance_grid_sample_position(
|
||||
capture_info_buf.irradiance_grid_local_to_world,
|
||||
capture_info_buf.irradiance_grid_size,
|
||||
|
@ -2,10 +2,10 @@
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_math_vector_lib.glsl)
|
||||
|
||||
vec3 lightprobe_irradiance_grid_sample_position(mat4 grid_local_to_world,
|
||||
ivec3 grid_resolution,
|
||||
ivec3 grid_res,
|
||||
ivec3 cell_coord)
|
||||
{
|
||||
vec3 ls_cell_pos = (vec3(cell_coord) + vec3(0.5)) / vec3(grid_resolution);
|
||||
vec3 ls_cell_pos = (vec3(cell_coord) + vec3(0.5)) / vec3(grid_res);
|
||||
ls_cell_pos = ls_cell_pos * 2.0 - 1.0;
|
||||
vec3 ws_cell_pos = (grid_local_to_world * vec4(ls_cell_pos, 1.0)).xyz;
|
||||
return ws_cell_pos;
|
||||
|
@ -187,12 +187,12 @@ void shadow_tag_usage(vec3 vP, vec3 P, vec2 pixel)
|
||||
shadow_tag_usage(vP, P, vec3(0), 0, dist_to_cam, pixel);
|
||||
}
|
||||
|
||||
void shadow_tag_usage_surfel(Surfel surfel, int directional_level)
|
||||
void shadow_tag_usage_surfel(Surfel surfel, int directional_lvl)
|
||||
{
|
||||
vec3 P = surfel.position;
|
||||
|
||||
LIGHT_FOREACH_BEGIN_DIRECTIONAL (light_cull_buf, l_idx) {
|
||||
shadow_tag_usage_tilemap_directional_at_level(l_idx, P, directional_level);
|
||||
shadow_tag_usage_tilemap_directional_at_level(l_idx, P, directional_lvl);
|
||||
}
|
||||
LIGHT_FOREACH_END
|
||||
|
||||
|
@ -21,7 +21,7 @@ vec3 finalize_integration(vec4 radiance)
|
||||
|
||||
void main()
|
||||
{
|
||||
int surfel_index = int(gl_GlobalInvocationID);
|
||||
int surfel_index = int(gl_GlobalInvocationID.x);
|
||||
if (surfel_index >= capture_info_buf.surfel_len) {
|
||||
return;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
int surfel_index = int(gl_GlobalInvocationID);
|
||||
int surfel_index = int(gl_GlobalInvocationID.x);
|
||||
if (surfel_index >= capture_info_buf.surfel_len) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ bool is_valid_surfel_link(int a, int b)
|
||||
|
||||
void main()
|
||||
{
|
||||
int list_index = int(gl_GlobalInvocationID);
|
||||
int list_index = int(gl_GlobalInvocationID.x);
|
||||
if (list_index >= list_info_buf.list_max) {
|
||||
return;
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ void radiance_transfer(inout Surfel surfel, Surfel surfel_emitter)
|
||||
|
||||
void main()
|
||||
{
|
||||
int surfel_index = int(gl_GlobalInvocationID);
|
||||
if (surfel_index >= capture_info_buf.surfel_len) {
|
||||
int surfel_index = int(gl_GlobalInvocationID.x);
|
||||
if (surfel_index >= int(capture_info_buf.surfel_len)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,8 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels)
|
||||
.do_static_compilation(true)
|
||||
.local_group_size(SURFEL_GROUP_SIZE)
|
||||
.storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
|
||||
.storage_buf(7, Qualifier::READ_WRITE, "ShadowTileDataPacked", "tiles_buf[]")
|
||||
/* ShadowTileDataPacked is uint. But MSL translation need the real type. */
|
||||
.storage_buf(7, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
|
||||
.push_constant(Type::INT, "directional_level")
|
||||
.push_constant(Type::FLOAT, "tilemap_projection_ratio")
|
||||
.additional_info("eevee_shared",
|
||||
|
Loading…
Reference in New Issue
Block a user