Integrating XWA's Lights into the New Shaders

Want to edit the game, build your own craft and missions? Here you'll find help, tools, guides and people to discuss with.
Post Reply

Integrating XWA's Lights into the New Shaders

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 10, 2020 3:02 am

Up until this point the shaders I've written rely on specifying external lights on the SSAO.cfg file, which isn't ideal and they ignore the lights in each mission completely. However, I think I finally got XWA's lights working with the new shaders:
xwa-lights-1.jpg
xwa-lights-2.jpg
xwa-lights-4.jpg
The lights now match the position of the suns, nebulae and planets on the background. The lights are a bit saturated, and maybe in some cases not strong enough; but I've added settings to de-saturate them and to modulate their intensity. So people should be able to configure the experience to their liking. I'll post a micro-update soon.
You do not have the required permissions to view the files attached to this post.

Bman
Lieutenant Commander
Posts: 1167
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Fri Apr 10, 2020 4:17 am

Very nice.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Fri Apr 10, 2020 4:51 am

More sweetness!

Question - I know multiple light sources can be specified in the mission files. That's not a problem, is it? Do you see any slowdown in missions with multiple lights?

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 10, 2020 6:51 am

keiranhalcyon7 wrote:
Fri Apr 10, 2020 4:51 am
Question - I know multiple light sources can be specified in the mission files. That's not a problem, is it? Do you see any slowdown in missions with multiple lights?
That's not a problem at all. I don't see any slowness at this point, and I don't expect anything noticeable either :)

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Fri Apr 10, 2020 7:04 am

:thumbs:

Kampher
Cadet 2nd Class
Posts: 79
Joined: Tue May 09, 2006 11:01 pm

Post by Kampher » Fri Apr 10, 2020 1:05 pm

Checking the progress updates every day is like opening another christmas present.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri Apr 10, 2020 1:20 pm

Holy ****!!!
WOW, cant wait to test.

Now, Im seeing that in your screenshots that parts of the cockpit that should be occluded from the light source are still being shaded by it... is that just a temporary bug or a setting for "simplified shader"?


Trev

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Fri Apr 10, 2020 5:00 pm

I really can't believe I am still looking at this very old, but excellent game.
The stuff done with the engine now is outstanding and unbelievable.
In a world where most games are now made for mobile phones I am loving to see this stuff.
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 10, 2020 5:07 pm

Trevor wrote:
Fri Apr 10, 2020 1:20 pm
Now, Im seeing that in your screenshots that parts of the cockpit that should be occluded from the light source are still being shaded by it... is that just a temporary bug or a setting for "simplified shader"?
You're probably referring to the purple light on the X-Wing cockpit. The light source is on the left; but some thin areas in the left dashboard still get this light. Not a bug, that's just the way the fake normal mapping works. If normal mapping is disabled, those artifacts are removed. Those problems might go away once I enable true normal mapping; but I doubt it (I believe these artifacts would be properly resolved by computing shadow maps).

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 10, 2020 5:17 pm

xwa-lights-6.jpg
xwa-lights-7.jpg
xwa-lights-8.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Fri Apr 10, 2020 6:14 pm

This is looking so amazing blue_max!
That second picture made me think of something (sorry if I jump from one idea to the next) See how that backdrop of the planet is kinda bright BUT the lines between it and the station in the foreground are still rather sharp and clearly defined? I don't know how tis effect is called in modern games but would it be possible to modify the bloom hook so the backdrop's brightness outshines those sharp edges?
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 10, 2020 7:50 pm

@GT: I think it should be possible to add bloom to the planet; but the DAT containing the planet (or wherever it is) would need to have illumination. Is it possible to define illuminated areas in a DAT file? The illuminated areas would get converted into bloom. If this is not possible, then I would need to add a threshold to compute the bloom directly from the texture data, so I probably would need to enable this feature. Shouldn't be too hard, though.

OK, here's the ddraw preview with support for the XWA light system (I guess I should probably post this in the "installer thread" too):

https://www.dropbox.com/s/79dpfkteokaxh ... 0.dll?dl=0

I've added the following parameters to SSAO.cfg:

; XWA lights saturation.
; 1: Original saturation
; 0: All lights become grayscale
xwa_lights_saturation = 0.8

; Intensity multiplier: if the lights seem to dark, you can increase their power
; by setting the following above 1. Setting it to 0 will shut down the lights.
; Do not set it too far above 1 or you'll overexpose the render
xwa_lights_global_intensity = 1.0

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Fri Apr 10, 2020 9:26 pm

