Having fun with post-processing

Having fun with post-processing

Postby Funto » 15 Apr 2011, 22:43

In my desesperate attempt to add a correct SSAO to STK (I'm on my way...), I played with the XEffects Irrlicht add-on, and got some fun results (in my opinion), namely:

- the "drunk" effect, which could be used for some bonus (or one should say malus) item.
Image

- a weird and buggy edge detection, useless :p
Image

- And last but not least: STK goes 3D !! :p
Image

[EDIT] Just for the record, this works on the real game on my machine, it's not just the result of playing with screenshots in GIMP ;)
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby STKRudy85 » 16 Apr 2011, 00:14

Anaglyph :heart:
STK fan
User avatar
STKRudy85
 
Posts: 532
Joined: 23 Dec 2010, 03:00
Location: France

Re: Having fun with post-processing

Postby Auria » 16 Apr 2011, 02:16

Hey, there are some interesting results there :)
If you feel like sharing code please go on and do so; I can't promise we will use any of those but having them at hand is always useful
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Having fun with post-processing

Postby Funto » 16 Apr 2011, 10:07

Yes sure I will share it, but I would like to clean the code before, right now it's just a bunch of experiments :p. For the record, I'm basing my code on XEffects, which is a set of extensions to Irrlicht mainly to add post-processing and shadow mapping (I can't believe shadow mapping is not the standard shadowing method in Irrlicht...)

As for my SSAO attempt, the principle is that for each pixel P, we randomly select neighbouring points and estimate how much those points "occlude" the point at P. This estimation is based on the depth buffer.
The thing is that in the borders, the difference in depth is obviously big, so the borders appear as very occluded...

What should be done to get something correct is to take into account the normal at P, and weight the occlusion term by the dot product between this normal and the vector going from the occludee to the occluder, as is done in http://www.gamedev.net/page/resources/_/reference/programming/140/lighting-and-shading/a-simple-and-practical-approach-to-ssao-r2753. This way, the occlusion is stronger as the occluder is in close to the axis of the normal at P.

Yesterday I managed to get the normals working by using gl_Normal in the vertex shader, see below:

Image

Here I have a question: I know the black quads on the floor represent the shadows of the karts, but what about this black cylinder? What is this for?

What I'm trying to do now is to pack the normal and the depth values in a single 32 bits buffer, and use this as input to my SSAO shader, which will be based on the code from GameDev.

I will be quite busy this week-end, but I will try to communicate my results through this thread, for those who are interested :)

Other (sometimes stupid) post-processing ideas:
- mirroring (would need to mirror input as well)
- toon shading
- painting rendering
- motion blur
- bloom
- ASCII mode (as was suggested in the blog's April's fool joke ;))

Note that this kind of bonuses could be items unlocked by challenges :)
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby Kinsu » 16 Apr 2011, 11:10

This could be fun little features ^^
I don't really know how tracks work yet, but I think the cylinder is here to tell the game where is the track, and where is the decor (where karts are slowed down). Something like that...

For the drunk effect, the one in GTA vice city (go to 1:00) was great, and I think with a little image distorsion and camera moving around as when the vehicle turns even when it does not, your first effect could render something like that (really hard to drive correctly) !
User avatar
Kinsu
 
Posts: 476
Joined: 15 Mar 2011, 14:28

Re: Having fun with post-processing

Postby Funto » 16 Apr 2011, 12:41

Hmm, it looks really too white for me :p
But this makes me think that such a "drunk" item could make the kart harder to drive, by having some influence on the controls...not sure if this would not be mainly frustrating :p
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby Auria » 16 Apr 2011, 16:30

Hi,

nice work :)

the cylinder is for slipstream effect (the "wind" texture you can see on http://2.bp.blogspot.com/_im4Yv1xoVXw/T ... 0/STK4.jpg )
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Having fun with post-processing

Postby Funto » 16 Apr 2011, 19:22

Ah ok I see :)
I didn't know this effect could only happen specifically at given places in the tracks, I thought just running straight during a sufficient time could make the effect appear (as is done in Mario Kart).

What is added to my depth-normal rendering pass corresponds to the calls to IrrDriver::addMesh and IrrDriver::addOctTree, hence if I understand correctly, those cylinders are drawn (maybe with alpha set to 1?) by the GPU, right? Why is this done, and couldn't we avoid drawing them?
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby Auria » 16 Apr 2011, 19:44

Funto {l Wrote}:Ah ok I see :)
I didn't know this effect could only happen specifically at given places in the tracks, I thought just running straight during a sufficient time could make the effect appear (as is done in Mario Kart).

What is added to my depth-normal rendering pass corresponds to the calls to IrrDriver::addMesh and IrrDriver::addOctTree, hence if I understand correctly, those cylinders are drawn (maybe with alpha set to 1?) by the GPU, right? Why is this done, and couldn't we avoid drawing them?


It can happen everywhere, I'm not sure why you see it there :/ maybe when it's unused we don't properly disable it and it's just transparent

