A New Shading Model

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

A New Shading Model

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

Post by blue_max » Fri Jan 31, 2020 6:47 pm

Because Jeremy is a genius, he figured out a way to send the smooth normals from XWA down to ddraw and wrote a hook for this. I've been tinkering with this hook to add specular shading to SSDO, along with some bloom to get a look that resembles HDR. This is still a preview; but this is what it looks like:
specular-5.jpg
specular-6.jpg
specular-7.jpg
And yes, I know the bloom is a bit exaggerated, I just wanted to make sure it was working -- it can be adjusted. In fact, I think it will now be possible to specify per-texture materials so that we can vary the specular intensity, glossiness, metallicity, etc to fine tune the effect for each craft. The idea is to end up with a set of parameters close to what is currently being used in the industry for PBR shading (or what Blender calls "Principled/Ultimate Shader"). It might even be possible to side-load textures that specify glossiness/metallicity, normal mapping and stuff like that.

In other words, there's going to be even more eye candy for this game in the near future.
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Fri Jan 31, 2020 6:49 pm

A few more samples:
specular-10.jpg
specular-11.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
JeremyaFr
XWAU Member
Posts: 4001
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Jan 31, 2020 7:00 pm

Nice :thumbs:

User avatar
DarHan
Rebel Alliance
Posts: 325
Joined: Mon Dec 05, 2005 12:01 am
Contact:

Post by DarHan » Fri Jan 31, 2020 8:03 pm

All I can say is “Squeee!”
“Red Four, nothing’s gone wrong yet.”
— Hobbie Klivian

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

Post by Trevor » Fri Jan 31, 2020 8:20 pm

WOWWW... *drool*

I must have this now

Trev

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

Post by keiranhalcyon7 » Fri Jan 31, 2020 9:33 pm

Sweeeeet!

That's what it looks like on a cockpit. What's it look like on an ISD's hull panels?

User avatar
rogue518
XWAU Member
Posts: 2866
Joined: Wed Jul 12, 2000 11:01 pm
Contact:

Post by rogue518 » Fri Jan 31, 2020 10:28 pm

blue_max this is astounding!!!. :shock:

Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'

Turgidson
Cadet 2nd Class
Posts: 52
Joined: Sun Aug 25, 2019 10:02 pm

Post by Turgidson » Sat Feb 01, 2020 12:28 am

WOW!
Maybe I really wasn't joking when I wrote that XWA will soon get state-of-the-art graphics. :)

What's missing would be multithreaded renderer and real shadows (maybe these can't be fixed ever).

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

Post by blue_max » Sat Feb 01, 2020 6:55 am

Thanks for your comments guys! There's still a lot of details I need to fix; but I'll get there. For instance, it's becoming increasingly obvious that I'm going to need to specify glossiness parameters for each texture independently. There isn't a single setting that works well for everything -- and there's some surfaces that need to stay matte, like the asteroids. So there's still a lot to do.
keiranhalcyon7 wrote:
Fri Jan 31, 2020 9:33 pm
That's what it looks like on a cockpit. What's it look like on an ISD's hull panels?
It looks shiny.. and a bit pixelated too :P
specular-12.jpg
specular-13.jpg
Does anyone know of a reasonably good software that upscales textures? I've heard that there are some AI algorithms that to these things. I might need to upscale a few textures, like the ISD above, to get better results.
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Sat Feb 01, 2020 6:58 am

A few more samples, with regular diffuse shading and diffuse + specular:
specular-14.jpg
specular-15.jpg
There are a few areas in this cockpit that need less glossiness (and also maybe less normal mapping too). As I said, these are previews and there's still lots of things to fix!
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Sat Feb 01, 2020 7:59 am

The following picture highlights another problem I've got to deal with: the normals in some of the OPTs are probably wrong (?) Notice how the illumination is inconsistent between the ISD in the foreground and the Imperial Research Station on the background. I don't know if the normals are OK on both models.
specular-16.jpg
Does anyone know of a tool to "fix" the normals on the OPTs automatically?
You do not have the required permissions to view the files attached to this post.

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

Post by Vince T » Sat Feb 01, 2020 2:39 pm

sort of, there's a program called XWA OPTer or OPT fix which automatically recalculates all the normals. It's available from DS' site. Also, Jeremy made his own version of it.

Looks incredible by the way. Must test with VSD....
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

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

Post by Trevor » Sat Feb 01, 2020 4:32 pm

blue_max wrote:
Sat Feb 01, 2020 6:55 am
it's becoming increasingly obvious that I'm going to need to specify glossiness parameters for each texture independently. There isn't a single setting that works well for everything -- and there's some surfaces that need to stay matte, like the asteroids.
Well, yes, textures will need to specify their own properties. (Glass = specularity of 1, matte paint = specularity of 0)

You mentioned earlier about maybe using specular maps - that might be the better way to go since each texture has many regions (patches of glass for example)

