Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Krackers87 on October 03, 2009, 02:33:49 pm

Title: Distortion effects?
Post by: Krackers87 on October 03, 2009, 02:33:49 pm
Forgive my insolence if I'm speaking on common knowledge here, but would it be possible to make a 3D distortion effect, essentially take lets say, the current 3d shock wave, make it invisible, yet distorts light based on its geometry similar to a heat wave/water ripple/looking through a glass cup or ball. If not currently possible, how difficult would this be to implement?
Title: Re: Distortion effects?
Post by: chief1983 on October 03, 2009, 02:41:53 pm
It could probably be done with a shader now.  But only people with shaders would see it.
Title: Re: Distortion effects?
Post by: Thaeris on October 03, 2009, 02:45:23 pm
My skills in this arena are quite few, but I'd assume you'd (on the cheap...) start with sphere and apply a translucent texture to it. The sphere would have to enlarge and probably have a few rotational constants about its origin to look right if you only used a singular texture. Using glowmaps would probably remove the need to spin the enlarging sphere. Add a flash of light a few degrees of magnitude smaller than a subspace flash upon bomb/torp impact and you'd have a very cool effect indeed...
Title: Re: Distortion effects?
Post by: Krackers87 on October 03, 2009, 03:39:43 pm
My skills in this arena are quite few, but I'd assume you'd (on the cheap...) start with sphere and apply a translucent texture to it. The sphere would have to enlarge and probably have a few rotational constants about its origin to look right if you only used a singular texture. Using glowmaps would probably remove the need to spin the enlarging sphere. Add a flash of light a few degrees of magnitude smaller than a subspace flash upon bomb/torp impact and you'd have a very cool effect indeed...
I'm talking more along the lines of distorting other effects, using another effect. a ship is blowing up, little explosions all over it, a shock wave occurs between the player and ship, thus a ripple distorts the entire scene of the ship exploding. unless this is the effect you're explaining, than i apologize for my sleep depraved delusions.
Title: Re: Distortion effects?
Post by: General Battuta on October 03, 2009, 03:41:59 pm
Shaders.
Title: Re: Distortion effects?
Post by: Aardwolf on October 03, 2009, 07:55:00 pm
Screen-space effects like that are doable, for people with shader support, and I suppose with proper depth sorting it might be doable on a per-shockwave/distorty-effect basis.

But it's not something that's doable using the same shaders system that's in place for normal maps, etc.

Edit to appease the almighty Zacam: um... yeah
Title: Re: Distortion effects?
Post by: Akalabeth Angel on October 04, 2009, 02:03:48 am
I'm talking more along the lines of distorting other effects, using another effect. a ship is blowing up, little explosions all over it, a shock wave occurs between the player and ship, thus a ripple distorts the entire scene of the ship exploding. unless this is the effect you're explaining, than i apologize for my sleep depraved delusions.

You're looking for something like the shockwaves in FEAR right? (and other games I assume)
Title: Re: Distortion effects?
Post by: Krackers87 on October 04, 2009, 02:07:06 am
I'm talking more along the lines of distorting other effects, using another effect. a ship is blowing up, little explosions all over it, a shock wave occurs between the player and ship, thus a ripple distorts the entire scene of the ship exploding. unless this is the effect you're explaining, than i apologize for my sleep depraved delusions.

You're looking for something like the shockwaves in FEAR right? (and other games I assume)

yup, exactly
Title: Re: Distortion effects?
Post by: Tomo on October 04, 2009, 05:21:57 am
Shaders.
A lot more to it than that, unfortunately.

Individual shaders work on a per-vertex/per-fragment basis, and thus know nothing of the other items in the scene.
They basically get per-model 'variables' (including textures) and per-scene 'global variables'.

I believe this can only really be done using post-processing shaders, where you first render-to-texture, then render 'shockwave info' to another texture, then use a shader that takes the 'shockwave info' texture and uses it to distort the first result.

There might be a way to use a stencil buffer instead (which would be faster), but I suspect that wouldn't give the kind of result you're after.
Title: Re: Distortion effects?
Post by: Hery on October 04, 2009, 09:33:42 am
@Tomo: that's what I told in post-processinig topic, http://www.hard-light.net/forums/index.php?topic=64986.msg1289883#msg1289883
I will have to create an interface to create and use g-buffers while implementing "new" motion blur (the old one was removed from post-processing code), which will enable many more techniques (deferred shading, heat haze, post-processing effects applied only on some parts of screen and improved shockwaves). However, that will require much more from the hardware.