-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea316bd
commit 0914a21
Showing
45 changed files
with
2,715 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
game_folder/shaders/compute/main/Illumination_step_GI.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#version 430 | ||
#define group_size 8 | ||
#define block_size 64 | ||
|
||
layout(local_size_x = group_size, local_size_y = group_size) in; | ||
layout(rgba32f, binding = 0) uniform image2D global_illum; | ||
layout(rgba32f, binding = 1) uniform image2D illuminationDirect; | ||
layout(rgba32f, binding = 2) uniform image2D illuminationGI; | ||
layout(rgba32f, binding = 3) uniform image2D DE_input; | ||
layout(rgba32f, binding = 4) uniform image2D color_HDR; //calculate final color | ||
|
||
//make all the local distance estimator spheres shared | ||
shared vec4 de_sph[group_size][group_size]; | ||
|
||
#include<utility/camera.glsl> | ||
#include<utility/shading.glsl> | ||
|
||
///Low-resolution illumination step | ||
|
||
void main() { | ||
|
||
ivec2 global_pos = ivec2(gl_GlobalInvocationID.xy); | ||
ivec2 local_indx = ivec2(gl_LocalInvocationID.xy); | ||
|
||
vec2 img_size = vec2(imageSize(illuminationDirect)); | ||
vec2 pimg_size = vec2(imageSize(DE_input)); | ||
float GIscale = (vec2(imageSize(global_illum)) / img_size).x; | ||
vec2 step_scale = img_size/pimg_size; | ||
|
||
ivec2 prev_pos = min(ivec2((vec2(global_pos)/step_scale) + 0.5),ivec2(pimg_size)-1); | ||
|
||
ray rr = get_ray(vec2(global_pos)/img_size); | ||
vec4 pos = vec4(rr.pos,0); | ||
vec4 dir = vec4(rr.dir,0); | ||
vec4 var = vec4(0); | ||
|
||
vec4 sph = imageLoad(DE_input, prev_pos); | ||
float td = dot(dir.xyz, sph.xyz - pos.xyz);//traveled distance | ||
|
||
pos = sph; | ||
dir.w += td; | ||
|
||
vec4 illumDIR = vec4(0); | ||
vec4 illumGI = vec4(0); | ||
|
||
if(pos.w < max(2*fovray*td, MIN_DIST) && SHADOWS_ENABLED) | ||
{ | ||
//marching towards a point at a distance = to the pixel cone radius from the object | ||
float pix_cone_rad = 2.*fovray*td/step_scale.x; | ||
pos.xyz += (DE(pos.xyz) - pix_cone_rad)*dir.xyz; | ||
pos.xyz += (DE(pos.xyz) - pix_cone_rad)*dir.xyz; | ||
pos.xyz += (DE(pos.xyz) - pix_cone_rad)*dir.xyz; | ||
|
||
illumGI = bilinear_surface(global_illum, td, GIscale, vec2(global_pos)*GIscale); | ||
illumDIR.xyz = sky_color(LIGHT_DIRECTION)*shadow_march(pos, normalize(vec4(LIGHT_DIRECTION,0)), MAX_DIST, LIGHT_ANGLE); | ||
} | ||
illumDIR.w = td; | ||
illumGI.w = td; | ||
|
||
imageStore(illuminationDirect, global_pos, illumDIR); | ||
imageStore(illuminationGI, global_pos, illumGI); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.