I am planning out my next game and I decided to try to learn shaders. I wanted a shader that looks like CRT Geom on most emulators, my next game is made to look and feel like you are playing it on the SNES, and whenever I emulate an NES or an SNES game, the CRT Geom shader feels like I am playing it on an analog TV, so I wanted to implement it is a feature that you can enable it if you want it. I cannot figure it out, so I went to see if there was anything on PlayCanvas has anything that would work, however, the CRT shader I found has a glitch effect that I don’t want, and I found a glsl shader on GitHub for the CRT Geom shader, but I cannot figure out how to implement the glsl file, and when I used a different PlayCanvas script, it said that the glsl file has an error in 2 spots
I had a quick look, and to me it looks like the scanline shader from the posteffect-scanline.js script is set up correctly. I made a fork of Ur project and disabled the CRT geom shader (by disabling the shader.js script) and it looks like its working fine to me?
The CRT geom shader U got from GitHub however… It’s messy. From what I can gather it has both the vertex and fragment shader in one and the same shader script, namely crt-geom.glsl, which I’m not too familiar with. But the way you pass the shader code to the shader in the shader.js script it assumes these are separate. However from the editor I can see you have passed the crt-geom.glsl script twice, both as the vertex shader and fragment shader. I’m guessing that’s part of what makes the compiler confused. Also there’s a lot of variable definitions and checks in the beginning of the crt-geom.glsl script, many of which I’m not familiar with. However, many of them look like they could be engine specific / something that is not used in PlayCanvas, which would also explain why the compiler fail.
So yeah, sry I’m not able to help U more, but to sum it up it’s the crt-geom.glsl shader that’s the problem. To fix it you would probably need to go through it and re-write it on a format compatible with the way PlayCanvas handles shaders. Basically strip it down to “clean glsl code” with the vertex and fragment shader separate.
Personally I’m not familiar with the shader editor (I usually write the shaders directly in glsl).
But if U provide me with the code for the fragment shader you mentioned, I might be able to write you a vertex shader that goes with it
(no promises tho, as it rly depends on how the fragment shader looks like).
I really don’t have the fragment shader anymore, I found another frag and a vect file on the same github page, which is different from the one I found the previous frag on.
they won’t work together though
tell me if these don’t work