Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Jul 2010 14:32 Edited at: 21st Jul 2010 14:32
How would I go about with making a distortion? It's kind of hard to explain, check out this video just where the nukes strike. You will notice like a shockwave quickly spreading out when the nuke hits, distorting the view a little: http://www.youtube.com/watch?v=N60FcS8yWeg#

The same effect you get in Portal when you open a portal. The wall sort of distorts...

How would I make this effect in DBP?

TheComet

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Jul 2010 14:40
I think that one possible method would be to use an object as a screen, and texture it with the main camera render, so rather than rendering to the screen, you'd render a seperate camera. With that, you could put a shader through the object to ripple it, add a normal map, or bone animate it even.

The only time I did something like this was a sniper scope, or rather it was more like a magnifying glass, with tapered sides etc so it distorted what was underneath - although it was just a squished sphere (practically).

If it's a one off effect, then that's quite a stretch to do all that just so you can bend the screen - maybe there's something you can do to mask this, and use normal cameras the rest of the time. I mean, what if before any screen bending happens, the player HAS to put on some sort of gas mask, and that could be quite realistic, sound effects and everything - but it's true purpose is to provide a portal for the screen bending, so when wearing the gas mask, the camera output is textured onto a screen on the gas mask, which can bend etc. Then the player can take the mask off again when all the bending is done.

A refraction shader would probably do a great job of this.


Health, Ammo, and bacon and eggs!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Jul 2010 22:11
OK, I followed your advice on having an indirect rendering of the scene to a subdivided plain, since I will be using this effect quite a lot, but I have a small problem. The scene now looks like it has been textured onto an object (Wow, what a coincidence ). Is there any way I can disable this weird blurring effect? Maybe turning mipmapping off?



TheComet

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Jul 2010 22:37
The effect you are seeing is a "lense effect". It can be accomplished by placing a plane over the target. This plane is FX'd by something like a water effect that only uses refraction. The distortion is done by the bump map. The bump map is expanded each frame or so from a minimum size to it's max. The edges of the bump distort the image below it more than it does those near it's center. Try looking at Evolved's website-- you may find what you are looking for.
http://www.evolved-software.com/shaders/Refraction/
Take a look at the last entry. Notice the warping effect on the glass. It's much more complicated than what you are wanting, but I think the .FX will give you all that you need for this.

The fastest code is the code never written.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2010 00:27 Edited at: 23rd Jul 2010 00:31
Thank you both for helping

I tried both methods, but in the end I had to go for Van B's suggestion with the bone animated plain. Mainly because creating a normal map at real-time is too slow...

Anyway, here is a small demo of what I achieved:



http://tinyurl.com/34gelm2

EDIT : for some weird reason TGC thinks that my youtube link used bad language

I still have a problem with how the plain is textured... The game still looks blurred, turning off mipmapping didn't help

Thanks

TheComet

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 23rd Jul 2010 00:47
Looks cool, although a little fast to make out properly on the video.

You could try disabling filtering, SET OBJECT FILTER Obj,0
That might make it look jagged, the only other thing I would suggest is using a low res camera and using the main render as well, but with a special effect mesh, bone animated like you have - but with alpha transparent colouring in the vertexes. Texture that with a projection UV map of the main render. That is pretty complex, but would be the best of both worlds.


Health, Ammo, and bacon and eggs!
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 23rd Jul 2010 05:39
TheComet;
so you rendered the camera view to a plane, and then bone animated that plane as a ripple?


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?
Math89
22
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 23rd Jul 2010 11:38
You can actually create the normal map easily by using another render to texture with a blue backgrounds and textured planes. It also allows you to have a more 3D feel to your effect (shockwaves behind objects, for example).
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Jul 2010 12:29
@ Neuro Fuzzy

Pretty much, yeah. Although it isn't bone animation, I used vertexdata commands. Got a little mixed up there...

@Math89

Could you possibly post an example of this? I can't quite see how I'd do this code-wise... Thanks

TheComet

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Jul 2010 13:51
That effect looks great! Nice work there

Math89
22
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 23rd Jul 2010 20:54
I can't really post an example right now, but I can detail the idea.

What you need is to render to two dynamic textures: one for your scene (level, players, etc.) and one for the distortion map. Then these two images can be used by a fullscreen shader. This requires three cameras: the normal one (0), and two render-to-textures ones (1 and 2). The camera 0 will remain static as its only purpose is to render a quad with a distortion shader. The 2 other ones have to be positioned as you used to do before (following the player).

-First, you have to create 2 cameras: one with a blueish background (rgb 127,127,255) which will be used for the normal map, and one which captures the standard scene. Both of them have to be set as render to texture (using set camera to image).
-Create a plane and position it in front of the camera 0. Its only purpose is to render a fullscreen distortion shader. Set its mask to 1 to make sure only camera 0 can display it (set object mask). Set its textures to be the ones rendered by the cameras, and of course, give it an apprioriate shader.
-Load a normal map representing a shockwave.

-During the main loop, whenever you need a distortion, create a plane and give it the shockwave texture. Make sure that its mask is set to match the normalmap camera. You can then easily animate it by moving or scaling it.
-For each frame, set the sync mask to match the both render-to-texture cameras (a mask of %110 will allow only cameras 1 and 2) and call FastSync.
-Finally, set the camera mask to %001 and call sync.

Login to post a reply

Server time is: 2026-07-25 21:25:34
Your offset time is: 2026-07-25 21:25:34