Shader problems

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)

  1. for the PlayCanvas shader, to remove the RGB effect
    script for PlayCanvas shader in-project: PlayCanvas | HTML5 Game Engine

  2. for the GitHub shader, how do I implement it:
    script for GitHub shader in-project: PlayCanvas | HTML5 Game Engine

is amyone able to help

both shader scripts are applyed

Hey,

  1. 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?

  2. 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.

In the posteffect-scanline.js script there is a glitch effect that I don’t want to have that I tried to remove but I wasn’t successful

I might have to get a .vect and .frag files to do the effect I want

I found a fragment shader, for it but I cannot find a vertex shader to go with it

I also found the shader editor for playcanvas

I have no idea how to work it

I may not even have the shader if I cannot make it work

Hey,
sorry for such a late reply.

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 :slight_smile:
(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

I don’t think they work.
Looks like some sort of local file paths?

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

I even looked at the sources the creators used to make the distortion, but I could not figure it out

You could create a gist to share the code:

https://gist.github.com/

I don’t know how to do GitHub, IDK what to do but I will try

I just made it, my internet was running the forum a little slow, but I got the link:

however, it looks like the files is looking for a ruby. I know that is used for the demo, but is it always looking for a ruby?

Its just a variable name…

oh, IDK how to do shaders, so I did not know