Native Ambient Occlusion (SSAO) shader
Native Ambient Occlusion (SSAO) shader
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
This is still a little rough; but here's a preview of the next effect I'm working on: SSAO
It can be combined with the bloom effect but I disabled that for these screenshots.
It can be combined with the bloom effect but I disabled that for these screenshots.
You do not have the required permissions to view the files attached to this post.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
A few more screenshots:
You do not have the required permissions to view the files attached to this post.
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Thanks guys. To be honest, it is a little rough and there's a minor performance hit; but I'll continue to refine this shader in the near future. I'm currently trying to contact the original author of the shader before releasing it. Otherwise I guess I can code my own version as well.
You do not have the required permissions to view the files attached to this post.
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
Oh, I see an error in your last screenshot, you are including engine glow in AO which you shouldn't (they show on the x-wing as 4 quads) otherwise the AO shots all look good and accurate.
Lights of course should always be full-bright too, which I actually just noticed, so maybe a second pass accounting for illumination is needed? (see hangar ceiling and x-wing cockpit lights are being occluded when they are sources of emission)
Trev
Lights of course should always be full-bright too, which I actually just noticed, so maybe a second pass accounting for illumination is needed? (see hangar ceiling and x-wing cockpit lights are being occluded when they are sources of emission)
Trev
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
You're a keen observer, Trevor. Yes indeed, I just fixed the engine glow and the light textures. I'm using the bloom mask that is later used to compute the bloom effect to fix the light textures, so I guess people may have to combine the bloom shader and SSAO.
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
Nah, just move the code that generates that mask up front, and run it if either one of the the two effects are active.
-
- Posts: 79
- Joined: Tue May 09, 2006 11:01 pm
This looks amazing! Thank you for your work on this. I can't wait.
-
- Posts: 52
- Joined: Sun Aug 25, 2019 10:02 pm
Wow, looks great. With all your hard work, XWA may get modern, state-of-the art graphics. For a 20-years old game that's hugely impressive.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Thanks for your support guys. Yes, the idea is to improve the graphics rendering of this game to a more modern level -- well, I think that's essentially the common goal of the XWAU team anyway. It does look a bit better; but don't expect something like the recent Star Wars Battlefront games
Indeed! I ended up doing this exactly, thanks for your suggestion!keiranhalcyon7 wrote: ↑Mon Sep 30, 2019 9:19 amNah, just move the code that generates that mask up front, and run it if either one of the the two effects are active.
You do not have the required permissions to view the files attached to this post.
I don't judge tactics. The Battle is the best and only Judge.
- Vince T
- Posts: 14052
- Joined: Fri Apr 27, 2001 11:01 pm
- Contact:
Nice! Looking forward to testing that with the VSD
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear
Vince T's X-Wing HQ - where the bad guys get their gear
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
WOWOWOWOW, I am amazed how good it looks on the ISD.
Now, can I ask what options we will get? i.e. can we change the test distance (i.e. setting the test to say 500m would effectively occlude all interior sections)
could we set the number of times it is calculated?
What I am thinking here is ExteriorAO (using a long test distance and low power for space, high power for atmosphere) and InteriorAO (using short test distance and higher power as a basic DIR (Diffuse Inter-Reflection))
Trev
EDIT, the default MXAO shader in reshade has a disabled "Indirect Lighting" option * which is what I mean by DIR... I cant test however but since its part of the shader can you enable it ?
*
Now, can I ask what options we will get? i.e. can we change the test distance (i.e. setting the test to say 500m would effectively occlude all interior sections)
could we set the number of times it is calculated?
What I am thinking here is ExteriorAO (using a long test distance and low power for space, high power for atmosphere) and InteriorAO (using short test distance and higher power as a basic DIR (Diffuse Inter-Reflection))
Trev
EDIT, the default MXAO shader in reshade has a disabled "Indirect Lighting" option * which is what I mean by DIR... I cant test however but since its part of the shader can you enable it ?
*
Code: Select all
#ifndef MXAO_ENABLE_IL
#define MXAO_ENABLE_IL 0 //[0 or 1] Enables Indirect Lighting calculation. Will cause a major fps hit.
#endif
Last edited by Trevor on Wed Oct 02, 2019 5:45 pm, edited 2 times in total.
- Darksaber
- Posts: 10931
- Joined: Mon Jan 10, 2000 12:01 am
- Contact:
New word of the day Occlude, honestly never heard of that one before
Sorry, to go off topic
Carry on
Sorry, to go off topic
Carry on
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Thanks for your comments guys. I'm using a somewhat simple SSAO implementation and learning how it works at the same time. Right now, you can set how many iterations/samples you want up to a maximum of 4/16. The radius of the effect, the attenuation/falloff, the sub-resolution used to compute it and the blur.
I'm *just* realizing some of the limitations of SSAO: you can either get the parameters to work nice on distant objects, or get it to work on close objects -- but probably not both at the same time. If I disable the perspective correction for the radius, then I can get it working on both distant and close objects; but then close objects (like the cockpit) tend to obscure distant objects a little bit. I guess I can put switches to disable/enable perspective-correct SSAO and maybe enable multiple passes with different settings as you suggest, Trevor (although that will probably come in version 2.0)
The other problem is that close objects will always interact with distant objects anyway because the back faces of closer objects are culled and the depth values for those faces are lost. So I'm not sure if there's anything that can be done about that...
Some sort of basic Diffuse Inter-Reflection should be possible now, yes -- I just have to figure out a nice way to compute it and mix it. I'm not implementing MXAO directly (that shader is a bit too complex for me right now); but I'm aware that it does some form of DIR and I'm trying to figure out how to translate the relevant bits. So, maybe in the near future...
I'm *just* realizing some of the limitations of SSAO: you can either get the parameters to work nice on distant objects, or get it to work on close objects -- but probably not both at the same time. If I disable the perspective correction for the radius, then I can get it working on both distant and close objects; but then close objects (like the cockpit) tend to obscure distant objects a little bit. I guess I can put switches to disable/enable perspective-correct SSAO and maybe enable multiple passes with different settings as you suggest, Trevor (although that will probably come in version 2.0)
The other problem is that close objects will always interact with distant objects anyway because the back faces of closer objects are culled and the depth values for those faces are lost. So I'm not sure if there's anything that can be done about that...
Some sort of basic Diffuse Inter-Reflection should be possible now, yes -- I just have to figure out a nice way to compute it and mix it. I'm not implementing MXAO directly (that shader is a bit too complex for me right now); but I'm aware that it does some form of DIR and I'm trying to figure out how to translate the relevant bits. So, maybe in the near future...
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
Ah yes, round the x-wing cannons and the nearest ISD turbolaser… hmm, yeah that is a shortcoming of SSAO compared to world AO - but then world AO is very slow since it does everything so compromise must be made.The other problem is that close objects will always interact with distant objects anyway because the back faces of closer objects are culled and the depth values for those faces are lost. So I'm not sure if there's anything that can be done about that...
Also, that's cool you are programming it yourself, it means you will know more about it and should be able to read it back easier since its in your own dialect/style.
Any chance of someone enabling MXAO_ENABLE_IL =1 in reshade preprocessor and showing me some screenshots, the best Ive seen is a garbled mess (where apparently its using the CFB as a normal map and combining with an odd z-buffer... )
Trev
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
I would also like to see an example of MXAO with IL enabled I know DarHan posted some config in the Bloom thread; but it didn't work for me when I tried it and I haven't gone back to fiddle with it to make it work.
Anyway, now that I think about it, there might be something I can do about close objects occluding distant objects. I could probably have two SSAO buffers: one for distant objects and one for close objects/cockpits but both sharing the same depth buffer. The thing is, in the image above the ISD is actually fully rendered and then the X-Wing is rendered on top of it. So, at some point, the depth buffer contains all the info to shade the ISD but then this information is destroyed when the X-Wing is rendered. Maybe if I introduce a Z-threshold and switch the render targets at the right time... Maybe...
Anyway, now that I think about it, there might be something I can do about close objects occluding distant objects. I could probably have two SSAO buffers: one for distant objects and one for close objects/cockpits but both sharing the same depth buffer. The thing is, in the image above the ISD is actually fully rendered and then the X-Wing is rendered on top of it. So, at some point, the depth buffer contains all the info to shade the ISD but then this information is destroyed when the X-Wing is rendered. Maybe if I introduce a Z-threshold and switch the render targets at the right time... Maybe...
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
There's always the chance that Jeremy knows where back face culling is done and can disable it with a hook. I imagine the render pipeline portion of the code is rather complex, though.
The cockpit images up thread look pretty good, but IMO the change in the ISD images is all but unnoticeable due to the game engine's lack of shadows (which are probably a pipe dream to add).
The appropriate solution would probably be baked AO maps... which may not be totally out of the question for ddraw to load on the side.
-
- Posts: 52
- Joined: Sun Aug 25, 2019 10:02 pm
As far as I know, there's no VR support on the PC version of Battlefront II (and only 20 minutes on the PS4). So I'd actually expect more.blue_max wrote: ↑Wed Oct 02, 2019 4:45 amThanks for your support guys. Yes, the idea is to improve the graphics rendering of this game to a more modern level -- well, I think that's essentially the common goal of the XWAU team anyway. It does look a bit better; but don't expect something like the recent Star Wars Battlefront games
(now I'd need to find a cheap VR set)