Search the Community
Showing results for tags 'shadows'.
Found 1 result
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. 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): (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: (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: 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: 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: 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!