Page 1 of 1

Having fun with post-processing

PostPosted: 15 Apr 2011, 22:43
by Funto
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 ;)

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 00:14
by STKRudy85
Anaglyph :heart:

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 02:16
by Auria
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

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 10:07
by Funto
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 :)

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 11:10
by Kinsu
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) !

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 12:41
by Funto
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

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 16:30
by Auria
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 )

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 19:22
by Funto
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?

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 19:44
by Auria
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

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 20:52
by Kinsu
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... ^^

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 21:10
by Funto
Sure, that damn' plunger!! I should just replace it with an alpha texture :p

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 21:15
by Kinsu
Haha, this is pretty challenging to drive seeing only the screens corners ! Maybe STK should feature an "all-plunged-race" mode :D

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 21:29
by Funto
:D :D And an "all drunk", and "all drunk and plunged", and an "all drunk and plunged and ASCII art"...

Re: Having fun with post-processing

PostPosted: 16 Apr 2011, 21:31
by Arthur
Sounds like somebody got too much to drink already... ;)

Re: Having fun with post-processing

PostPosted: 17 Apr 2011, 10:40
by Kinsu
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 ^^

Re: Having fun with post-processing

PostPosted: 18 Apr 2011, 00:20
by hiker
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

Re: Having fun with post-processing

PostPosted: 18 Apr 2011, 00:44
by Funto
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.

Re: Having fun with post-processing

PostPosted: 18 Apr 2011, 00:46
by appdirect
I like the second pic, it looks like it's cel shaded.

Re: Having fun with post-processing

PostPosted: 18 Apr 2011, 04:58
by 3dwarehouse
I would love a 3d option in supertuxkart.

Re: Having fun with post-processing

PostPosted: 14 May 2011, 11:15
by STKRudy85
http://www.jeuxlinux.fr/f1173-Buggy_Race.html

This is what irrlicht can do in shadows terms

Re: Having fun with post-processing

PostPosted: 14 May 2011, 19:31
by Funto
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.