From dc3517eb3ae0fca1e962a58c945d35bbf2469144 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Fri, 30 Apr 2021 14:28:18 -0700 Subject: [PATCH] Inversion --- .../curiosities/projector/ChromaticProjectorScreen.java | 2 +- .../foundation/render/backend/effects/FilterSphere.java | 4 ++-- .../resources/assets/create/flywheel/shaders/area_effect.frag | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java index 076bf77a7..ee0620239 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java @@ -107,7 +107,7 @@ public class ChromaticProjectorScreen extends AbstractSimiScreen { .titled(Lang.translate("gui.chromatic_projector.strength")) .withStepFunction(ctx -> step(ctx, 5)) .calling(tile::setStrength) - .withRange(0, 101) + .withRange(-100, 101) .setState((int) (tile.strength * 100)); Collections.addAll(widgets, blend, rChannel, gChannel, bChannel, fieldEffect, strength); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/effects/FilterSphere.java b/src/main/java/com/simibubi/create/foundation/render/backend/effects/FilterSphere.java index 0b6d4f881..91499610f 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/effects/FilterSphere.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/effects/FilterSphere.java @@ -41,8 +41,8 @@ public class FilterSphere { surface ? 1 : 0, field ? 1 : 0, - strength, - 0, // padding + Math.abs(strength), + strength < 0 ? 1 : 0, rMask ? 1 : 0, gMask ? 1 : 0, diff --git a/src/main/resources/assets/create/flywheel/shaders/area_effect.frag b/src/main/resources/assets/create/flywheel/shaders/area_effect.frag index 86e987ecc..e2e99fc66 100644 --- a/src/main/resources/assets/create/flywheel/shaders/area_effect.frag +++ b/src/main/resources/assets/create/flywheel/shaders/area_effect.frag @@ -17,7 +17,7 @@ uniform vec3 uCameraPos; struct SphereFilter { vec4 sphere;// vec4 d1;// - vec4 strength;// + vec4 strength;// vec4 channelMask;// mat4 colorOp; }; @@ -126,6 +126,8 @@ vec3 applyFilters(vec3 worldDir, float depth, vec3 diffuse) { float strength = filterStrength(worldDir, depth, s); + strength = invert(strength, s.strength.w); + if (strength > 0) { const float fcon = 0.;