Jump to content
Ðŗąçø

A Decent Guide to Crisp Shadows

Recommended Posts

Wondering how to get better frame rates with shadows in X-Plane? Jagged and blocky shadows doing your square head in? Wondering if tweaking X-Plane's shadows are even possible? If the answer is a resounding YES to any of those questions, you're come to the right place! This guide details everything you need to know about modifying aircraft and scenery shadows in X-Plane 11.

jc.thumb.jpg.1694f5464892c30cb5093df4cf56fdb1.jpg

 

WARNING: MAKE ABSOLUTELY SURE THERE ARE NO OTHER .LUA FILES USING THE SAME DATAREFS CONTAINED HERE WITHIN. PERFORMANCE ISSUES CAN BE EXPECTED OTHERWISE!

 

First of all, we need to understand what actually draws these shadows. And the simple answer is: it's your GPU. For reference, my GPU is an MSI GTX 970, which can draw shadows on a medium-high setting. Faster GPUs will be able to draw better shadows in terms of distance and quality. Back in X-Plane 10, we had quite a bit of control with shadows in the settings menu, but with X-Plane 11's new UI, all we can do is choose whether we want shadows on scenery or not. This guide will detail several datarefs, all of which can be modified through FlyWithLua, and tweaked to your preferences.

Like any good recipe for delicious results, the ingredients required are:

  • At least 60 minutes of time (recommended)
  • FlyWithLua COMPLETE edition*
  • A text editor. I'd recommend Notepad++, as it can read and format .lua files, but a default text editor also works just fine

Complete edition is a requirement as the datarefs listed below are private, which cannot be modified using the core edition

So, let's get started! Firstly, some useful information to keep in mind: you don't have to stick to values I recommend. Feel free to experiment and find what's right for you. Most guides and information just tell you settings you should use, but that's not the case here, albeit there are limits. Also, you can change any value at any time, remembering of course to save the file each time you make an edit, and to reload the script through the FlyWithLua menu.

The first dataref to consider is:

sim/private/controls/fbo/shadow_cam_size

Shadows aren't some sort of computing wizardry. They are in fact a texture, and the primary resolution of that texture is defined using this value. The value of this dataref plays a key part in the overall quality of your shadows, but keep in mind it also affects your frame rate if turned up too high. Some common values you might want to consider toying with are:

  • set( "sim/private/controls/fbo/shadow_cam_size", 1024) -- Recommended for low-tier GPUs/integrated graphics
  • set( "sim/private/controls/fbo/shadow_cam_size", 2048) -- Recommended for mid-tier GPUs
  • set( "sim/private/controls/fbo/shadow_cam_size", 4096) -- Recommended for mid-high-tier GPUs
  • set( "sim/private/controls/fbo/shadow_cam_size", 6144) -- Recommended for high-tier GPUs
  • set( "sim/private/controls/fbo/shadow_cam_size", 8192) -- Recommended for very high-tier GPUs

I personally set this value to 6144 for nice, crisp shadows, but it is borderline in terms of a high performance impact. 4096 will give you reasonable results without too much of a performance hit, whilst anything below will start to give less-desirable results. You can use any other value too, such as 3000, 5281 or 16,384, which is the largest texture size most GPUs can support.

Here are some comparison screenshots inside the flight deck (click to enlarge):

Default.jpg1024.jpg2048.jpg4096.jpg6144.jpg8192.jpg

(Note: The colour of the shadow in the first screenshot is not impacted by texture size, and I forgot that the sun moves!)

As you can see, the higher the number, the better the quality. Default seems to be somewhere between 6144-8192. Pay close attention to where the METAR display would be, the lower EICAM display knob, the 'MAX. TAKEOFF WEIGHT 78T' panel, the throttle quadrant and the shadows cast around the top-left corner of the screen. You'll notice higher quality shadows pay more respect to objects at closer distances, which can sometimes look quite unrealistic on lower resolutions.

Now take note of the same dataref and the same numbers, this time using shadows on scenery:

Default.jpg1024.jpg2048.jpg4096.jpg6144.jpg8192.jpg

(I learnt my lesson! Sim time is paused now, and I turned off depth of field)

