Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Choosing how to go about CRT (retro arcade screen) effect?  (Read 3310 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles
« Posted 2014-02-13 00:43:33 »

Hello there.

I am trying to get the hang of creating a retro-looking screen for a game I am making. Here is a screenshot:

What I have done is add one 30th of the y coordinates distance to the center y coordinate to x; per pixel of course (these are shaders!).

But I have come across a problem: the shader only seems to be effecting the pixels with a texture bound to them. See the next picture where the view is slightly off of the map:

Correct me if I am wrong; shaders do not effect pixels that are cleared onto the screen every render call. So I could make a background image for the game; but that seems a tad messy, and I wanted to know if there was another way.

So, I want my shader to effect backgrounds; or I could go with another option: use the vertex shader to 'squeese' the screen in on itself for a CRT effect. This should solve my problems?

Which do you think I should use?
Offline Opiop
« Reply #1 - Posted 2014-02-13 01:56:36 »

I personally would just make the background a texture, that seems (in my opinion) far easier. Does the vertex shader process pixels that aren't being "used"? Like, the pixels that don't have any geometry being rendered "in" them? (Wow, I'm not making much sense). I don't believe they do, so I would just go with the texture idea.
Offline nerb
« Reply #2 - Posted 2014-02-13 03:02:18 »

G'day Wesley,

Groovy looking effect. No, a fragment shader won't run unless the fragment contains geometry, and has passed the required tests to be drawn. I'm not quite sure what you are getting at with your vert shader idea. However one approach could be to draw a fullscreen quad prior to rendering the rest of your scene. You could then use a fragment shader on this quad to get the desired background effect. If you are just going for a simple stretching effect on a solid background colour, then there is no need to use textures. You could calculate your colour within the shader.

Obviously drawing a fullscreen quad and running a frag shader for every fragment, even ones that are going to be over-drawn, is inefficient. If this becomes an issue you could probably work out some optimisations; the stencil buffer might be a good place to start. (I'm getting out of my depth here now... so that's enough from me).

Pages: [1]
  ignore  |  Print  

EgonOlsen (75 views)
2018-06-10 19:43:48

EgonOlsen (56 views)
2018-06-10 19:43:44

EgonOlsen (76 views)
2018-06-10 19:43:20

DesertCoockie (256 views)
2018-05-13 18:23:11

nelsongames (155 views)
2018-04-24 18:15:36

nelsongames (155 views)
2018-04-24 18:14:32

ivj94 (896 views)
2018-03-24 14:47:39

ivj94 (157 views)
2018-03-24 14:46:31

ivj94 (809 views)
2018-03-24 14:43:53

Solater (173 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!