|
|
Line 1,516: |
Line 1,516: |
| See [[Autopilot configuration reference | Input and reference properties or values <input> and <reference>]]. | | See [[Autopilot configuration reference | Input and reference properties or values <input> and <reference>]]. |
|
| |
|
|
| |
| === General comments from forum discussion ===
| |
|
| |
| {{FGCquote
| |
| |A few aircraft have a fake shadow, in essence a flat silhouette of the aircraft floating maybe a feet above ground. The silhouette get there using a few properties, possibly driving some calculations and basically the same kind of animations as is used to for example animate the control surfaces. I do not remember having seen a list with aircraft using a fake shadow, but I think that for example Helijah's Diamond twin has one. The big drawback with a fake shadow is that it has to float to not get broken through by even the slightest undulations in the ground, while still will not work as soon as there is a slope.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859#p227134
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Johan G</nowiki>
| |
| |date=<nowiki>Mon Dec 15</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |As the tree shadow code has shown, it's near-trivial to do the projective geometry not by an animation but in the vertex shader, i.e. fake shadows can be placed where the sun casts them, stretched by the projection, depth adjusted to weather condition and if the current terrain normal is passed, they can even be put co-planar with the local triangle, i.e. they'd project correctly even on sloped runways and terrain.
| |
|
| |
| At a computational cost of almost zero, because you just process the four vertices of the shadow quad, and four is a number which isn't even a warm-up exercise for a GPU used to crunch millions of vertices. But of course, it wouldn't be a real shadow, in particular it wouldn't project correctly onto trees and buildings as a stencil buffer or shadow map solution would.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859#p227202
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Thorsten</nowiki>
| |
| |date=<nowiki>Mon Dec 15</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |Having said that, it is fairly simple to do. Here's an implementation for the EC-130 which comes with an animation based fake shadow out of the box, switching the shadow projection to a GLSL shader:
| |
| The animation just puts the shadow onto the ground. The GLSL code can do some projection of the shadow, i.e. it magnifies a bit for low sun and changes position:
| |
| The shader can do a full light calculation of the surrounding scene, so the depth of the shadow can be varied according to the ambient to diffuse light balance:
| |
| Also, once the aircraft is in the air, it projects the shadow along the light ray rather than underneath the aircraft:
| |
| And of course, all that means shadow depth adjusts to weather conditions - no shadows in overcast skies:
| |
| Implementation (using current git) - make the quads displaying the fake shadow inherit from Effects/shadow.eff, don't translate the shadow (the shader expects it to be correctly positioned for the sun in the zenith for an aircraft standing on the runway), don't try to correct for low sun or to adjust shadow texture transparency, the shader just uses the texture alpha channel.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859#p227285
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Thorsten</nowiki>
| |
| |date=<nowiki>Tue Dec 16</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |
| |
| Where should I put this? Into one of the *.eff files of any aircraft?
| |
| -you need the shadow itself as a model (a textured quad). In ac3d (blender,...) that has an object name - in my example shadow_fuselage. You can give it any you want.
| |
|
| |
| -in the aircraft-set.xml (or files included there), animations, effects, sounds,... are declared and models included. In the scope where your shadow quad is included, you declare shadow.eff as your effect. What wlbragg has has done (inheriting a copy of the shadow effect under the aircraft effect directory) is probably more by the book, but not strictly necessary unless you want to pass parameters to the effect.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859#p230005
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Thorsten</nowiki>
| |
| |date=<nowiki>Sat Jan 17</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |It works with anything that sets a property how far the gear is off the ground - it works with your home-made Nasal FDM if you like...|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859&start=30#p232080
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Thorsten</nowiki>
| |
| |date=<nowiki>Sat Feb 14</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |
| |
| wlbragg wrote in Sat Feb 14, 2015 1:14 am:
| |
| After looking at how slow altitude-agl-ft update is, I don't think it would work very well anyway.
| |
| I'll try the "property rule".
| |
| But now I am curious why I couldn't get altitude-agl-ft to work at all?
| |
|
| |
| If altitude-agl-ft seems to update slowly in the property browser it might be a tied property that can't be listened to so instead it is polled at a lower rate - but the property will actually be updated for each frame or FDM iteration.
| |
| This might also explain why you have problems getting its value into the effect - the effect system might also rely on listeners to get updates (I don't know).|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859&p=232163#p232091
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>AndersG</nowiki>
| |
| |date=<nowiki>Sat Feb 14</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |Yes - you can't pass tied properties to effects. Learned that one the hard way (took me a while to figure out...) That's probably the problem here as well. Okay, then we need an aircraft-side property rule in any case.
| |
|
| |
| It doesn't need to be AP (they're updated at FDM rate), we only need it at framerate. I vaguely remember there was a catch that you had to give an index to airplane-side property rules to avoid overriding the system-wide which do e.g. weather - there's documentation on the wiki somewhere, I think in the AP howto.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859&p=232163#p232093
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>Thorsten</nowiki>
| |
| |date=<nowiki>Sat Feb 14</nowiki>
| |
| }}
| |
| }}
| |
|
| |
| {{FGCquote
| |
| |After setting up two separate aircraft with the simplified shadow effect, here is what I found to work best.
| |
| Simply put I used a property rule for for both YSim and JSBSim aircraft and override gear-agl-m with a filter passing altitude-agl-ft to gear-agl-m in both aircraft.
| |
| The reason for this is to accommodate all the shadow AGL adjustment needed for both ASL-shadows and non-ALS-shadows.
| |
|
| |
| My Cub has two configurations for tire size and thus two different altitude-agl-ft starting points. The c172p also has its own altitude-agl-ft starting point. I guess they would be dependent upon where and how the model designer created the center point of the aircraft.
| |
| To accommodate this variability you need to do an offset in the shadow.xml to place the shadow's AGL where you want it. But when using ALS-shadow method it has a tendency to put it where it thinks it needs to go based on the hard code. So you use the offset to position the initial shadow. Then you use the property rule configuration to position the shadow when ALS method takes control of the shadow's AGL.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=47&t=24859&start=30#p232163
| |
| |title=<nowiki>Re: 2D shadow on ground?</nowiki>
| |
| |author=<nowiki>wlbragg</nowiki>
| |
| |date=<nowiki>Sun Feb 15</nowiki>
| |
| }}
| |
| }}
| |
|
| |
|
| == ALS 3d shadow volume effect == | | == ALS 3d shadow volume effect == |