Though of course when they're in use no we can't avoid drawing them ;) The effect would somehow need to be able to avoid effecting transparent objects. I think you might be able to install yourself in the irrlicht rendering pipelines just before transluscent objects are drawn
Image
User avatar
Auria
STK Moderator
 
Posts: 2976
Joined: 07 Dec 2009, 03:52

Re: Having fun with post-processing

Postby Kinsu » 16 Apr 2011, 20:52

Funto {l Wrote}:Hmm, it looks really too white for me :p

Yes, I agree we could eliminate the white effect, I was rather talking about camera movements which are indeed really annoying ^^ But if it's on just during a short time, I'm not sure it would be as annoying as getting a plunger on your face... ^^
User avatar
Kinsu
 
Posts: 476
Joined: 15 Mar 2011, 14:28

Re: Having fun with post-processing

Postby Funto » 16 Apr 2011, 21:10

Sure, that damn' plunger!! I should just replace it with an alpha texture :p
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby Kinsu » 16 Apr 2011, 21:15

Haha, this is pretty challenging to drive seeing only the screens corners ! Maybe STK should feature an "all-plunged-race" mode :D
User avatar
Kinsu
 
Posts: 476
Joined: 15 Mar 2011, 14:28

Re: Having fun with post-processing

Postby Funto » 16 Apr 2011, 21:29

:D :D And an "all drunk", and "all drunk and plunged", and an "all drunk and plunged and ASCII art"...
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby Arthur » 16 Apr 2011, 21:31

Sounds like somebody got too much to drink already... ;)
Hey pal, I took an oath for justice! "In happy days or tightest tights..." or something like that.
User avatar
Arthur
 
Posts: 1073
Joined: 06 Dec 2009, 00:49

Re: Having fun with post-processing

Postby Kinsu » 17 Apr 2011, 10:40

Seriously, if this kind of modes are easy to add to the game, why not :D ? Little challenges to lock the "funny drunk mode" and the "funny plunged mode", maybe even challenges requiring these modes to be acheived... with that, challenges (or the future career mode) would enable players to unlock additional content (and which is not really needed, so casual players who don't acheive a lot of challenges won't miss it), not only tracks and karts...

Of course only if this is easy to do, as these are not modes which will be played a lot ^^
User avatar
Kinsu
 
Posts: 476
Joined: 15 Mar 2011, 14:28

Re: Having fun with post-processing

Postby hiker » 18 Apr 2011, 00:20

Auria {l Wrote}:It can happen everywhere, I'm not sure why you see it there :/ maybe when it's unused we don't properly disable it and it's just transparent

The slipstream cone is just set to invisible if it's not used. The position will only be updated if it's in use, so at start all those cones will be at a dummy location. Not sure why you can see it, that probably depends what you are doing with your post-processing. Irrlicht should(!) just not draw those.

Cheers,
Joerg
hiker
 
Posts: 1435
Joined: 07 Dec 2009, 12:15
Location: Melbourne, Australia

Re: Having fun with post-processing

Postby Funto » 18 Apr 2011, 00:44

What I'm doing is branching the post-proc system to IrrDriver::addOctTree() and IrrDriver::addMesh().

I won't have much time to work on the SSAO during the next week, and last news are that for some unknown reason, I can't write to the blue and the alpha channel of my screen-sized texture when doing my depth-and-normals pass.

I'm thinking of writing my own system instead of using XEffects, which may be simpler and give me more control over what's done.
I would not be a lot of code, and I think XEffects is mainly useful if we want to do shadow mapping.
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Re: Having fun with post-processing

Postby appdirect » 18 Apr 2011, 00:46

I like the second pic, it looks like it's cel shaded.
User avatar
appdirect
 
Posts: 4
Joined: 21 Mar 2011, 15:37

Re: Having fun with post-processing

Postby 3dwarehouse » 18 Apr 2011, 04:58

I would love a 3d option in supertuxkart.
STK Rocks!!!
Also anything I make is under the any licence you want : CC_by_sa GPL public_domain
User avatar
3dwarehouse
 
Posts: 99
Joined: 19 Jan 2010, 15:05
Location: USA

Re: Having fun with post-processing

Postby STKRudy85 » 14 May 2011, 11:15

http://www.jeuxlinux.fr/f1173-Buggy_Race.html

This is what irrlicht can do in shadows terms
STK fan
User avatar
STKRudy85
 
Posts: 532
Joined: 23 Dec 2010, 03:00
Location: France

Re: Having fun with post-processing

Postby Funto » 14 May 2011, 19:31

Well I don't know how much they tweaked the engine, as in its original form, Irrlicht doesn't support shadow maps (!), only stencil shadows, which are now considered by many developers as very limited because it's very hard to do soft shadowing with this technique (plus it involves a huge increase in the amount of geometry processed by the GPU).

However, XEffect, the library I have been playing with to add the post-processing effects you can see on this thread enables shadow maps with Irrlicht, but I have no idea how good the implementation is.
Funto
 
Posts: 459
Joined: 09 Dec 2009, 13:47
Location: Bordeaux, France

Who is online

Users browsing this forum: No registered users and 1 guest