Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gif link: https://i.imgur.com/jYUGG9g.gifv
- world download: http://www.mediafire.com/file/783knd4dq86vv90/shader_toggle.zip/file
- (the used resource pack is inside)
- Small disclaimer: I have no idea what I'm doing so bear with me if I'm using the wrong word for something. (or if the shader file in the world has some weird code)
- THE WAY IT WORKS:
- First of all:
- There is a glowing nogravity falling lava block 20 blocks in front of the player. Why? because when an entity is glowing the game turns on a shader called entity_outline. This is the main shader I'm using. The falling block is a lava block because it doesn't glow, but still makes the shader turn on.
- So: the shader entity_outline is always on.
- The trick:
- Inside of a shader you can check the color of a pixel on the screen and do one thing if its, let's say blue and another thing if its red. This means that if you can toggle the color of that pixel on the player's screen you can toggle what the shader does with "if else" by checking if the pixel is fx blue.
- So how do you toggle a pixel on the player's screen?:
- Back when "Super secret settings" was a thing you might remember the phosphor shader, it made pixels kinda stay on the screen for a little bit every time you looked around. And that's the key! You can make "old pixels" stay on the screen.
- How I did it:
- Inside the entity_outline shader I have made it so if a pixel is up in the corner and it's 100% red and 100% green I draw the pixel. If it's not 100% red and 100% green but still up in the corner I chose to ignore the pixel and keep the old correct pixel (correct as in it's 100% red and 100% green). This means that if something 100% red and 100% green flashes in front of the player's screen the color will be remembered up in the corner. After that, I check how blue the pixel is with "if else" stuff and then chose how the shader should work.
- The way I'm flashing the player's screen is by placing colored blocks in front of them and to make sure that the player won't notice I have chosen to make 100% red and 100% green pixels which are not in the corner just show the old pixels which were there before I flashed their screen with the colored blocks.
- End:
- I hope my explanation makes sense. And I can't wait to see maps using shaders =D
- -Vilder50
Add Comment
Please, Sign In to add comment