summaryrefslogtreecommitdiff
path: root/servers/rendering
diff options
context:
space:
mode:
authorJesse Dubay <jesse@jessedubay.com>2022-03-05 17:49:32 -0800
committerJesse Dubay <jesse@jessedubay.com>2022-03-05 17:49:32 -0800
commit80345f7d4e5a5b1706d63df1eab48ee95b85e787 (patch)
tree103e5b3117b0ecb420e6540c2a05d6cdd033c95d /servers/rendering
parentd37e8586becf5e3abda5d3b13a06e4fd664364bc (diff)
Fix flipped EYEDIR.z in sky shaders
Diffstat (limited to 'servers/rendering')
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp2
-rw-r--r--servers/rendering/renderer_rd/shaders/sky.glsl9
2 files changed, 6 insertions, 5 deletions
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index b44ae6cf8d..369e8192c1 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -837,7 +837,7 @@ void RendererSceneSkyRD::init(RendererStorageRD *p_storage) {
actions.renames["COLOR"] = "color";
actions.renames["ALPHA"] = "alpha";
- actions.renames["EYEDIR"] = "cube_normal";
+ actions.renames["EYEDIR"] = "eyedir";
actions.renames["POSITION"] = "params.position_multiplier.xyz";
actions.renames["SKY_COORDS"] = "panorama_coords";
actions.renames["SCREEN_UV"] = "uv";
diff --git a/servers/rendering/renderer_rd/shaders/sky.glsl b/servers/rendering/renderer_rd/shaders/sky.glsl
index b258e89c66..d63444456a 100644
--- a/servers/rendering/renderer_rd/shaders/sky.glsl
+++ b/servers/rendering/renderer_rd/shaders/sky.glsl
@@ -199,14 +199,15 @@ void main() {
vec4 quarter_res_color = vec4(1.0);
vec4 custom_fog = vec4(0.0);
+ vec3 eyedir = cube_normal;
+ eyedir.z *= -1.0;
+
#ifdef USE_CUBEMAP_PASS
- vec3 inverted_cube_normal = cube_normal;
- inverted_cube_normal.z *= -1.0;
#ifdef USES_HALF_RES_COLOR
- half_res_color = texture(samplerCube(half_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), inverted_cube_normal) * params.luminance_multiplier;
+ half_res_color = texture(samplerCube(half_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), eyedir) * params.luminance_multiplier;
#endif
#ifdef USES_QUARTER_RES_COLOR
- quarter_res_color = texture(samplerCube(quarter_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), inverted_cube_normal) * params.luminance_multiplier;
+ quarter_res_color = texture(samplerCube(quarter_res, material_samplers[SAMPLER_LINEAR_WITH_MIPMAPS_CLAMP]), eyedir) * params.luminance_multiplier;
#endif
#else
#ifdef USES_HALF_RES_COLOR