From e50590f6b760d36a1d7511ccb25678825737951c Mon Sep 17 00:00:00 2001 From: JozsefA Date: Sun, 18 Apr 2021 22:23:41 -0700 Subject: [PATCH] Start working on the blocks - Also better control and visuals --- .../java/com/simibubi/create/AllBlocks.java | 26 ++--- .../simibubi/create/AllContainerTypes.java | 4 + .../com/simibubi/create/AllTileEntities.java | 2 +- .../curiosities/ChromaticProjectorBlock.java | 27 ------ .../ChromaticProjectorTileEntity.java | 10 -- .../projector/ChromaticProjectorBlock.java | 52 ++++++++++ .../ChromaticProjectorContainer.java | 33 +++++++ .../projector/ChromaticProjectorScreen.java | 62 ++++++++++++ .../ChromaticProjectorTileEntity.java | 40 ++++++++ .../create/foundation/gui/AllGuiTextures.java | 2 + .../backend/effects/EffectsHandler.java | 37 ++++++-- .../backend/effects/SphereFilterProgram.java | 12 +-- .../create/flywheel/shaders/area_effect.frag | 89 ++++++++++++------ .../assets/create/textures/gui/projector.png | Bin 0 -> 2307 bytes 14 files changed, 302 insertions(+), 94 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java delete mode 100644 src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorBlock.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorContainer.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorTileEntity.java create mode 100644 src/main/resources/assets/create/textures/gui/projector.png diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index c1a9c1f7f..e06604377 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -113,6 +113,7 @@ import com.simibubi.create.content.contraptions.relays.encased.GearshiftBlock; import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock; import com.simibubi.create.content.contraptions.relays.gauge.GaugeGenerator; import com.simibubi.create.content.contraptions.relays.gearbox.GearboxBlock; +import com.simibubi.create.content.curiosities.projector.ChromaticProjectorBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelCTBehaviour; @@ -1332,25 +1333,26 @@ public class AllBlocks { .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .cubeAll(c.getName(), p.modLoc("block/brass_storage_block")))) .tag(Tags.Blocks.STORAGE_BLOCKS) - .tag(BlockTags.BEACON_BASE_BLOCKS) - .transform(tagBlockAndItem("storage_blocks/brass")) - .tag(Tags.Items.STORAGE_BLOCKS) - .build() - .register(); + .tag(BlockTags.BEACON_BASE_BLOCKS) + .transform(tagBlockAndItem("storage_blocks/brass")) + .tag(Tags.Items.STORAGE_BLOCKS) + .build() + .register(); static { REGISTRATE.startSection(AllSections.CURIOSITIES); } - public static final BlockEntry CHROMATIC_PROJECTOR = - REGISTRATE.block("chromatic_projector", Block::new) - .initialProperties(() -> Blocks.IRON_BLOCK) - .item() - .build() - .register(); + public static final BlockEntry CHROMATIC_PROJECTOR = + REGISTRATE.block("chromatic_projector", ChromaticProjectorBlock::new) + .initialProperties(() -> Blocks.IRON_BLOCK) + .item() + .build() + .register(); // Load this class - public static void register() {} + public static void register() { + } } diff --git a/src/main/java/com/simibubi/create/AllContainerTypes.java b/src/main/java/com/simibubi/create/AllContainerTypes.java index f7ea37a0c..d17d0ffce 100644 --- a/src/main/java/com/simibubi/create/AllContainerTypes.java +++ b/src/main/java/com/simibubi/create/AllContainerTypes.java @@ -1,5 +1,7 @@ package com.simibubi.create; +import com.simibubi.create.content.curiosities.projector.ChromaticProjectorContainer; +import com.simibubi.create.content.curiosities.projector.ChromaticProjectorScreen; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateContainer; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateScreen; import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer; @@ -32,6 +34,7 @@ public enum AllContainerTypes { FLEXCRATE(AdjustableCrateContainer::new), FILTER(FilterContainer::new), ATTRIBUTE_FILTER(AttributeFilterContainer::new), + CHROMATIC_PROJECTOR(ChromaticProjectorContainer::new), ; @@ -58,6 +61,7 @@ public enum AllContainerTypes { bind(FLEXCRATE, AdjustableCrateScreen::new); bind(FILTER, FilterScreen::new); bind(ATTRIBUTE_FILTER, AttributeFilterScreen::new); + bind(CHROMATIC_PROJECTOR, ChromaticProjectorScreen::new); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 767531933..17e3b9a63 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -116,7 +116,7 @@ import com.simibubi.create.content.contraptions.relays.gearbox.GearboxInstance; import com.simibubi.create.content.contraptions.relays.gearbox.GearboxRenderer; import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity; import com.simibubi.create.content.contraptions.relays.gearbox.GearshiftTileEntity; -import com.simibubi.create.content.curiosities.ChromaticProjectorTileEntity; +import com.simibubi.create.content.curiosities.projector.ChromaticProjectorTileEntity; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelInstance; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelRenderer; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity; diff --git a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java deleted file mode 100644 index 729cdf60f..000000000 --- a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorBlock.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.simibubi.create.content.curiosities; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockReader; - -import javax.annotation.Nullable; - -import com.simibubi.create.AllTileEntities; - -public class ChromaticProjectorBlock extends Block { - public ChromaticProjectorBlock(Properties p_i48440_1_) { - super(p_i48440_1_); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Nullable - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return AllTileEntities.TESTFX.create(); - } -} diff --git a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java deleted file mode 100644 index 8fe2e4644..000000000 --- a/src/main/java/com/simibubi/create/content/curiosities/ChromaticProjectorTileEntity.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.simibubi.create.content.curiosities; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityType; - -public class ChromaticProjectorTileEntity extends TileEntity { - public ChromaticProjectorTileEntity(TileEntityType te) { - super(te); - } -} diff --git a/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorBlock.java b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorBlock.java new file mode 100644 index 000000000..0ae33f6b2 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorBlock.java @@ -0,0 +1,52 @@ +package com.simibubi.create.content.curiosities.projector; + +import javax.annotation.Nullable; + +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.foundation.block.ITE; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.World; +import net.minecraftforge.fml.network.NetworkHooks; + +public class ChromaticProjectorBlock extends Block implements ITE { + public ChromaticProjectorBlock(Properties p_i48440_1_) { + super(p_i48440_1_); + } + + @Override + public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, + BlockRayTraceResult hit) { + if (worldIn.isRemote) + return ActionResultType.SUCCESS; + + withTileEntityDo(worldIn, pos, + te -> NetworkHooks.openGui((ServerPlayerEntity) player, te, te::sendToContainer)); + return ActionResultType.SUCCESS; + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Nullable + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return AllTileEntities.TESTFX.create(); + } + + @Override + public Class getTileEntityClass() { + return ChromaticProjectorTileEntity.class; + } +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorContainer.java b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorContainer.java new file mode 100644 index 000000000..bfe6444ee --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorContainer.java @@ -0,0 +1,33 @@ +package com.simibubi.create.content.curiosities.projector; + +import javax.annotation.Nullable; + +import com.simibubi.create.AllContainerTypes; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.ContainerType; +import net.minecraft.network.PacketBuffer; + +public class ChromaticProjectorContainer extends Container { + + public ChromaticProjectorContainer(int id, PlayerInventory inv, PacketBuffer extraData) { + super(AllContainerTypes.CHROMATIC_PROJECTOR.type, id); + + + } + + public ChromaticProjectorContainer(int id, PlayerInventory inv, ChromaticProjectorTileEntity te) { + super(AllContainerTypes.CHROMATIC_PROJECTOR.type, id); + } + + public ChromaticProjectorContainer(@Nullable ContainerType p_i50105_1_, int p_i50105_2_) { + super(p_i50105_1_, p_i50105_2_); + } + + @Override + public boolean canInteractWith(PlayerEntity p_75145_1_) { + return true; + } +} 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 new file mode 100644 index 000000000..0c5652339 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorScreen.java @@ -0,0 +1,62 @@ +package com.simibubi.create.content.curiosities.projector; + +import java.util.ArrayList; +import java.util.Collections; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.widgets.ScrollInput; +import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; + +public class ChromaticProjectorScreen extends AbstractSimiContainerScreen { + + private ScrollInput filter; + private ScrollInput radius; + private ScrollInput feather; + private ScrollInput fade; + + public ChromaticProjectorScreen(ChromaticProjectorContainer container, PlayerInventory inv, ITextComponent title) { + super(container, inv, title); + } + + @Override + protected void init() { + super.init(); + + widgets.clear(); + + int x = guiLeft + 11; + int y = guiTop + 20; + + ArrayList filterOptions = new ArrayList<>(); + + filterOptions.add(new StringTextComponent("Test")); + filterOptions.add(new StringTextComponent("Test1")); + + filter = new SelectionScrollInput(x, y, 77, 18) + .forOptions(filterOptions); + y += 20; + radius = new ScrollInput(x, y, 30, 20); + y += 20; + feather = new ScrollInput(x, y, 30, 20); + y += 20; + fade = new ScrollInput(x, y, 30, 20); + y += 20; + Collections.addAll(widgets, filter, radius, feather, fade); + + } + + @Override + protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + //AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, guiLeft - 10, guiTop + 145); + AllGuiTextures.PROJECTOR.draw(matrixStack, this, guiLeft, guiTop); +// BG_TOP.draw(matrixStack, this, guiLeft + 20, guiTop); +// BG_BOTTOM.draw(matrixStack, this, guiLeft + 20, guiTop + BG_TOP.height); + + } +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorTileEntity.java new file mode 100644 index 000000000..d7d9974ff --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/projector/ChromaticProjectorTileEntity.java @@ -0,0 +1,40 @@ +package com.simibubi.create.content.curiosities.projector; + +import javax.annotation.Nullable; + +import com.simibubi.create.foundation.render.backend.effects.SphereFilterProgram; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.INamedContainerProvider; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; + +public class ChromaticProjectorTileEntity extends TileEntity implements INamedContainerProvider { + + SphereFilterProgram.FilterSphere filter; + + public ChromaticProjectorTileEntity(TileEntityType te) { + super(te); + } + + public void sendToContainer(PacketBuffer buffer) { + buffer.writeBlockPos(getPos()); + buffer.writeCompoundTag(getUpdateTag()); + } + + @Override + public ITextComponent getDisplayName() { + return new StringTextComponent("Chromatic Projector"); + } + + @Nullable + @Override + public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { + return new ChromaticProjectorContainer(p_createMenu_1_, p_createMenu_2_, this); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java index 610721e21..3db38433b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java @@ -56,6 +56,8 @@ public enum AllGuiTextures implements IScreenRenderable { SEQUENCER_EMPTY("sequencer.png", 0, 102, 162, 22), SEQUENCER_AWAIT("sequencer.png", 0, 160, 162, 22), + PROJECTOR("projector.png", 173, 159), + // JEI JEI_SLOT("jei/widgets.png", 18, 18), JEI_CHANCE_SLOT("jei/widgets.png", 20, 156, 18, 18), diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java b/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java index 749b2ca57..977c8d064 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/effects/EffectsHandler.java @@ -107,7 +107,6 @@ public class EffectsHandler { inverseView.invert(); program.bindInverseView(inverseView); - Vector3d pos1 = new Vector3d(865.5, 79, -240.5); Vector3d cameraPos = gameRenderer.getActiveRenderInfo().getProjectedView(); program.setCameraPos(cameraPos.inverse()); @@ -123,15 +122,39 @@ public class EffectsHandler { // .setFilter(ColorMatrices.hueShiftRGB((float) i / n * 360 + i / 2f))); // } - Matrix4f filter = ColorMatrices.sepia(1f); - program.addSphere(new SphereFilterProgram.FilterSphere() - .setCenter(pos1.subtract(cameraPos)) + .setCenter(new Vector3d(865.5, 79, -240.5).subtract(cameraPos)) .setRadius(10f) .setFeather(3f) - .setFade(1.5f) - .setHsv(false) - .setFilter(filter)); + .setFade(1.8f) + .setDensity(1.3f) + .setFilter(ColorMatrices.grayscale())); + + program.addSphere(new SphereFilterProgram.FilterSphere() + .setCenter(new Vector3d(858.5, 88, -259.5).subtract(cameraPos)) + .setRadius(10f) + .setFeather(3f) + .setFade(1.8f) + .setDensity(1.3f) + .setStrength(1f) + .setFilter(ColorMatrices.sepia(1f))); + + Matrix4f test = ColorMatrices.grayscale(); + Matrix4f colorize = new Matrix4f(); + colorize.a00 = 1f; + colorize.a11 = 0.5f; + colorize.a22 = 0.5f; + colorize.a33 = 1f; + test = colorize; + + program.addSphere(new SphereFilterProgram.FilterSphere() + .setCenter(new Vector3d(2310, 60, -954).subtract(cameraPos)) + .setRadius(8f) + .setFeather(3f) + .setFade(0.1f) + .setDensity(0.5f) + .setStrength(1f) + .setFilter(test)); program.uploadFilters(); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/effects/SphereFilterProgram.java b/src/main/java/com/simibubi/create/foundation/render/backend/effects/SphereFilterProgram.java index 8b885b5b6..4616e8768 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/effects/SphereFilterProgram.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/effects/SphereFilterProgram.java @@ -127,8 +127,8 @@ public class SphereFilterProgram extends GlProgram { public float radius; public float feather; public float fade; + public float density = 2; public float strength = 1; - public boolean hsv; public Matrix4f filter; @@ -152,13 +152,13 @@ public class SphereFilterProgram extends GlProgram { return this; } - public FilterSphere setStrength(float strength) { - this.strength = strength; + public FilterSphere setDensity(float density) { + this.density = density; return this; } - public FilterSphere setHsv(boolean hsv) { - this.hsv = hsv; + public FilterSphere setStrength(float strength) { + this.strength = strength; return this; } @@ -175,8 +175,8 @@ public class SphereFilterProgram extends GlProgram { radius, feather, fade, + density, strength, - hsv ? 1f : 0f, }); buf.put(RenderUtil.writeMatrix(filter)); 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 de6fb2f23..b723dd5e4 100644 --- a/src/main/resources/assets/create/flywheel/shaders/area_effect.frag +++ b/src/main/resources/assets/create/flywheel/shaders/area_effect.frag @@ -16,11 +16,35 @@ uniform vec3 uCameraPos; struct SphereFilter { vec4 sphere;// - vec4 data;// + vec4 data;// mat4 colorOp; }; -#define N 256 +vec3 getPosition(SphereFilter f) { + return f.sphere.xyz; +} + +float getRadius(SphereFilter f) { + return f.sphere.w; +} + +float getFeather(SphereFilter f) { + return f.data.x; +} + +float getFade(SphereFilter f) { + return f.data.y; +} + +float getDensity(SphereFilter f) { + return f.data.z; +} + +float getStrength(SphereFilter f) { + return f.data.w; +} + + #define N 256 layout (std140) uniform Filters { int uCount; SphereFilter uSpheres[N]; @@ -44,65 +68,68 @@ float getDepth() { return linearizeDepth(depth, uNearPlane, uFarPlane); } -float overlayFilterAmount(in vec3 worldPos, in vec4 sphere, in float feather) { +float surfaceFilterStrength(vec3 worldPos, vec4 sphere, float feather) { float distance = distance(sphere.xyz, worldPos); return 1 - smoothstep(sphere.w, sphere.w + feather, distance); } -float sphereFilterAmount(in vec3 worldDir, in float depth, in vec4 sphere, in vec4 data) { - float feathering = 1 - smoothstep(sphere.w + data.x, sphere.w + data.x + data.y, length(sphere.xyz)); - feathering += overlayFilterAmount(worldDir * depth, sphere, data.x); - vec3 oc = -sphere.xyz; +float bubbleFilterStrength(vec3 worldDir, float depth, vec4 sphere, float feather, float density) { + vec3 position = sphere.xyz; float rayLengthSqr = dot(worldDir, worldDir); - float b = 2.0 * dot(-sphere.xyz, worldDir); - float sphereDistSqr = dot(sphere.xyz, sphere.xyz); + float b = 2.0 * dot(-position, worldDir); + float sphereDistSqr = dot(position, position); float b2 = b*b; float d = 4. * rayLengthSqr; float e = 1. / (2.0*rayLengthSqr); - float radius = sphere.w + data.x; + float radius = sphere.w + feather; float c = sphereDistSqr - radius*radius; float discriminant = b2 - d * c; float hitDepth = (-b - sqrt(discriminant)) * e; - + float strength = 0.; if (discriminant > 0 && hitDepth > 0 && hitDepth < depth) { - // float c = sphereDistSqr - sphere.w*sphere.w; - // float discriminant = b2 - d * c; - // float hitDepth = (-b - sqrt(discriminant)) * e; - vec3 hitPos = worldDir * hitDepth; - vec3 normal = normalize(hitPos - sphere.xyz); + vec3 normal = normalize(hitPos - position); float normalDot = dot(normal, normalize(worldDir)); - return feathering + normalDot * normalDot; - } else { - return feathering; + // blend into the effect based on the distance between the fragcoord and point on the sphere + // this avoinds having hard edges + strength += mix(0., normalDot * normalDot * density, clamp(depth - hitDepth, 0., feather + 1.)); } + + return clamp(strength, 0., 1.); } -vec3 applyFilters(in vec3 worldDir, in float depth, in vec3 diffuse) { +float filterStrength(vec3 worldDir, float depth, vec4 sphere, vec4 data) { + float feather = data.x; + + float strength = 0.; + // transition effect + float transitionRadius = sphere.w + feather; + strength += 1. - smoothstep(transitionRadius, transitionRadius + data.y, length(sphere.xyz)); + // surface effect + strength += surfaceFilterStrength(worldDir * depth, sphere, feather); + // bubble effect + strength += bubbleFilterStrength(worldDir, depth, sphere, feather, data.z); + + return strength; +} + +vec3 applyFilters(vec3 worldDir, float depth, vec3 diffuse) { vec3 worldPos = worldDir * depth; - vec3 accum = diffuse; - vec3 diffuseHSV = rgb2hsv(accum); + vec3 accum = vec3(diffuse); for (int i = 0; i < uCount; i++) { SphereFilter s = uSpheres[i]; - //float strength = overlayFilterAmount(worldPos, s.sphere, s.data.x); - float strength = sphereFilterAmount(worldDir, depth, s.sphere, s.data); - - //accum = vec3(strength, strength, strength); - - vec3 toFilter = mix(diffuse, diffuseHSV, s.data.w); + float strength = filterStrength(worldDir, depth, s.sphere, s.data); vec3 filtered = filterColor(s.colorOp, diffuse); - filtered = mix(filtered, hsv2rgbWrapped(filtered), s.data.w); - - accum = mix(accum, filtered, clamp(strength * s.data.z, 0., 1.)); + accum = mix(accum, filtered, clamp(strength * s.data.w, 0., 1.)); } return accum; diff --git a/src/main/resources/assets/create/textures/gui/projector.png b/src/main/resources/assets/create/textures/gui/projector.png new file mode 100644 index 0000000000000000000000000000000000000000..f35f17bc65b433efa833d37e70bec3e2d690ce20 GIT binary patch literal 2307 zcmdT`Sx{418a^Ry&=5!msL&GvL5gY|L2zV8WsyZFZD4F#K)?i%MOz300C$RPymhRI)kktM+Z?Cx`QwD*iFSYfwk6ohCg3TAG6qq#@@ z0#aq7;7D}F63%1q#C4ZU)v>vn2Z~Tt)!ZnlA}q$o$rz=ey3ZB)>aL5s_Q@run!i%D za?0fPntm099UMcQ3~R2;sFE<&%AFjK#BFO#PC-zp z)#+_gVe1})pfFR+3Tc%~9Z?E`aI|Q{Wwd0p->8qN8P|pmu4qyL}2GvEi3(=sQQm{h`J)9;*OoG(JOQz&(d+5IN z@@B0G+jGXqYgG`>CTU^-M+$g+zjcM#AA%V;)aA`LqxR_Jy}10P=rhIb2U}7wWDb6M zN5DeV>_${P>N^Raw6w-=71TXYCM3;Dmdwc6oIxq5Y~4P4^5Jm# z%J)M9`4+TjpCu{8Cet0(nu($JMub8qnxiegrsaEof!=uh5TH=9cN^}PZLgI;Lcw=F zug%C6Ct?E+<(&@;{Pwru3oYU|Wr{{q)6@UpGVf~2RY!O#(UhvMEQPnMGY|VrP5vZu zBHZNAWWsrSTz>EQ+Km{5Y?4Q)@(o_A~qUQz-t;Axxi@*x2 z=5hMYLWC#b^E&@w$v?n(db)kgyEtJ$d+MpV1vM@Ukr0`!q+!%qL~8xX#_zyFzb#xJ z<~o?*PQUAJ^EU}4xJN>ur9U0I2CU*Ke<@i+7Cb}O?BzQsGe(bP6^(xn91K?b%^zb@ z%Tn}?^I?N)if+NmgdT|pBclGtg+Tx>3urpy61fqtL6A}z+E*JoAJyB+n2Oh5rm>N< zJUL}?EF>}%q>LW)JD_J(YNP9sj&HdC@ynFlaq+84bQTt47hs0)QgT&MzE}N`stPtJ z?$u{ftSp2{B_Ak0_eey4DoTTScz@8zkmvbHhqbodvOc9r7AMTkACXfQ&qEeokAgF{ zqE3+sw_v(>NG~l=p>KZ{_BPzG%tfxO_Lg26Oy|GAC@8uO$y9Fgw%#A1!i5d$GVu@pZ27!gkY5b4k=h_tl0SFYR3$tAycSftP|_lzOSXYNCK{tsbM z-}gtTz~XlI{KVAMl)L5a)i|tIrC)mGvU3_c#?*S_Yr{}=l>e49UG1dM zZcJCVnTfH}+Tq)j*NcpKY-&!umS=EOlu7u@7OM$<=jQUbqA1q#^$5oT;UsuILAE`YVXQ3)xkMy(Kh4m{sW!vr>>|HxXl%^flnyU#7-*2$Y*MFKe8NA@AmU3j zC>6ZQCw8r~XkVgGR4TQmtt}k&6?q(#bTQJ9=Nj-Yc)ai%g(J7>fXB~iNE}bb*7f*x z7kSPI--gXG#-9~#p_4h@U|%U~mX&`%!GGN63wSN?c(x*hMg%{ABb6%&0Jw(DcQL@h~(AQ}U@&20t!+V2Ji2Bfr^<|_sr zZIBZ|klCJBiaWhtVr7!1A;9(z!`OmGh62520NKJJW@tcsZUrH(-QeJUf!UcMWCBCr z*)HG;)X8V%#sjSj(GpQA$r}ygpTw;`C=wOu{Hj2Q*MX12H{)j0<#}gE$LY4D!&d@J v`Zb9ycUt$TzgoCA(nFQsH~zOz0YV1NI#gl)%*1oyJ(H`Gn`7lM!Vmuf017q! literal 0 HcmV?d00001