Jump to content
  • Advertisement
Sign in to follow this  
NicoG

Programming a "TV"

This topic is 2073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry, I hope this is the right forum. 

 

Anyway, I would like to do something that looks like an old CRT-TV. 

 

I already got the scan-line and vignette shader (GLSL), now my problem is that I need to slightly "bend" the surface on the edges to the back to create this illusion of an old CRT-TV surface. I am using Game Maker Studio, so I have only 2D capabilities and limited 3d functionality, like drawing models and manipulating matrices. 

 

Can someone help me to get this started? smile.png

 

edit: A picture of what I mean in a game where I saw it. It is very subtle and I hope you can spot it in the screen well enough.

tHcVFUL.png

Edited by GothSeiDank

Share this post


Link to post
Share on other sites
Advertisement


I already got the scan-line and vignette shader (GLSL)

Where did you get it from?

 

Anyway, you can create the bent screen effect by using a bump map.

Share this post


Link to post
Share on other sites

How would such a bump map look like?

Also, Game Maker can't really utilize bump maps :S. 

Is there any other solution, except drawing a picture over the surface and faking it?

Share this post


Link to post
Share on other sites

I would generally not use the term 'bump map' to describe it as that's a reference to an entirely different, very specific technique that just so happens to use a similar-looking texture as an input.

 

In simpler terms, you're using a distortion shader that adds or subtracts a value to the texture coordinate (distinct from the value sampled from a texture at that texture coordinate, though the actual offset would be taken from a second texture) depending on the location onscreen. tonemgub's soltution is basically to paint a texture that contains offsets gradually pointing towards the middle of the screen, with decreasing magnitude as you move away from one of the corners. It would work, but is likely more computationally expensive than it could be.

 

Fortunately, folks have already worked out how to do most of this with math. If you're interested in a really detailed CRT monitor simulation, give this neat site/shader a gander.

Edited by InvalidPointer

Share this post


Link to post
Share on other sites

Bump mapping is a lighting effect and completely unrelated. You just want to add some offsets to where you read your texture from in the GLSL shader - where you have something like texture(textureUniform, uv); try uv*=strength; texture(textureUniform, vec2(uv.x*sqrt(1.0-uv.y*uv.y*.5),uv.y*sqrt(1.0-uv.x*uv.x*.5))/strength); or some other similar mapping from square to disc instead.

Edited by powly k

Share this post


Link to post
Share on other sites


distortion shader

Yup, that's exactly what I was thinking of too, but I tried to put it in simpler terms and it came out wrong. Sorry.

 


uv*=strength; texture(textureUniform, vec2(uv.x*sqrt(1.0-uv.y*uv.y*.5),uv.y*sqrt(1.0-uv.x*uv.x*.5))/strength);

But is it really faster to use real time calculations instead of a pre-rendered texture for the distortion offsets? I always thought it was the other way around - texture sampling should be faster than these calculations, at least. You're doing the calculations every frame, whereas for the texture - it is only filled with the distortion offsets once.

Share this post


Link to post
Share on other sites
But is it really faster to use real time calculations instead of a pre-rendered texture for the distortion offsets? I always thought it was the other way around - texture sampling should be faster than these calculations, at least. You're doing the calculations every frame, whereas for the texture - it is only filled with the distortion offsets once.[/quote] Don't guess, measure. Run benchmarks with both versions of the shader applied to a set of computationally heavy cases of your game (e.g. multisampling and unusual amounts of overdraw to stress fragment processing, lots of geometry to stress vertex processing, artificially inflated texture number and sizes, etc.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!