Advanced Effects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

"Stretched" Screen Space AO at work..
Processed with FXAA.
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Lightmaps baked in Blender.
SSAO also factored in and not really noticeable.
Image
At 38 fps..(needs work and there are a lot of unused inter buffer renders)
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Blender..
Image
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Advanced Effects

Post by Mel »

Perhaps you could try to use a larger search radius on your SSAO, so the final results are more natural looking. The whole result is neat, but i think it looks a bit artificial as the dark halos around the corners are somehow screaming "look at me! i am A FREAKING SSAO!" XD

On the filp side, it is awesome looking. What is? HBAO?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Mel.. I've downloaded terrabytes of stuff on things like "Horizon Based AO", but havent had time to read it.
The AO I tried to implement here is a heavily changed version from a while ago for Blender by a guy
called Martins Upitus (who was inspired by work from a guy called Arkano). All very old stuff, but tops in the searches..
So..
The first thing I did was to change the depth that was used from 8 bit to 24 bit (could go 32 bit as Irrlicht buffers support Alpha too).
I added a Unpacker in the GPU code itself.. see "GL_0420_FRAG_PP_SSAO_INTERNAL_DEPTH.glsl"
You'll see I have a "Non Linear Inter Buffer Rendering system going" (experimental, but a good tool)
Now, to one of these Buffers I rendered the Geometry using a Geo Shader that produces Packed 24 Bit Depth..
See "GL_0410_F_GEO_DEPTH_RGB_A_CLIPPED.glsl"..
It uses a Texture Image with alpha so that objects could have Alpha Ref clip maps too. (The RGB wasted, but Ill fit it in somewhere sometime)
(packers got interesting when I saw yours dealing with Multi-Tex-Coords and Tangents remember?)
Anyhow, so I used the SSAO shader with this New 24 bit depth and found that it upped the quality a WHOLE LOT!

Now that I have a higher resolution depth I thought if I Multiplied the "Depth Delta" (now much finer by nature) inside the Shadeer
then Maybe I'd have a bit more latitude.. I did..
See the "500.0" in:

Code: Select all

 
 //--------------------------------------------------------
 float compareDepths(in float depth1, in float depth2,inout int far)
  {float garea = 2.0; // gauss bell width    
   // WHEN USING "24 Bit Unpacked Depth" the Depth-Delta alue can be multiplied by MUCH MORE!!
   float diff = (depth1 - depth2) * 500.0 ; // depth difference (0-500) and even more..
   //reduce left bell width to avoid self-shadowing 
   if (diff < gdisplace) {garea = diffarea;}  // Lots can still be done here once grasped properly..
   else {far = 1;}
   float gauss = pow(2.7182,-2.0*(diff-gdisplace)*(diff-gdisplace)/(garea*garea));
   return gauss;
  }  
 //--------------------------------------------------------
 
I also scaled the "Radius" (inversely) by the (now linearized) depth so that "Far" areas don't get treated the same as "Near" areas..

Code: Select all

 
   // I added this because I thought that having the AO darkness
   // distance scaled by inverse depth would add a bit of realism..
   float dd      = (1.0 - depth) * radius  * (1.0 - UnpackedDepth );
 
O.K.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

I was going to clean the code up, write an article etc and make it look all sweet but I got
things to do so I'll post the WHOLE ROJECT (as septic as it is).
The main reason I'm posting it is because I need as much criticism as I can get. So Mel, or anyone, let me have it!

If you've looked at my last "Water" Post you'll see that it is very similar except that the code has now been
modularised and broken up in to smaller and more sensible parts..

The controls are the same (water post) and may alter two or more (unrelated) things at once, but you'll see, this aint serious..
The Images were posterised and made 8 bit 256 colour so that the giffs can be as small as possible. (bless Irrlicht for good Image support)

The program starts of showing only the SSAO..
Press "M" to flip between the SSAO Shader render-modes like "Show Packed RGB Depth" or "Show Diff (SSAO)" or "Diff Only"..
(just keep pressing M and you'll get it)

Also..
"V" show simple GUI that shows tweaked values. (hit this first)
press "P" & "L" inc/dec "Far Dist" (acts on the GEO DEPTH SHADER, not the SSAO shader)..
Shift & "P" or "L" inc/dec "Near Dist" (acts on the GEO DEPTH SHADER, not the SSAO shader)..
"O" & "K" Tweak "Gause Bell"
"I" & "J" Tweak "Diff Area"
"U" & "H" Tweak "SSAO Radius"
"Y" & "G" Tweak "Far" Parameter (acts on the SSAO SHADER, not the GEO shader)..
"T" & "F" Tweak "Near" Parameter (acts on the SSAO SHADER, not the GEO shader)..
"F1" toggles between the "Old Linear Effect system" (new pp shaders like simple caleidoscope etc)
and the new "Non Linear Effect System".
"0" toggles between "No PP" and which-ever FX system is current (selected with "F1")..

You'll see a lot of "Commented out code" in the "H_013_NonLinear_Effect_System_Initialisation.h" file..
These are different buffer setups, used or not used..

If you look at this file closely you'll see that the Non Linear FX system could be quite useful..

Its a big project and not very tidy, but I hope it is usefull..

Please let me know of any questions..
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Heres the Project:

READ THIS:
I forgot that the dll is one I compiled myself and when I compiled the actual app
I forgot to use my recompiled *.lib, so if this thing crashes sorry! (just use your own dll or/and recompile)
Also Audierre may have issues with tracks with incorrect "save options" from Modplug Tracker..

MY APPOLOGiES.. THIS POST WAS A BALLSUP.. NEXT ONE WILL BE COOL.. PROMISE.. SORRY..

Image
Last edited by Vectrotek on Sat Dec 10, 2016 12:17 am, edited 3 times in total.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Lesson: When you get all clever and compile your own sound and Irrlciht etc libraries and dll's
then make sure you remember this when you format your machine or reinstall things..

It's easy to forget that the "*.lib"s will now be different (original) as you compile them and basically forget about them..

(to myself that is..) :oops:
Last edited by Vectrotek on Sat Dec 10, 2016 12:16 am, edited 2 times in total.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Advanced Effects

Post by Mel »

I'll take a look... and by the way, you can very well stick to 24 bits of precission, Floating point numbers won't get you more precission than that in the range 0-1 Actually they yield 23 bits of precission!, so you have an extra bit :lol:

Altho i am currently more interested in screen space reflections :)
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
cloves
Posts: 6
Joined: Sat Nov 19, 2016 3:22 am

Re: Advanced Effects

Post by cloves »

this is amazing
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Thanks!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Getting a bit carried away with SSAO but testing parameters on different scenes is fun..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

SSAO has some limitations and I know jack about HBAO etc but for this spooky effect it did the trick..
Image
The witching hour..
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Advanced Effects

Post by Mel »

Dat Resident Evil 4 villager's town... LEL
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

I did'nt know that..
Post Reply