diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-01 21:52:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 21:52:24 +0200 |
commit | dbd1a90bd43b461fc2d591659ef6fd0f5879979a (patch) | |
tree | 410d4e19e030cb592039f1337e8af90f7f859184 /servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl | |
parent | f06d201bb7a58e0399278ee29328740ea9efd16b (diff) | |
parent | c76426527be7a99dd3e94ccdc4925475ebef82fd (diff) |
Merge pull request #50942 from BastiaanOlij/cubemap_raster
Porting cubemap compute shaders to raster for the mobile renderer
Diffstat (limited to 'servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl b/servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl new file mode 100644 index 0000000000..b329e67293 --- /dev/null +++ b/servers/rendering/renderer_rd/shaders/cubemap_downsampler_inc.glsl @@ -0,0 +1,48 @@ +layout(push_constant, binding = 1, std430) uniform Params { + uint face_size; + uint face_id; // only used in raster shader +} +params; + +#define M_PI 3.14159265359 + +void get_dir_0(out vec3 dir, in float u, in float v) { + dir[0] = 1.0; + dir[1] = v; + dir[2] = -u; +} + +void get_dir_1(out vec3 dir, in float u, in float v) { + dir[0] = -1.0; + dir[1] = v; + dir[2] = u; +} + +void get_dir_2(out vec3 dir, in float u, in float v) { + dir[0] = u; + dir[1] = 1.0; + dir[2] = -v; +} + +void get_dir_3(out vec3 dir, in float u, in float v) { + dir[0] = u; + dir[1] = -1.0; + dir[2] = v; +} + +void get_dir_4(out vec3 dir, in float u, in float v) { + dir[0] = u; + dir[1] = v; + dir[2] = 1.0; +} + +void get_dir_5(out vec3 dir, in float u, in float v) { + dir[0] = -u; + dir[1] = v; + dir[2] = -1.0; +} + +float calcWeight(float u, float v) { + float val = u * u + v * v + 1.0; + return val * sqrt(val); +} |