Given that we may now have Specular ant Normal maps, it might be a good idea to start organising textures into folders of craft name. (I'm thinking Flight Simulator Style i.e.

Code: Select all

Aircraft
	|-Spitfire_MkI
	|	|-texture
	|	|	|-spit-l-side.bmp
	|	|	|-spit-r-side.bmp
	|	|-aircraft.cfg
	|	|-Spitfire_MkI.air
	|-Spitfire_MkIX
	|	|-texture
	|	|	|-spit-l-side.bmp
	|	|	|-spit-r-side.bmp
	|	|-aircraft.cfg
	|	|-Spitfire_MkIX.air
Trev

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

Post by blue_max » Mon Feb 03, 2020 8:48 am

That's right, Trevor. I'm going to have to do something like the directory tree you described. However, since I doubt that we'll have material definitions for all the ships, I still need to have a generic specular shader that will provide reasonably good results everywhere -- and then a few ships can be fine-tuned later. Right now, I'm using the original texture itself to create a "specular map" by looking at the lightness value. If it's a dark area, there specularity will be low and viceversa. Something like that. I'm getting reasonably good results right now with this approach:

No specular shading:
specular-17.jpg
With spec shading + fake normal mapping:
specular-18.jpg
Here's one more, with a material that looks a bit metallic:
specular-22.jpg
You do not have the required permissions to view the files attached to this post.

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

Post by keiranhalcyon7 » Mon Feb 03, 2020 6:40 pm

While that looks pretty amazing in a general sense, most Star Wars OT ship hulls are not actually metallic.

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

Post by blue_max » Mon Feb 03, 2020 6:43 pm

keiranhalcyon7 wrote:
Mon Feb 03, 2020 6:40 pm
While that looks pretty amazing in a general sense, most Star Wars OT ship hulls are not actually metallic.
Yeah, I know. Most of them are matte or have a very small specular shine to them. But I wanted to leave that material option anyway in case it's needed somewhere.

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

Post by keiranhalcyon7 » Mon Feb 03, 2020 6:59 pm

blue_max wrote:
Mon Feb 03, 2020 6:43 pm
But I wanted to leave that material option anyway in case it's needed somewhere.
TIE solar panels, I think. And Naboo ships, of course.

User avatar
rogue518
XWAU Member
Posts: 2866
Joined: Wed Jul 12, 2000 11:01 pm
Contact:

Post by rogue518 » Tue Feb 04, 2020 3:37 pm

To be honest... to me, the metallic looks kind of cool.... :D

Edit: I agree with keiranhalcyon7 especially regarding the Naboo Fighter... ;)


Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'

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

Post by blue_max » Sat Feb 08, 2020 12:53 am

Still working on getting generic settings that would work even if the models are not configured for this system. I think I've got something that's a reasonable compromise. In this screen, the outside of the cockpit looks metallic:
ywing-shaded-1.jpg
But the inside looks matte with only a slight shine:
ywing-shaded-2.jpg
ywing-shaded-3.jpg
By default, bright/white areas will look shiny/metallic and dark/grey areas will look matte. It's not perfect; but I think it looks reasonably well, and I need to move on. I'm going to provide a set of material config files for specific cases so that. These config files will be OPT and texture-driven. For version 2, I'll try to add support to side-load metallicity/roughness textures and stuff like that.
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Sat Feb 08, 2020 12:54 am

I also just added support for glass:
gunboat-glass-1.jpg
gunboat-glass-2.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
JeremyaFr
XWAU Member
Posts: 4001
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Feb 08, 2020 9:44 am

Nice :thumbs:

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

Post by Kampher » Sat Feb 08, 2020 5:21 pm

This is amazing! What a huge difference this is all starting to make.

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

Post by Bman » Sun Feb 09, 2020 7:42 am

Very cool Blue Max. I guess this could apply to a water surface too to reflect sunlight if there ever was such an .opt made. i.e. oceans of Camino in an atmospheric mission, with buildings etc.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.

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

Post by Trevor » Sun Feb 09, 2020 2:17 pm

Oh... with new pixelshaders you could probably actually make animated water surface... *droolllll*

Actually... getting ahead of myself here, but maybe pixelshaders are the better way to implement atmospheric missions?
Theoretically you could also have a transition from ground to space within one region using distance from ground mesh to determine atmospheric density.

Trev

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

Post by blue_max » Sun Feb 09, 2020 9:16 pm

Yeah, this could apply to water too. Making animations would be a different project; but I think it would be doable in a PixelShader (just like the hyperspace effect). Transitions from atmosphere to space may also be possible with pixel shaders.

Also, the Dynamic Cockpit elements have proper shading now too, thanks to DTM and Jeremy:
specular-24.jpg
specular-25.jpg
You do not have the required permissions to view the files attached to this post.

Post Reply