32 lines
912 B
GLSL
32 lines
912 B
GLSL
// MinecraftPT — RTWSM Blur Importance
|
|
// Gaussian-blurs the importance map to make the warp smooth.
|
|
|
|
#include "/Lib/Settings.glsl"
|
|
#include "/Lib/Utilities.glsl"
|
|
|
|
const ivec3 workGroups = ivec3(32, 16, 1);
|
|
layout (local_size_x = 32, local_size_y = 32) in;
|
|
|
|
layout (r32f) uniform writeonly image2D img_rtwImportance2D;
|
|
|
|
uniform sampler2D rtwImportance2D;
|
|
|
|
void main(){
|
|
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
|
|
|
|
float importance = 0.0;
|
|
float weightSum = 0.0;
|
|
|
|
int radius = int(RTW_BLUR_FACTOR);
|
|
|
|
for (int i = -radius; i <= radius; i++){
|
|
for (int j = -radius; j <= radius; j++){
|
|
vec2 coord = vec2(texel + ivec2(i, j)) / vec2(RTW_RESOLUTION, RTW_RESOLUTION_Y);
|
|
float w = exp(-(i * i + j * j) / (2.0 * RTW_BLUR_FACTOR * RTW_BLUR_FACTOR));
|
|
importance += textureLod(rtwImportance2D, coord, 0.0).r * w;
|
|
weightSum += w;
|
|
}}
|
|
|
|
imageStore(img_rtwImportance2D, texel, vec4(importance / weightSum));
|
|
}
|