Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
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 648 times)
0 Members and 1 Guest are viewing this topic.
Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« 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 opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« 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).

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Profile picture isn't relevant.


« Reply #3 - Posted 2014-02-13 04:09:12 »

@opiop65
Yeah; like I said the shaders are ran for every single vertex, not every pixel.

Think of it this way: we have precise geometry that couldn't possibly be drawn perfectly on a screen; so we project it onto a 2D plane, and whatever pixels intersect with a shape on that plane get drawn with the precise vertex's color.

@nerb

Quote
Groovy looking effect.
Right back at'cha, dudio.

I see that there is no way to do it. I was thinking about having a texture for the TV border, but that would skew should I resize the window...

[/endresponses]

By stretching, I actually meant for a pseudo-3D effect; you know how CRT monitors bulge out a bit of the casing, right?

In the end, I should probably draw some default tile in the background; say... grass.

Thanks for bearing with my brainfart;
-wes  Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!