Jump to content
  • Advertisement

Recommended Posts

Hello everyone!

I'm making a Breakout clone, just to learn basics of game development. I really want to add CRT display look to my game. But the problem is that I don't know how to achieve this. I think I have these options:

1. Use existing shader (non-GPL licenced).
2. Completely write from scratch using my own intuition.
3. Write from scratch using advices from this post: http://www.piratehearts.com/blog/2014/03/28/crt-simulation/ . But it looks too complicated for a beginner... At the same time looks really cool.43.

I know that most probably I just should take one option and do it, but... Existing shaders are written by professionals, so I doubt my own variant will look as beautiful and perform as fast. At the same time, non-GPL ones are visually too simple compared to, say, CRT-Royale shader, which looks most CRT-ish to me. And a try to make may own theoretically can give me as good result as I can afford by investing my time in it. But then another aspect kicks in: I actually want to finish a game and start working on another one, more complex and little bit more unique.

So... Maybe I can get some advices from you guys? Really feeling frustrated. This is something that really blocks my mind and brakes development process.

Share this post

Link to post
Share on other sites

Will it add anything to the game you've made or is it just a want?  Unless you write it yourself, are you really learning anything and if you're not, what is the point?  Are you planning on publishing this game for free or for profit or is it just a learning experience?  If it's just for learning, then try writing it yourself, who cares if it's the most efficient or fastest, no one starts off perfect.  If you want the feature and cannot move on to another project without it, start writing it.

Share this post

Link to post
Share on other sites

1. Yes, it must be part of the game's aesthetics, because I'm trying to reproduce look and feel of the original game in my interpretation. It just looks too "plain" without such effects.

2. Yes, I am learning, but my plan was to learn "CPU programming" part and leave all that complex shader stuff to next project. Thinking about delaying release makes me panic, feel that the game will never be finished.

3. I want to publish it for free, without any marketing (if you can call it marketing when a game is free). So I want it to be playable (maybe not 100% perfect, but still playable).

4. After that, maybe I could add some new features to it, not sure about this.

5. Yes, I agree, learning is learning, my first project is allowed to be imperfect. Still, I can release an updated version with better CRT shader.

6. I just thought I can skip this step for the first time, just write a couple of simple effects like color split etc. And jump into it later, when I have at least one project completed.

Share this post

Link to post
Share on other sites

I wrote the crt-pi shader so might be able to offer some advice.

Firstly, all the Retroarch CRT shaders, including CRT-Royale, are written by hobbyists.

The Super Win the Game and CRT-Royale shaders mentioned in your post implement a lot of features and are correspondingly complicated but you can still get good results by implementing a simpler shader. The real time sinks for writing shaders are doing complicated things or getting simple shaders working fast on limited hardware (e.g. Raspberry Pi). If you write a simple shader assuming a more capable GPU it should be a lot easier.

Some shaders go to great lengths to emulate what happens in the CRT tube to produce a theoretically accurate result but what really matters is what the end result looks like. Cheap hacks that look good are fine.

A list of things you'll need to consider:

  • Knowing where the pixel you're rendering is in relation to the centre of the source pixel is crucial for getting blending between pixels right.
  • There are two approaches to blending between pixels. a) Sample multiple source pixels and blend them in the shader. b) Tweak the texture coordinates you use to sample the source texture and use the hardware's bilinear filtering to do the blending. The former allows you to do more complicated filtering, the latter is faster.
  • NTSC colour artefacts are difficult to implement properly. Retroarch shaders use a separate pass and I believe the (S)NES Classic Minis use the CPU for doing this and just use the GPU for upscaling. You might want to leave this for a subsequent version.
  • Old PCs, and games consoles don't have a 1:1 pixel ratio when displayed on a 4:3 screen - this might not be an issue for your game.
  • If you scale up by an integer multiple of the vertical resolution you won't have to worry about blending between two source lines. Blending between two source lines can be difficult if you want to have even scan lines.
  • If you implement curvature you can't have an integer multiple scale factor across the whole line and getting even curved scan lines is even harder to achieve.
  • Horizontal blending of pixels can be as simple or complicated as you want it. Some Retroarch shaders use Lanczos filtering. crt-pi uses linear filtering and relies on the shadow mask and bloom emulation to disguise the fact.
  • For shadow mask emulation, Trinitron slot masks are easiest to implement, you just tint every 3rd pixel along a line red, green or blue and not have to bother about your vertical position. Other shadow masks are more complicated (you need to take vertical position into account) but you can avoid having to implement scan lines if you use them. (Slot masks largely hide the fact you haven't got scan lines.)
  • Scan lines bloom (get wider the brighter they are). Ideally you should do this for each colour channel separately and use some complicated formula so that they expand by the correct amount. crt-pi just multiplies all the colour channels by 1.5.

Decide what features you really have to have for your first implementation - you can always add more later. For crt-pi, I was limited by the slow GPU and the fact that I wanted to scale to 1080 pixels vertically whilst still maintaining 60 FPS so I aimed for something reminiscent of a 14" CRT fed RGB via a SCART socket (which is what I was used to back in the day).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!