Jump to content

Explanation of Shadows.LUA?


Recommended Posts

I'd like to modify the shadows on other aircraft, as when I'm flying in close formation with other Tomcats, the shadow is constantly swapping between the soft and hard/detailed shadow. I've figured out how to draw the more detailed shadow at greater distance, but my tweak absolutely destroys performance when there are a few aircraft in close range, such as on the SC deck. So I'd like to remove these detailed shadows as much as possible, without compromising my cockpit shadows.

 

Does anyone know what the various values in the shadows.lua file represent to help me get this done?

Intel 11900K/NVIDIA RTX 3090/32GB DDR4 3666/Z590 Asus Maximus motherboard/2TB Samsung EVO Pro/55" LG C9 120Hz @ 4K/Windows 10/Jotunheim Schiit external headphone amp/Virpil HOTAS + MFG Crosswind pedals

Link to comment
Share on other sites

I'll try to explain as simple as I can.

 

The first number is depth map shadow resolution. Shadow casting source, the Sun, will look at all objects from it's point of view like a camera and create gray scale depth map at the size specified by this number. Depth map's cannot be anti aliased. So their edges will be jagged and higher this number is, less aliasing and sharper the shadow edge will be. This number has to be power of two. 512, 1024, 2048... And each step increases 4x in size because it's 2x width and height. So 2048 to 4096 is much bigger jump than 1024 to 2048.

 

Because you can't use single 1024x1024 depth map for entire map, CSM technique splits into zones. Smaller zone near you and larger zone further away. The second line of numbers define at what distance the split happens. If you set the second number too high, you're enlarging the first zone thereby blurring and aliasing immediate shadow around you. If you set it too low, you will see the jump from first to second cascade happening too close to you. This jump by the way is what many people complain about in DCS and only way to make it better is moving the zone further away and increase shadow map resolution which will hurt fps.

 

Also, if you have too many "zones" by having too many series of number (not sure if DCS even lets you have more than 6 CSM but anyway), you may smooth out the transition between the zones. But your system has to produce that many more depth maps at the resolution specified.

 

As specified in the lua file, the first set is for outside and second set is for your cockpit.

 

You can also google Cascade Shadow Maps if you want to research further.


Edited by Taz1004
  • Like 1
Link to comment
Share on other sites

Thank you for the information - that's extremely helpful. I kind of was thinking this was how it worked - but this leads to a couple of new questions for clarity:

 

1.) What units are these distances measured in?

2.) Why are there two sections for shadows - one being Nevada, and the second being?

Intel 11900K/NVIDIA RTX 3090/32GB DDR4 3666/Z590 Asus Maximus motherboard/2TB Samsung EVO Pro/55" LG C9 120Hz @ 4K/Windows 10/Jotunheim Schiit external headphone amp/Virpil HOTAS + MFG Crosswind pedals

Link to comment
Share on other sites

1. All distance unit in DCS lua are in Meters

2. I can't really answer that as I don't have Nevada. From the looks of it, Nevada uses less cascades at lower settings. But 2x resolution at low setting. Perhaps due to the flat desert nature of the map? Again, I'm not sure. Default is for all other maps is my guess. It certainly effects Caucasus but again, I only have Caucasus so I can't confirm it.

 

I never actually edited these values myself, only saw other modder's edits. But some suggestion for you to test is to lower that last number from 7000 to about 3-4000. You'll never see shadows 7 km away.

 

And try removing some numbers from cockpit line. If its shadow casting only within the cockpit, I don't know why it would have so many cascades. Should have just one cascade. So just two numbers.

 

Also, raising resolution should be last resort. I've seen someone say modern graphic cards shouldn't have any issue with 4096 shadow maps but seeing how shadows is one of biggest fps hog in DCS, I don't think I agree with that.

You have to consider that these shadow maps are generated every frame. To keep up with shadows of moving objects. Two 4096 shadow cascades calculated every frame is much larger than four 1024 shadow cascades. 8 times larger. And if you adjust the zone carefully... based on your needs, 1024 maps should work just fine.


Edited by Taz1004
Link to comment
Share on other sites

Thanks again, I'm going to get the shadows rendered just the way I want with your help! As mentioned, my issue with the shadows is that when I'm flying in close formation, at a distance of around 20 feet between Tomcats, the lower-res shadow keeps swapping back and forth to a higher-res shadow. Note that I'm only using the internal view, so don't care about external.

 

So, I'm thinking the best solution would be to make it so that hard shadows don't draw on other aircraft at all. How would I change the values for high shadows, as seen below, to do this? I'm still a little unclear on the values. Here's the default high setting:

 

{ --high

4096,

{0.02, 25.0, 100.0, 400.0, 1500.0, 7000},

{0.02, 2.5, 25.0, 250.0, 1500.0, 7000}

},

 

 

The first line is for "split distances outside", the second is for "split distances inside cockpit". What does that actually mean? Is it that the second line is used to determine where the shadows change when looking out from the cockpit? If so, the first value is a mere 2cm away? Then the next is 2.5m - which value is it that would determine the shadows on the other aircraft? The 25?

 

Thanks again for your help - would be lovely if the developers interacted with us lol!


Edited by GunSlingerAUS

Intel 11900K/NVIDIA RTX 3090/32GB DDR4 3666/Z590 Asus Maximus motherboard/2TB Samsung EVO Pro/55" LG C9 120Hz @ 4K/Windows 10/Jotunheim Schiit external headphone amp/Virpil HOTAS + MFG Crosswind pedals

Link to comment
Share on other sites

First value is beginning of the shadow map. So don't change that.

 

Try these values. You can't eliminate the transition. Goal is to make it less noticeable. If you're still seeing it where you don't want it to, maybe show me a screenshot.

 

{ --high

4096,

{0.02, 25.0, 100.0, 400.0, 1500.0, 7000},

{0.02, 40.0, 80.0, 160.0, 500.0, 5000}

},


Edited by Taz1004
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Thanks so much - this worked, but will it have a performance impact? I only tried it while flying formations, not on a crowded carrier deck.

Intel 11900K/NVIDIA RTX 3090/32GB DDR4 3666/Z590 Asus Maximus motherboard/2TB Samsung EVO Pro/55" LG C9 120Hz @ 4K/Windows 10/Jotunheim Schiit external headphone amp/Virpil HOTAS + MFG Crosswind pedals

Link to comment
Share on other sites

  • 1 year later...

@Taz1004 , once again thank you.

Necro-ing an old post but with the Hind now taking up my time these little tweaks make all the difference down low. No more shadow flicker in sync with the rota!!


Edited by Boosterdog

MSI Tomahawk X570 Mobo, Ryzen 5600X undervolted on Artic Freezer E34 Cooler, RTX3080 FE, 32GB (2x16GB Dual Ranked) GSkil 3600 CL16 Trident Neo RAM, 2X 4th Gen M2 SSDs, Corsair RM850x PSU, Lancool 215 Case. 

Gear: MFG Crosswinds, Warthog Throttle, Virpil T50CM gen 1 stick, TIR5, Cougar MFD (OOA), D-link H7/B powered USB 2.0 Hub all strapped to a butchered Wheel stand pro, Cushion to bang head on, wall to scream at.  

Link to comment
Share on other sites

  • 5 months later...

Hello,

I have to questions about this process:

- modify the shadows.lua file, could be a problem in multiplayer mode?

- GunSlingerAUS, at the begining of the thread, you mention that you discovered another way  to draw the more detailed shadow at greater distance, could you tell me wich way is it?

 

Thanks!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...