From 3ff3f6c3a31f22a9c78407418b951fbd5300d9de Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sat, 20 Jul 2024 16:40:03 +0700 Subject: [PATCH] - [Preview Panel] Fix channel selector shows up incorrectly in sdf mode. --- scripts/panel_preview/panel_preview.gml | 6 ++++-- shaders/sh_rm_primitive/sh_rm_primitive.fsh | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 2ab65e948..2b5f96231 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -1954,8 +1954,10 @@ function Panel_Preview() : PanelContent() constructor { draw_set_color(COLORS.panel_toolbar_separator); draw_line_width(tbx + ui(12), tby - toolbar_height / 2 + ui(8), tbx + ui(12), tby + toolbar_height / 2 - ui(8), 2); - if(d3_active) drawNodeChannel3D(tbx, tby); - else drawNodeChannel(tbx, tby); + if(d3_active && _node && _node.is_3D == NODE_3D.polygon) + drawNodeChannel3D(tbx, tby); + else + drawNodeChannel(tbx, tby); } #endregion function drawSplitView() { #region diff --git a/shaders/sh_rm_primitive/sh_rm_primitive.fsh b/shaders/sh_rm_primitive/sh_rm_primitive.fsh index 8df320e66..24e079b44 100644 --- a/shaders/sh_rm_primitive/sh_rm_primitive.fsh +++ b/shaders/sh_rm_primitive/sh_rm_primitive.fsh @@ -874,17 +874,23 @@ vec4 scene() { } } + vec3 ref = reflect(dir, norm); + vec3 bgClr = background.rgb; + // if(useEnv == 1) { + // vec4 refC = sampleTexture(0, equirectangularUv(norm), 0); + // bgClr *= refC.rgb; + // } + /////////////////////////////////////////////////////////// float distNorm = (depth - viewRange.x) / (viewRange.y - viewRange.x); distNorm = 1. - distNorm; distNorm = smoothstep(.0, .3, distNorm); - c = mix(c * background.rgb, c, mix(1., distNorm, depthInt)); + c = mix(c * bgClr, c, mix(1., distNorm, depthInt)); /////////////////////////////////////////////////////////// if(useEnv == 1) { - vec3 ref = reflect(dir, norm); vec4 refC = sampleTexture(0, equirectangularUv(ref), 0); c = mix(c, c * refC.rgb, refl); } @@ -893,7 +899,7 @@ vec4 scene() { vec3 light = normalize(lightPosition); float lamo = min(1., max(0., dot(norm, light)) + ambientIntns); - c = mix(c * background.rgb, c, lamo); + c = mix(c * bgClr, c, lamo); ///////////////////////////////////////////////////////////