Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

If I'm understanding you correctly, you're saying that the phosphors appear too big relative to your game screen when running in a small window. This is actually by design; the shader reads your window size and outputs the phosphors in sync with your actual screen's resolution. For example, if you are using a phosphor mask with 3 columns (red, green, blue), it will always tile every 3 pixels on your real-life screen, and it can't go any smaller without completely breaking the effect. If you need a finer pattern, you can swap the mask out for the included 2-column wide (green, magenta) texture that takes advantage of your screen's RGB subpixel layout to squeeze everything as small as physically possible. If this still isn't acceptable for your needs, then you may want to disable the phosphors when your window size is very small. This effect generally requires an output resolution of 720p at the very least to begin looking correct.

As far as your code, it looks like it should generally work fine. However, this shader comes with built-in aspect ratio correction, meaning that you should be able to resize your output window to any shape at all, and the shader will automatically ensure the simulated CRT screen has the correct 4:3 ratio (or whatever your game is) with reflective borders filling any leftover space. I'd generally recommend just setting the output width and height to the actual window width and height (window_get_width(), etc), and let the shader handle everything else with constant game height, width, and aspect ratio settings.

I'm having a similar issue, where the shader looks completely different in full screen v. windowed. Is there a way to lock the output to a specific resolution so it looks identical no matter what the window size is?

The shader is designed to tile the phosphor mask against your screen at a 1:1 resolution, as is common in CRT shaders for emulation and retro gaming. There is, however, a parameter in the presets called mask_scale, that will simply resize the mask relative to your screen. If you want a fully consistent look regardless of screen resolution, I would probably recommend disabling the phosphors altogether, or using a neutral mask like the shadow mask. If you're hard-set on it, then what you would need to do is pick your "default" resolution, like 1080p, and then set crt.mask_scale = (1080 / window_get_height()) when necessary, such as after room transitions or when the window resizes. This would ensure there are a consistent number of phosphor triads between resolutions, but it can begin to look very broken at lower resolutions, so use with caution.