Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+2)

EDIT: I think the filter is fine when scaled down and it was just my impression. Though to be safe I would like to know if the code down there is the 'correct' way of doing this. The code below happens 2 frames after resizing to not do everything at once.


Hi, loving the filter so far however I have a small problem/question.

I've setup a custom camera that is able to resize my window to WINDOW_SIZE * WINDOW_SCALE to keep the aspect ratio. When starting the game in fullscreen the filter works and looks great. However when scaling the game to a window size the filter pixel size looks way too big and not that good anymore but this might also be my eyes.

I am changing the following parameters of the shader when resizing:

if (instance_exists(oSystemManager.crt_filter))

{

    oSystemManager.crt_filter.output_width = GAME_WIDTH * window_scale;

    oSystemManager.crt_filter.output_height = GAME_HEIGHT * window_scale;

    

    oSystemManager.crt_filter.update_uniforms();

    

    oSystemManager.crt_filter.resize_surfaces();

}

Hope this code is readable. Anything I can do about it looking worse when windowed or is the filter just only made for fullscreen? And is this the correct way of setting values of a preset in runtime?

Thank you very much for any help in advance.

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.