Skip to main content
gamedev.net
🔒 Locked

Screen warping effect

Started by Kuro Dec 11, 2005 at 11:35 PM 1 replies 900+ views
Original Post
Kuro
Kuro
I'm trying to implement a "screen warping" effect for a 2D RPG game. For example, in a game like Final Fantasy 6, if you use certain spells, the screen becomes "wavy". In the old days where rasterization was done manually, this was easy- you just add a sinusoidal offset to each row of pixels on the screen, but now it's not that simple... So, my best idea so far is basically: 1. Render the entire scene to a texture 2. Create a uniform mesh (grid of vertices) which uses that texture 3. Add some displacement to the vertex positions on each row of the grid 4. Draw the mesh to the screen I think this approach would work, and I've noticed that HGE (Haaf's Game Engine) uses a similar technique (he calls it "distortion mesh"). I'm a bit worried about performance though- the resolution is 1024x768 by default, and we want the game to run on machines ideally as low as 500-800mhz or so. So, if anyone might have any thoughts on my approach or some advice on how it could be done more efficiently, I would really appreciate it. Thanks very much! EDIT: OK, I had one idea. Say there's a magic spell that causes the screen to distort during a battle. It might be enough to simply distort the *background image* instead of the whole screen. In that case, no render to texture has to be performed... Anyway that definitely helps things a bit, but only in that special case...
Funkymunky
Funkymunky
Can you elaborate on how you are doing your graphics? DirectX? OpenGL?

Can you use shaders?

have you seen this?
Kuro
Kuro
Hey! We're using OpenGL, and shaders are allowed. If we use shaders for an effect, then we have to provide 2 implementations though (1 shader and 1 without), so we don't single out low end machines. I don't mind that though, if shaders allow the effect to be done faster/better.

Thanks for the link! Yeah, flow maps are cool, I've used them before although I didn't know that's what they were called. They're great for funky effects like those Winamp / Windows media player visualizations.

Hmm, the more I think about it, I think there's no way to escape the render-to-texture, the only thing I can really do is to take shortcuts- like wobble only the background image instead of the whole screen. Maybe there's a shader way to do it though, have to look more into it since I'm not a whiz with shaders...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.