In these screenshots, it may not be obvious at first judging by the shadow cast by the wing of the MD-80, but the exterior shadow quality in the default screenshot is worse than the 1024. MUCH WORSE, in-fact. Recall what I mentioned above, about how shadows with a higher resolution pay more attention to close objects. Now observe shadows under vehicles and under EGKK's Skybridge (floating because the airport is not flat). Makes sense now, right?

I'd like to introduce to you interior and exterior shadow quality. You'll note the shadow cast by the wing in the 1024 screenshot looks abysmal. Like... REALLY REALLY BAD!!! That's why in the interior cockpit views, two shadow qualities exist: interior shadows and exterior shadows. The interior shadows have, be default, a higher resolution than exterior shadows, because we want interior shadows to be more crisp and exterior less crisp. That way, we get satisfying results without too much of a performance hit.

But to complicate things even more, there's a third shadow parameter in the middle. This is the aircraft's volume-rendered shadow, calculated based on the .obj files initially loaded. It helps to explain the situation with the shadow of the wing. You can see approximately where this is with this screenshot, using the 737-900ER:

1492983507_X-Plane2018-07-2921-56-05.thumb.jpg.89123c1aba0d3e5b480ff227a1b75a33.jpg

Below the red lines, we have crispier shadows, compared to above where the shadow gets a bit pixelated. Brain a bit frazzled? Maybe this diagram will help clear things up. I know this is an external view, but let's pretend that we are looking out of the passenger window for the purposes of this handy diagram:

circles.thumb.jpg.6fba4c7a5bd3d27714cc70e352e8ec49.jpg

This summarises the boundaries of shadows in X-Plane. The interior/exterior boundary is pretty self-explanatory, and moves with the interior camera location. The volume-rendered shadow is fixed with the aircraft. All of these play a part in the quality of your shadows in X-Plane, and the remainder of this guide explains further datarefs and their usefulness in customising X-Plane's shadows.

Coming back to the interior and exterior shadows now, these are their respective datarefs:

sim/private/controls/shadow/csm_split_interior
sim/private/controls/shadow/csm_split_exterior

Like shadow_cam_size, these adjust the overall quality of interior and exterior shadows, respectively. These datarefs can take integers between 1 and 4, with higher values giving more desirable results, but poorer frame rate. Prior to X-Plane 11.10, these values could be set as high as 8, but unfortunately they now only go up to 4 (before you hit fatal OpenGL errors), which is high enough in my opinion. Unfortunately, the exterior dataref has a slight problem: it only looks good on its highest value (4); else it is slightly or moderately pixelated. This is of course only really beneficial if you use shadows on scenery, and can seriously degrade fps.

Another dataref you may consider using is:

sim/private/controls/shadow/cockpit_near_adjust

Take a look at the handy diagram I added above. This dataref is very simply the size of the green sphere on the diagram. Inside this sphere is of course the interior shadow quality. I'd recommend setting this value between 1.5-4, which is ideal for all cockpits. 2 is good enough in general.

This dataref adjusts the distance the interior shadows become exterior:

sim/private/controls/shadow/cockpit_near_proxy

Be wary that the higher this dataref goes, the worse closer shadows become. You can see this dataref's effect by turning interior quality up, exterior quality down, and messing about with this number. It's all about fiddling around with these datarefs.

And finally:

sim/private/controls/shadow/csm/far_limit

This dataref is the distance at which shadows will stop drawing. As simple as that. Same units as cockpit_near_adjust.

 

