Cockpit Shadows
Cockpit Shadows
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
This is something I've been working on for a while now, it's finally coming to fruition:
https://youtu.be/tOX1yDf7uQU
https://youtu.be/DsgyHwoAPV8
The blackness of the shadows can be configured, so don't worry about that
Yes, the shadows can be disabled for people who don't like them.
The way this is going to work is by side-loading simplified geometry and using that to compute regular shadow mapping. It will only work on the cockpit for now.
Coming soon!
https://youtu.be/tOX1yDf7uQU
https://youtu.be/DsgyHwoAPV8
The blackness of the shadows can be configured, so don't worry about that
Yes, the shadows can be disabled for people who don't like them.
The way this is going to work is by side-loading simplified geometry and using that to compute regular shadow mapping. It will only work on the cockpit for now.
Coming soon!
You do not have the required permissions to view the files attached to this post.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.
I don't judge tactics. The Battle is the best and only Judge.
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
YES!!!
Finally shadows
suggestion, at the end of the vid, show the light source.
Its fine seeing the shadows and all, but if we cant see the source they could be mirrored or totally random.
Cant wait to see more (Hoping for full ship occlusion)
Somewhat related, I have been playing with SSDO settings again (Oh and the new multi-core options work great and I have 0 problems (someone mentioned sound problems)) and I think the Hangar needs some special lighting.
At present there is 1 infinit light source directly above.
this causes some weird shading (and if shadows are present could totally occlude the hangar) so I think local lights are needed.
Trev
Finally shadows
suggestion, at the end of the vid, show the light source.
Its fine seeing the shadows and all, but if we cant see the source they could be mirrored or totally random.
Cant wait to see more (Hoping for full ship occlusion)
Somewhat related, I have been playing with SSDO settings again (Oh and the new multi-core options work great and I have 0 problems (someone mentioned sound problems)) and I think the Hangar needs some special lighting.
At present there is 1 infinit light source directly above.
this causes some weird shading (and if shadows are present could totally occlude the hangar) so I think local lights are needed.
Trev
- ual002
- Posts: 983
- Joined: Wed Sep 24, 2008 2:23 am
Blue_max. You're killing me with your visual contributions my dude. This is fantastic.
- Ace Antilles
- Posts: 7910
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
It's very random. You can have no issues with the music and then you can have it hit you mid game.
A fix is being tried but it's elusive. Also we can't recreate the bug happening fast to know if it's fixed or not.
- AngeI
- Posts: 528
- Joined: Sun Jan 24, 2016 5:27 pm
As usual blue max, amazing work, can't wait to try it out
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Check this out:
https://youtu.be/onCBwKrhiEA
What do you mean by this?Cant wait to see more (Hoping for full ship occlusion)
Can you post some pictures of the problem? I know the shadows in the hangar have the wrong color; but otherwise the hangar looks fine to me.Somewhat related, I have been playing with SSDO settings again and I think the Hangar needs some special lighting.
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
Gorgeous:)Check this out:
(lol) I assume you are joking, but just in case you are not, I mean shadows cast from the ships onto other ships (and undersides being in shadow)What do you mean by this?
Yes, shadows generated by xwa are the wrong colour but I mean more Global Illumination.Can you post some pictures of the problem? I know the shadows in the hangar have the wrong color; but otherwise the hangar looks fine to me.
So, In Space (as most of the game is in space) I set Ambient to 0, BUT the hangar has lots of DIR and so should be brighter.
You already explained that your implementation of DIR would only extend 1m and no more due to limitations, so, the only way to get "Realistic" results is to use Ambient OR add Upward pointing lights.
With Headlights now being a thing it got me thinking about having real lights in the hangar anywhere there is a drawn light.
(actually I just relised how many that is and its impractical, but Id still like to add an uplighter to approximate light reflected from the floor (and there are some lights on the floor anyway)
(I was to attach some images, but Ill post this first incase my power goes out.)
ok, so this image was a fun render (took 10 mins to render with all the lights and DIR) Trev
You do not have the required permissions to view the files attached to this post.
- rogue518
- Posts: 2866
- Joined: Wed Jul 12, 2000 11:01 pm
- Contact:
That's fantastic!! blue_max...
Sincerely, Rogue518
Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Thanks for your comments guys. I think I can release this soon as it is now working in VR as well. As usual, there might be a few glitches that I'll continue to fix in future releases.
@Trevor: No, I wasn't joking. "Occlusion" can mean a number of things, so better to ask At the moment, I can only add shadows to the cockpit because the cockpit is centered on the camera, so I know where it is at all times. Adding it to other craft would require knowing where they are, their orientation, etc, and I still don't know how to extract that information from XWA.
I'll see if something can be done in the hangar. At the very least I think I can fix the color of the shadows as I find that disturbing too.
@Trevor: No, I wasn't joking. "Occlusion" can mean a number of things, so better to ask At the moment, I can only add shadows to the cockpit because the cockpit is centered on the camera, so I know where it is at all times. Adding it to other craft would require knowing where they are, their orientation, etc, and I still don't know how to extract that information from XWA.
I'll see if something can be done in the hangar. At the very least I think I can fix the color of the shadows as I find that disturbing too.
Windows 10 Pro 64-bit, i7-10700KF, 64GB 3200MHz DDR4, Geforce RTX 2080 Super 8GB
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
Sounds good Blue
Trev
P.S. I had fun rendering these too. Full lighting (every light emits light) and DIR.
You can see that while there are subtle shadows etc, for a scene like this with plenty of lights, ambient does the job its supposed to very well.
Trev
P.S. I had fun rendering these too. Full lighting (every light emits light) and DIR.
You can see that while there are subtle shadows etc, for a scene like this with plenty of lights, ambient does the job its supposed to very well.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 21
- Joined: Sat Aug 22, 2009 5:01 am
Sweet! Thank you so much for all your awesome contributions to this project. Amazing how far it has come.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
There's support for multiple lights, but I'm only processing one at the moment. I can add a switch to enable multiple/single Suns.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Recent releases of the VR mod/effects ddraw already have support for cockpit shadows. However, additional work is needed to enable this feature.
First you'll need a new directory in the XWA install directory called "ShadowMapping". This directory should contain OBJ files, one per cockpit. The name of the files should match the name of the cockpit, like "XWingCockpit.obj", "YWingCockpit.obj", etc. You can create these files yourself by exporting OBJ files from the cockpit OPTs. Strip all the textures and materials and remove all the small details like buttons. See the examples provided here:
https://www.dropbox.com/s/9seoblhr8widf ... g.zip?dl=0
(Before publishing this ZIP file I had already asked the various cockpit authors for permission to publish simplified versions of their cockpits)
For some reason I still don't understand, sometimes the shadow map OBJ will be flipped/mirrored on one axis. To fix this you can add the following settings in the material definition file for the cockpit, in the [Default] section:
If you want to flip one axis, use -1 instead of 1. For instance, this is what the X-Wing cockpit material file looks like:
Link to the full file:
https://www.dropbox.com/s/o6dvui1gbcrgj ... t.mat?dl=0
Finally, to enable the feature itself just add the following lines to SSAO.cfg:
I'll be working to automate all of this and provide shadow mapping OBJs in future releases. But for now, if you can't wait, this is how you enable this feature.
First you'll need a new directory in the XWA install directory called "ShadowMapping". This directory should contain OBJ files, one per cockpit. The name of the files should match the name of the cockpit, like "XWingCockpit.obj", "YWingCockpit.obj", etc. You can create these files yourself by exporting OBJ files from the cockpit OPTs. Strip all the textures and materials and remove all the small details like buttons. See the examples provided here:
https://www.dropbox.com/s/9seoblhr8widf ... g.zip?dl=0
(Before publishing this ZIP file I had already asked the various cockpit authors for permission to publish simplified versions of their cockpits)
For some reason I still don't understand, sometimes the shadow map OBJ will be flipped/mirrored on one axis. To fix this you can add the following settings in the material definition file for the cockpit, in the [Default] section:
Code: Select all
shadow_map_mult_x = 1
shadow_map_mult_y = 1
shadow_map_mult_z = 1
Code: Select all
[Default]
Metallic = 0.4
Intensity = 0.8
Glossiness = 0.08
shadow_map_mult_z = -1
https://www.dropbox.com/s/o6dvui1gbcrgj ... t.mat?dl=0
Finally, to enable the feature itself just add the following lines to SSAO.cfg:
Code: Select all
; Shadow mapping feature switch
shadow_mapping_enable = 1
; Adds a bias to the shadow map to prevent self-shadowing
shadow_mapping_bias_sw = -0.03
; Screen-space search radius used to soften the edges of the shadow
shadow_mapping_pcss_radius = 0.00125
; Number of samples around the current pixel used to soften shadows
shadow_mapping_pcss_samples = 3
; Blackness of the shadows. 0 is full black, 1 disables shadows.
shadow_mapping_black_level = 0.2[
-
- Posts: 48
- Joined: Thu Jul 02, 2020 1:00 pm
Hi Blue Max,
You say "For some reason I still don't understand, sometimes the shadow map OBJ will be flipped/mirrored on one axis."
This wouldn't happen to be on the AssaultGunboatCockpit and the AwingCockpit would it?
I only ask as there are a around 20 faces on the Gunboat that are inverted and most of the body of Awing cockpit that is inverted
Also do you have to have the dynamic cockpits enabled to use these or does it work without them
Thanks
You say "For some reason I still don't understand, sometimes the shadow map OBJ will be flipped/mirrored on one axis."
This wouldn't happen to be on the AssaultGunboatCockpit and the AwingCockpit would it?
I only ask as there are a around 20 faces on the Gunboat that are inverted and most of the body of Awing cockpit that is inverted
Also do you have to have the dynamic cockpits enabled to use these or does it work without them
Thanks
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Hello Ronin65.
No, this happens on the X-Wing. The workflow I usually follow to create a shadow map is like this:
1. Export OPT to OBJ.
2. Duplicate the OBJ to have a backup.
3. Remove all textures and materials.
4. Remove unnecessary faces or small details.
5. Fill in any gaps in the cockpit.
6. Export to regular OBJ file without any normal or texture data.
At this point, the shadow map OBJ and the original OBJ should overlap perfectly. But in the case of the X-Wing cockpit, I also have to do this:
7. Mirror the Z-axis.
So the shadow map and the OBJ don't overlap anymore. This doesn't make any sense, so instead of asking people to do this weird step, I added the setting in the materials file.
The clockwise/counter-clockwise ordering of the vertices and the normals of the polygons is ignored for shadow mapping, so this doesn't matter, but thanks for the heads-up.I only ask as there are a around 20 faces on the Gunboat that are inverted and most of the body of Awing cockpit that is inverted
No, this is not needed, but you need to enable one of the SSAO shaders (deferred, SSAO or SSDO).Also do you have to have the dynamic cockpits enabled to use these or does it work without them
-
- Posts: 48
- Joined: Thu Jul 02, 2020 1:00 pm
Ok thanks for the clarification, about not having to use dynamic cockpits
It just seemed coincidental that the faces where inverted and you where having problems with the shadows, this is why I asked
Strange, is it just the xwing cockpit?
In future will you be providing more *.Mat files for other craft along with the Shadow OBJ files, you've included some OBJ files but no *.mat files it just seems a little counter productive if you don't included them for all craft, just thought there should be standard mat files for each opt even with the global mat file, some craft still look like and to coin a phrase used by Forceflow, they look like polystyrene. Sorry I don't mean to be rude, but they do, you must have noticed it your self
It just seemed coincidental that the faces where inverted and you where having problems with the shadows, this is why I asked
Strange, is it just the xwing cockpit?
In future will you be providing more *.Mat files for other craft along with the Shadow OBJ files, you've included some OBJ files but no *.mat files it just seems a little counter productive if you don't included them for all craft, just thought there should be standard mat files for each opt even with the global mat file, some craft still look like and to coin a phrase used by Forceflow, they look like polystyrene. Sorry I don't mean to be rude, but they do, you must have noticed it your self
- Trevor
- Posts: 541
- Joined: Thu Dec 04, 2014 7:11 pm
Ronin, this is beta, not a finished product.
You cant expect Blue to spend time making obj's and mtls for every craft when the spec could change tomorrow - i.e. objs shouldn't even be needed.
anyway, I got to test shadows and … *drool* they look great, but I was also going to mention the "wandering shadows" bug too.
May I ask technically how you are achieving the raycast shadows?
Trev
You cant expect Blue to spend time making obj's and mtls for every craft when the spec could change tomorrow - i.e. objs shouldn't even be needed.
anyway, I got to test shadows and … *drool* they look great, but I was also going to mention the "wandering shadows" bug too.
May I ask technically how you are achieving the raycast shadows?
Trev