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
Can anyone help me fix the shader error(s)
for the PlayCanvas shader, to remove the RGB effect
script for PlayCanvas shader in-project: PlayCanvas | HTML5 Game Engine
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
file:///media/fuse/drivefs-0246d9e60d7e8405a1a82944983571c8/root/crt.vert
file:///media/fuse/drivefs-0246d9e60d7e8405a1a82944983571c8/root/crt.frag
tell me if these don’t work
they are a local file path
I lost the link to the GitHub pages too, so I cannot do that either
I am using the CRT post effect right now, but I don’t want the RGB distortion that is present, and I cannot figure out how to remove the RGB distortion