Well, there you have it. All the datarefs you need to get sublime shadows in X-Plane. Use the format below to easily copy and paste the datarefs into a new or existing .lua file (sorry if you've already done it!), taking care to ensure it really is a .lua file:

set( "sim/private/controls/shadow/csm_split_exterior", X)		--(Integers between 0-4)
set( "sim/private/controls/shadow/csm_split_interior", X)		--(Integers between 0-4)
set( "sim/private/controls/fbo/shadow_cam_size", XXXX)			--(Integers between 0-16,384)
set( "sim/private/controls/shadow/cockpit_near_adjust", X)		--(Values 0 or greater)
set( "sim/private/controls/shadow/cockpit_near_proxy", X)		--(Values 0 or greater)
set( "sim/private/controls/shadow/csm/far_limit", XXXXX)		--(Values 0 or greater)

Also, take note values can be decimal numbers. But not integers. Here's what I'm using right now:

set( "sim/private/controls/shadow/csm_split_exterior", 4)
set( "sim/private/controls/shadow/csm_split_interior", 4)
set( "sim/private/controls/fbo/shadow_cam_size", 6144)
set( "sim/private/controls/shadow/cockpit_near_adjust", 2)
set( "sim/private/controls/shadow/cockpit_near_proxy", 1.5)
set( "sim/private/controls/shadow/csm/far_limit", 1000)

Remember, I'm using an MSI GTX 970, so what I have may give you a small or humongous performance impact. PLAY AROUND WITH THE VALUES!!! You can get shots like these then:

3.jpg1.jpg2.jpg

I hope that you found this guide useful and appreciate the effort I put into making it. Please post any corrections/queries you may have, and I'll do my best to address them. I will be certainly be making more of these in the future!

Edited by Ðŗąçø
11.30 issue investigated; now working again
  • Like 7
  • Thanks 4

Share this post


Link to post
Share on other sites
28 minutes ago, FlyAgi said:

On request I added some of the shadow stuff to my tweak utility so it can handle (and store) most of the shadow tweaks using the utility gui (submenu 'shadow control'). 

https://forum.thresholdx.net/files/file/83-flyagi-tweak-utility/

 

(I hope it's okay to post that here - there is not intention to hijack this thread)

So, it's some kind of Advanced options? because I see the FPS target and such...

I'll take a look later this week when I have some time ?

Share this post


Link to post
Share on other sites

It has many options. Originally it was a performance tuning script but the gui was to powerfull to stop there so it can handle different things now. If you don't want to use a certain feature you can just tun it of and just use those you really need. 

The main stuff it can do is:

  •  Performance tuning (just stuff that really has an fps impact and is changeable without scenery reload, except extended dsfs)
  •  Configure Bird Strikes
  •  Configure Shadows
  •  Configure Fog (and X-Visibility Haze Control if installed)
  •  Configure Controller Settings (deadzone, centerzones, sensitivity, stability)
  •  It can make Weight & Balance persistant and has some ohter aircraft related features
  •  All settings are stored per aircraft, so you can use different setups in different situations (and always the same setup using the sync function)

 

  • Like 3

Share this post


Link to post
Share on other sites

Excellent post, thanks Draco. BTW I recommend from my own experience only to increase the shadow_cam value. I've been spending extreme amounts of time getting the PBR for the new center pedestal etc right, checking it in all possible lighing scenarios. I noticed that some other tweaks tend to overbrighten the cockpit by reducing the actual shadow complexity which leads to odd lighting. I must say that with the actual shadow resolution and maybe angle, I'm absolutely happy and do not notice lighting aberrations.

  • Like 1

Share this post


Link to post
Share on other sites
On 10/15/2018 at 11:16 AM, audiobirdxp said:

Excellent post, thanks Draco. BTW I recommend from my own experience only to increase the shadow_cam value. I've been spending extreme amounts of time getting the PBR for the new center pedestal etc right, checking it in all possible lighing scenarios. I noticed that some other tweaks tend to overbrighten the cockpit by reducing the actual shadow complexity which leads to odd lighting. I must say that with the actual shadow resolution and maybe angle, I'm absolutely happy and do not notice lighting aberrations.

I noticed that too, but it does not always happen so that confuses me. I also don't fly much now as I have no spare time for it, but I had it pending. I guess you modified my script and cleaned from extra stuff, right?

Share this post


Link to post
Share on other sites

Hello

I've just tried the FlyAgi tweak utility, this is absolutely brilliant : I was always annoyed to fly during full day because of those jagged shadow that just killed the experience.That is finished...Never had this feeling to be really there before, with those perfect dynamic shadows you can really feel all the volume of the plane and also the movements... It has some hit on FPS, but it worth it!

Thanks a lot to FlyAgi for his tweak utility and to Draço for the topic!

Here are some pic of a flight with the JF C152 from ORBX shoreham to Shoreham, with True earth...

Jordan Chin asked me wich sky colors I was using for those pic, so here it is :

I was using the set 5 of sky colors from UWXP and  my preset on 
xvision :

cloud puffs alpha-smoothing : radius: 0.5

 
clouds volumizer :

volume: 1.0
Specular sunlight gain : 5
ambient sunlight gain : 1.6
diffuse sunlight gain : 0.5

cloud brightness, contrast...:
brightness: 0.0
contrast : 1.0
sat : 1.0


Sun glitter adjustment :
Brightness : 0.02
Beam width : 30 ( this tweak will make the glitters almost translucent, and xvision will tells that there is mistakes in the preset, but it works just fine, I made that because I didn't liked the effect of having a plain pure white area on the sea, felt very unrealistic to me... With this tweak, the sun reflections on the sea is very light and diffuse)


Post processing :
in global stage post-processing:
Vibrance : 0.25
Brightnesscontrastsaturation :
brightness : 0.0
Contrast : 1.1
sat : 1.0

 

JF_C152_5.jpg

JF_C152_9.jpg

JF_C152_6.jpg

Edited by Manu1985
answering to a question about the pictures
  • Like 3

Share this post


Link to post
Share on other sites

Working fine for me in 11.30r1 - I'm using the latest Tweak Utility and changing shadow settings works as expected. 

Did you possibly install the FlyWithLua Core Edition into your 11.30 installation? This seems to be the most common problem, using the core edition does not allow to change so called private datarefs so many scripts don't work. If this is the case install the FlyWithLua Next Generation Edition.

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, Ðŗąçø said:

Thanks for all your kind words. I have noticed in 11.30rc1 that the shadows seem to disappear at low angles and FOVs. Is anyone else getting this issue?

Yes, they dissapear depending on the point of view of the camera.

BTW I updated my LUA to the NG Edition...and shadows didn't changed.This pic is supposed to be 6K shadows...

image.thumb.png.4720cd6b97386a89c035931049239387.png

Edited by bokepacha

Share this post


Link to post
Share on other sites

You can still change cockpit shadow resolution but in 11.30 the quality is signifcantly lower than in 11.26 (at 4096 I know get the looks of 2048 in 11.26) so you have to set higher values for the same visual quality and possibly this affects your frame rates. 

What kind of shadows disappear? I did not set other options than raising the cockpit shadows to 4096 and this works as expected (but with worse shadows than in 11.26 at the same settings). 

Edited by FlyAgi

Share this post


Link to post
Share on other sites
1 hour ago, Lufthansa2000 said:

This is a pretty good tutorial/help, but since XP 11.30 I still get those jagged shadows 😕 

I am aware and pretty annoyed by them too. Still looking for a solution. Follow this thread to be notified when I find a solution.

Share this post


Link to post
Share on other sites
Just now, Ðŗąçø said:

I am aware and pretty annoyed by them too. Still looking for a solution. Follow this thread to be notified when I find a solution.

My only way to fix it a little bit was

set( "sim/private/controls/fbo/shadow_cam_size",  10000.0 )
set( "sim/private/controls/shadow/adhoc/extra_far",  3.0 )
set( "sim/private/controls/shadow/bias_const",  0.0 )
set( "sim/private/controls/shadow/bias_slope",  10.0 )
set( "sim/private/controls/shadow/cockpit_near_adjust", 3.0 )
set( "sim/private/controls/shadow/csm/far_limit",  1000.0 )
set( "sim/private/controls/shadow/csm_split_exterior",  4.0 )
set( "sim/private/controls/shadow/csm_split_interior",  4.0 )
set( "sim/private/controls/shadow/extra_near",  1.0 )
set( "sim/private/controls/shadow/overlap_ratio",  0.001000 )
set( "sim/private/controls/shadow/total_fade_ratio",  0.000999 )
set("sim/private/controls/skyc/max_shadow_angle",-89)
set("sim/private/controls/skyc/min_shadow_angle",-90)

 

Share this post


Link to post
Share on other sites
1 minute ago, Lufthansa2000 said:

My only way to fix it a little bit was

set( "sim/private/controls/fbo/shadow_cam_size",  10000.0 )
set( "sim/private/controls/shadow/adhoc/extra_far",  3.0 )
set( "sim/private/controls/shadow/bias_const",  0.0 )
set( "sim/private/controls/shadow/bias_slope",  10.0 )
set( "sim/private/controls/shadow/cockpit_near_adjust", 3.0 )
set( "sim/private/controls/shadow/csm/far_limit",  1000.0 )
set( "sim/private/controls/shadow/csm_split_exterior",  4.0 )
set( "sim/private/controls/shadow/csm_split_interior",  4.0 )
set( "sim/private/controls/shadow/extra_near",  1.0 )
set( "sim/private/controls/shadow/overlap_ratio",  0.001000 )
set( "sim/private/controls/shadow/total_fade_ratio",  0.000999 )
set("sim/private/controls/skyc/max_shadow_angle",-89)
set("sim/private/controls/skyc/min_shadow_angle",-90)

 

Some interesting datarefs I've yet to come across there. I'll add this to my to-do list to try and find a fix, which I'll begin to work through this Friday.

Share this post


Link to post
Share on other sites

OK so I just took at these horrible low-angled shadows and csm_split_exterior 4 seems to fix it totally. Maybe I just never had FWL installed...

I am still using the same shadow settings as I outlined in the original post BTW. So if you try just that one line with no other scripts installed, it will hopefully make things better.

If anyone has any issues, feel free to post below.

Edited by Ðŗąçø

Share this post


Link to post
Share on other sites
On 1/25/2019 at 7:22 PM, Ðŗąçø said:

csm_split_exterior 4

With this you mean the low angled shadows are not dented? If so, it did nothing in mine, but I need to see if in my full script something else is interfering.

In 11.30 it's strange. Sometimes you get really nice shadows in the cockpit, sometimes you get dented ones.

Share this post


Link to post
Share on other sites
1 minute ago, bokepacha said:

With this you mean the low angled shadows are not dented? If so, it did nothing in mine, but I need to see if in my full script something else is interfering.

In 11.30 it's strange. Sometimes you get really nice shadows in the cockpit, sometimes you get dented ones.

One other thing I forgot to point out, using my settings without csm_split_exterior also seemed to fix it... Very strange indeed.

Share this post


Link to post
Share on other sites

I've been sitting at my computer for about 3 hours trying to get this to work. It changed my shadows so they are even more pixelated than they were before. Can anyone just post the code so i can copy it?

 

Edited by Mark_Deloop

Share this post


Link to post
Share on other sites
22 hours ago, Mark_Deloop said:

I've been sitting at my computer for about 3 hours trying to get this to work. It changed my shadows so they are even more pixelated than they were before. Can anyone just post the code so i can copy it?

 

The second snippet of code in the original post should work. Here it is again for reference:

set( "sim/private/controls/shadow/csm_split_exterior", 4)
set( "sim/private/controls/shadow/csm_split_interior", 4)
set( "sim/private/controls/fbo/shadow_cam_size", 6144)
set( "sim/private/controls/shadow/cockpit_near_adjust", 2)
set( "sim/private/controls/shadow/cockpit_near_proxy", 1.5)
set( "sim/private/controls/shadow/csm/far_limit", 1000)

If that makes it bad, then it is likely you have other scripts interfering.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.



  • Current Donation Goals

  • Threshold News

  • Threshold articles

  • Threshold clubs

  • Top Downloads

    1. By Captain Kitten
         843   80
    2. By Captain Kitten
         840   12
    3. By MaxNGX
         100   1
    1. By Captain Kitten
         4,186   80
    2. By Captain Kitten
         4,150   12
    3. By Xephyr
         244   5
    1. By Captain Kitten
         44,512   80
    2. By Captain Kitten
         22,359   12
    3. By Xephyr
         2,505   5
    1. By Captain Kitten
         44,512   80
    2. By Captain Kitten
         25,049   12
×
×
  • Create New...

Important Information

Please read the Terms of Use