https://github.com/HalbFettKaese/common-shaders
To use this pack, download the shader pack and go to "minecraft/assets/shaders/program/toggler/shader.fsh". A switch is implemented which triggers for cases of "blue" for channel 1 and 2 which lie at row 1 and 2 of the controller buffer. Row 0 contains a timer that counts up and can also be used if a timer is needed. Additionally, an overlay variable was added if you want to add an overlay to the screen, just load a texture onto that variable before the mixing line at the bottom of the file.
Channel 1 is specified by R=255 and G=253, to change the B value of it use:
particle minecraft:entity_effect ~ ~ ~ 0.9960784313725490196078431372549 0.9921568627450980392156862745098 B 1 0 force @s
Channel 2 is specified by R=255 and G=252, to change the B value of it use:
particle minecraft:entity_effect ~ ~ ~ 0.9960784313725490196078431372549 0.98823529411764705882352941176471 B 1 0 force @s
In the "flashlight" example files, right clicking a carrot on a stick causes the flashlight to turn on/off. While the flashlight is on "battery" scoreboard is drained, and as it goes down the overlay in the top left corner indicates battery level. This example demonstrates the two channel handling. The battery display can operate independent of the flashlight as it is on the Blue channel and the flashlight is on the Green.
Note: The datapack implementation makes the flashlight multiplay friendly.
The screen shake example shakes the screen with a fixed frequency and magnitude when Channel #1's blue particle is set to 0.003921568627451 (this is 1/255). The advanced screen shake example allows you to control the magnitude with a scoreboard which controls Channel #1 and the frequency with a scoreboard which controls Channel #2. Macros from 1.20.2 are used to simplify the particle selection.
The phosphor example implements the vanilla shader "phosphor" as a togglable effect with the shader selector. A new target is added to the post to hold the previous frame. Controlling the vec3 Phosphor variable inside shader.fsh will control the strength of the effect (0-1).
The particles core shader contains information about all particles displayed to the player. The entity_effect particle will appear in the buffer regardless of where it is played. For this reason, the core shader looks for particles whose color matches the R and G values, and those particles are put in the bottom left corner of the screen. From there, the transparency shader reads the value stored at the specific location on the particle buffer (0,1), and if it is correct it puts the color onto the control buffer in the location it is meant to go (row 1 for channel 1, row 2 for channel 2). Then the control buffer can be read by other program shaders to make decisions.
Cloud Wolf 🔨 |
The Der Discohund / HalbFettKaese 💡 |
RitikShah 💡 |
Sir Benet 💡 |