Well the planet dats are fully illuminated by default I'd say. They do have sort of a transparency channel that much I know but that may rather be a question for DTM as he's the master of backdrops
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Apr 10, 2020 9:50 pm

Actually it was me that removed all the black from around the planets, nebulas, galaxies and so on, making them transparent and blend in better :)

Your welcome :D
“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

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Fri Apr 10, 2020 9:57 pm

Oops sorry mate!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Apr 11, 2020 2:45 am

I think this would be a little tough to get right. You'd need to make sure that the added bloom doesn't wash out the planet image; you just want it to bleed a little over the foreground objects.

Related observation: many of the star backdrop objects have baked-in bloom effects. Would it be better to look at redoing them entirely to make use of a calculated bloom effect instead (perhaps based in part on the objects' strength as a light source)?

Now that you have the game engine's light source, another effect you could think about adding is... What's that effect called where when you look into a light source, everything dims (except the hdr bloom of the light source) to simulate the response of the human eye/iris?

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat Apr 11, 2020 3:11 am

keiranhalcyon7 wrote:
Sat Apr 11, 2020 2:45 am
What's that effect called where when you look into a light source, everything dims (except the hdr bloom of the light source) to simulate the response of the human eye/iris?
Automatic eye adaptation or exposure. I would need to switch everything to HDR, though; and probably tweak the lights somehow too. Not terribly complicated; but the last time I tried I didn't get particularly interesting results either.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Apr 11, 2020 1:36 pm

What's that effect called where when you look into a light source,
I was trying to get suns to wash out the screen, but it didn't work because by the time I got enough bloom to wash the image, the star was invisible and bloom was still a circle (not whole screen):P
everything dims (except the hdr bloom of the light source) to simulate the response of the human eye/iris?
however, yeah, this seems the better option.
I beleve we can still use reshade with blues ddraw.dll however as with all things reshade, its not customisable to xwa (so specular component will darken screen too)


I was playing with the settings for ssdo and it seems rays only travel so far despite any values I use.
eg, turning up inter-reflection I notice rays don't extend beyond 0.5m no matter how bright they are or any other value used.

What I was going for was to use the interreflection to properly illuminate the hangar (instead of using either "ambient" light or "black level" clamping)

Can we get a variable for the IR bounce count and distance please.

Trev

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat Apr 11, 2020 10:50 pm

Trevor wrote:
Sat Apr 11, 2020 1:36 pm
I was playing with the settings for ssdo and it seems rays only travel so far despite any values I use.
Yep, can't have rays travelling unbounded: that would kill performance as it would trash the image cache.
eg, turning up inter-reflection I notice rays don't extend beyond 0.5m no matter how bright they are or any other value used.
The rays stop at screen-space radius specified by two settings: near_sample_radius, and far_sample_radius. These radii are in screen space, so a value of 1 means "travel the whole screen". But if you do that, you'll kill the performance (see above) and it won't work anyway because it's not a ray-marching algorithm: it just samples the screen at the place where the ray lands, disregarding whatever geometry is in the middle. The algorithm assumes that rays will be short, so intervening geometry that gets skipped is usually not a big deal. If you break the assumption, you'll just get a messy result.
What I was going for was to use the interreflection to properly illuminate the hangar (instead of using either "ambient" light or "black level" clamping)
You can get some inter-reflection in the hangar, mostly near the corners; but it's a subtle effect.
Can we get a variable for the IR bounce count and distance please.
SSDO is an approximation to GI at one bounce. Enabling more bounces will not work very well. What you're essentially asking for here is ray-tracing. While this is technically possible, it would be a big project. My guess is that the "easiest" way to do this would involve moving us first to DirectX 12 to use nVidia's ray-tracing API, and then figure out how to use that. However, even if we did that, I'm not sure it would work. The biggest problem I see is that we get clipped and culled geometry in ddraw. So, while things seem solid from the camera's point of view, it's in fact a series of thin sheets when you look at them from the side. Not a big deal when rasterizing; but if you start shooting rays, there's tons of geometry you'll miss, so the result won't make sense. I've already tried to do ray-marching in screen space to add shadows; but it only works in a few places and for a very short distance. In the end, all I get is a horrible mess of inconsistent shadows. If we can't get nice shadows, then ray-tracing won't work either.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sun Apr 12, 2020 6:32 pm

Ah right, got you.

yeah, many problems hark back to not having either the full model or the requirement to do full raytracing (which would be overly computationally expensive or a different technology such as DX12 raytracing)

Trev

Post Reply