if the color is cyan, replace with a 1x1 pixel checker pattern of a color set with shaderparams
if the color is magenta, replace with the same color
I’ve eben trying to do this all day, so it would be great if someone could help me out. I don’t understand the Godot shader language, so it would be great to get some help and move back to actually working on gameplay.
I don’t understand the Godot shader language, so it would be great to get some help and move back to actually working on gameplay.
I understand that you want a working shader asap, but considering this is not a trivial shader we’re talking about, I’m not sure anybody will come up with a ready-to-use code.
Do you have any WIP to share? Any particular effect you’re struggling with (pixellation, color palette application, detecting color, etc.)?
I can offer what I have so far. The pixellation effect works well. Identifying cyan and magenta also works well. I’ve been testing by replacing them with another color, and that works. I need the checkers to show up though, and I think that they can be calculated based on the coords of the pixel. Could you offer an option there? The checkers will be 1 pixel big and alternate between the chosen color in shader params and between another color: (11,12,12). I’ll post game screenshots later today when I can, as I’m away from my main PC rn.
Thanks mate, I’ve already been round that site and learned a bit. I know how to make a pixellation shader (sort of), but it’s the checker bit that’s tough.
If your checker alternates between each pixel, then the solution should be pretty easy.
First, convert your UV coordinates to pixel coordinates: UV go from 0 to 1, as you probably know already, which is very convenient to convert them to pixels, as you only have to multiply by your screen resolution. I’ll let you do some research but there’s a variable SCREEN_PIXEL_SIZE you can have a look at.
Then, take your converted coordinate, and calculate the sum of X and Y: if the result is even, color it white, else, color it black (and then use your custom color, I’m talking about B&W just to share the idea).
EDIT: we crossed our posts, but since you marked mine as the solution, I’m also posting your link as it’s a great resource demonstrating the technique.
No problem, feel free to ask if you need more help about that!
Just one thing: next time, please ask about the checkerboard only instead of the full shader, as you already had most of it working. Usually, it’s better to ask questions as specific as possible, to prevent anyone from wasting time looking for solutions that’s actually not needed.
No worry here, just letting you know for the next time.