• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX Volume shadow - how to?

Messages
820
Country
ca-ontario
I've scoured this forum and on-line in general but I didn't get any info on this... I've been designing FS9 and FSX models for quite a while now (I'm not a novice) using 3DS MAX and the SDK, but one thing I can't get to work is a correct volume shadow (shadow that object casts on itself). I get the shadow going, but it is projected wrong, as if it gets projected on normal-inverted surfaces. The shadows are moving when I rotate camera around the object - and they shouldn't, obviously, since the light source is not moving.

I first thought it was my (outdated) hardware, but default aircraft display volume shadows correctly. So, the hardware is behaving properly.

Then, I started experimenting with very simple, manifold (no open edges) shapes, with simple materials - and I get the wrong results (so, it is not the complexity of my geometry). I applied a very simple materials (base colors, no textures) and, of course, "volume shadow" tickmark in the "Enhanced Parameters" section. I am still getting wrong volume shadow projections on my objects.

Is there a "trick" that I am missing in this? Has anyone been successful in designing geometry with correct volume shadows? (correct projections). I can attach a screenshot if necessary to illustrate.

Thanks for any info!
 
Messages
7,450
Country
us-illinois
Hi Misho:

I did a quick search on Google and posted this, just in case you might not have seen this thread:

http://www.fsdeveloper.com/forum/threads/volumetric-shadows-and-ground-flickering.426529/


...and this thread:

http://www.fsdeveloper.com/forum/threads/high-altitude-object-placement-solution.438268/#post-753879


...or these:

https://www.google.com/search?sclient=psy-ab&site=&source=hp&q=fsx+volume+shadows&oq=FSX+volume+shadow&gs_l=hp.9..0i22i30k1.7211.13195.0.16870.17.15.0.2.2.0.279.1158.7j1j2.10.0.foo,bruas=1,brua=1,brapml=1...0...1c.1.64.psy-ab..5.12.1092...0j0i131k1.V0O19007HWY&pbx=1&btnI=1


FYI
: Legacy FS 3D objects coded in SCASM / ASM had an actual "Shadow Object" which apparently was a manifold lower resolution version of the visible model included inside the code group for the 3D object almost like a LOD (not certain how to describe this better at the moment), and IIRC it allowed proper casting of a shadow which was projected onto the ground like the shadow from the user aircraft.

BTW: Ground polygons (as a type of "flat" 3D object) coded in SCASM / ASM or as FS9 / FSX / P3D MDLs may or may not display projected shadows relative to the sun direction (ex: from the user aircraft) depending upon whether they have a proper 3D coordinate "winding direction" (sometimes referred to in the context of such "ground" objects as a clockwise (NW-NE-SE-SW) versus counter-clockwise (NW-SW-SE-NE) Geographic 'winding' sequence.

[EDITED]

I'm curious as to whether other 3D objects may also have shadow display issues (regardless of Altitude AGL) ...based on their vertex 3D coordinate sequence or UVW coordinate 'winding' order ? :scratchch

[END_EDIT]


PS: To refresh my memory about threads we both participated in on this and other topics:

https://www.google.com/#q=site:www.fsdeveloper.com+GaryGB+misho


Hope this might help ! :)

GaryGB
 
Last edited:
Messages
820
Country
ca-ontario
Hi GaryGB, thanks for posting those. I actually came across them when I was researching the problem. Some deal with ground shadow, which is not what was giving me the headache - it was volume shadow (self shadowing of the aircraft)

After a few tests, I concluded that this incorrect behaviour was due to the extreme (orbital) altitudes I am at. Shadow on my object was just fine if I "grounded" it.
 
Messages
7,450
Country
us-illinois
Hi again, Misho:

Have you seen any change in the 3D object shadow display anomaly that might be related to enabling / disabling of "Draw Call Batching" as cited in some of the above linked threads ? :scratchch


AFAIK, both 3D scenery object MDLs and aircraft interior / exterior MDLs may have some inherent commonalities, so IMHO, one might wonder if they do not share some comparable display anomalies as a function of Altitude AGL ? :idea:


http://www.fsdeveloper.com/forum/threads/shadow-problem-in-ade.430952/

http://www.fsdeveloper.com/forum/threads/my-curse-with-the-shadows-offset.425419/




Ground Polygons, although "flat", are inherently still 3D objects whether coded as a MDL or via legacy SCASM / ASM., thus it seems plausible there may be some relationship with 'projected' shadows from separate objects.



Are you only addressing "self-shadowing" of user pilot-able aircraft MDLs in this particular thread ?


If so, I'm thinking of this thread: ;)

http://www.fsdeveloper.com/forum/threads/shadows-on-all-objects.437700/



Also of potential interest is the info from FSX SDK docs here:

https://msdn.microsoft.com/en-us/library/cc526976.aspx


...And P3D SDK docs here:

http://www.prepar3d.com/SDK/Environment Kit/Modeling SDK/Using Modeling Tools.html#The File Properties Rollout


"
The File Properties rollout:
  1. GUID: This is where the file's GUID is displayed. The GUID is stored in the Custom section of the File Properties as a string.
  2. Create: Pressing this button will create a new GUID for the file. If a GUID is already specified, then the tool will prompt with the following dialog:

  3. Friendly Name: This is where the file's Friendly Name is displayed. The Friendly Name is stored in the Custom section of the File Properties as a string.
  4. Edit: Pressing this button will enable the Friendly Name text box. On enter, the Friendly Name will be changed. If a Friendly Name is already specified, then the tool will prompt with the following dialog:

  5. Get GUID from .x file: If there is a .x file in the same folder, with the same name as the currently opened file, then pressing this button will cause the tool to automatically pull the GUID and Friendly Name from that .x file.
  6. Choose .x file to get GUID? Checking this check box will allow the user to select which .x file to get the GUID and Friendly name from when the Get GUID from .x file: button is pressed.
  7. Model has shadow map? Checking this check box will cause the object to use the shadow map self-shadowing method. Currently this only works in Virtual Cockpits.

The Model verification tools rollout:
  1. Verify Scale: If this is checked, all objects will be tested to make sure their scale is [1,1,1] or 100%.
  2. Verify GUID and Friendly: If this is checked, the file will be tested for a GUID and Friendly name. Additionally, the .x file will be checked to make sure the .Max and .x file GUID and Friendly name match.
  3. Verify Colocated verts: If this is checked, each object will be tested to make sure it doesn't have multiple vertices in the same location. This can take several minutes for high polygon count objects (>2000).
  4. Verify Duplicate Parts: If this is checked, the model will be tested for objects that have duplicate part names.
  5. Verify Aces Materials: If this is checked, the model will be tested for correct materials.
  6. Verify LODs: If this is checked the model's LODs will be tested to make sure the LOD names match the filename and also verify that the hierarchy is correct. It will also test the polygon counts to make sure they are reasonable.
  7. Verify Open Edges: If this is checked, the model will be tested for open edges.
  8. Verify Volume Shadow: If this is checked, the model will be tested for edges that are used in more than two faces. This can potentially cause problems for the volume shadow. This can take several minutes for high polygon count objects (>2000).
  9. Verify texture verts: If this is checked, the model will be tested to make sure the texture verts are within a reasonable range (+-10.00).
  10. Verify Root node: If this is checked, the model will be tested for multiple root nodes.
  11. Verify!: Pressing this button will initiate the verify function. If the model is perfect, it will return a dialog like this:"

...and these search results:

https://www.google.com/#q=FSX+"self-shadowing"+of+aircraft+MDLs


Hope this might help a bit more ! :)

GaryGB
 
Last edited:
Messages
820
Country
ca-ontario
Ok - lots to digest here but, before we get ahead of ourselves:

I DO HAVE volume shadows working. I created a very simple object (check out my other post on the same topic in Aircraft Design/modelling) and determined that the volume shadows work properly when on GROUnD LEVEL. However, in orbit, everything breaks down. So - my methodology is right, but there is a bug in the FSX code that makes volume shadows stop working at orbital altitudes. there is nothing I can do about that except ask Dovetail people to consider fixing this issue (along with wandering .fx issue that seems to be happening for the same reason - high altitude)
 
Messages
7,450
Country
us-illinois
Thanks for that description, Misho.

Sorry to belabor the subject, but I'm trying to better understand and clarify the actual methods you used to achieve "Volume Shadows" versus "Self-Shadowing" in the user aircraft as you described in your OP above using both terms, as AFAIK, these are distinctly separate work-flows ...according to this thread started by FSInsider Owen Hewitt:

http://www.fsdeveloper.com/forum/threads/self-shadowing-on-fsx-aircraft-the-secret-is-revealed.2942/


"Well, I couldn't resist not knowing anymore about self-shadows on aircraft, and I wrote to Adrian Woods (aka ACES' "Torgo 3000") for the answer. Here is what he wrote:

"If you’re working with aircraft, we are using a different method of self-shadowing (shadow mapping) that doesn’t require manifold objects. It’s not quite as high fidelity as the volume shadows, but it works for aircraft and doesn’t require the thousands of extra polygons that are needed to manifold the geometry. I’m not sure how you toggle between the two. I’ll have to check on that."

I remember having a conversation with Peter Zahn, also an ACES developer, about this several months back. He was hoping for shadow mapping to become a reality, as he was having a lot of trouble getting good results with manifold volume shadowing on complex aircraft such as the Goose.
"


...and later in that thread:

"ACES artists had originally wanted all aircraft objects to require volumetric shadowing, or essentially what you've described above as (stencil) shadows, but they found that very complex objects were not being rendered properly, so the development team incorporated shadow maps to allow the artists some relaxation with regard to polygon counts. Some default aircraft do use volumetric though - the C172 I believe exhibits this.

So, you do not have to have closed objects to have shadows. I do not believe we will see self-shadows in the VC due to it being a huge performance hit.
"


One might wonder whether, in addition to being separate work-flows, "Volume Shadows" versus "Self-Shadowing" in the user aircraft are also mutually-exclusive, meaning one must use either "Volume Shadows" OR "Self-Shadowing" ...but NOT both ? :scratchch


Thanks in advance for any further clarification you may share with us as to how precisely you have implemented "Volume Shadows" versus "Self-Shadowing" in the user aircraft which you described as a "correct volume shadow (shadow that object casts on itself)" in the OP above. :)


Perhaps the FS Developer Community might gain some additional insights as to how one may utilize the FS SDK options for such 3D MDL display attributes as cited in: :idea:

https://msdn.microsoft.com/en-us/library/cc526973.aspx



FYI
: This thread cites the requirements for VC Shadows:

http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1211131092


...and also mentions a Blog article by ACES team member Sebastien St-Laurent (aka "Sebby"):

https://blogs.msdn.microsoft.com/sebby1234/2007/10/08/fsx-dx10-self-shadowing-vcs/

https://blogs.msdn.microsoft.com/se...x-dx10-self-shadowing-vcs-dx9-vs-dx10-update/


...and Fr. Bill Leaming's FSDeveloper wiki on the subject of Manifold objects required for implementing same:

http://www.fsdeveloper.com/wiki/index.php?title=Manifold_geometry



ACES' Phil Taylor posted in his Blog regarding differences in how Shadow Mapping is implemented (and IIUC, how it may be modified as to display attributes independent of MDL material settings):

https://blogs.msdn.microsoft.com/ptaylor/2008/06/23/yaft/


[EDITED]

Some related links on Shadow Mapping:

https://en.wikipedia.org/wiki/Shadow_mapping

https://en.wikipedia.org/wiki/Orthographic_projection

https://en.wikipedia.org/wiki/Orthographic_projection_in_cartography

Comparison_azimuthal_projections.svg




...also:

https://msdn.microsoft.com/en-us/library/bb975671(v=xnagamestudio.31).aspx

https://msdn.microsoft.com/en-us/library/bb976072(v=xnagamestudio.31).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx

http://learnopengl.com/#!Advanced-Lighting/Shadows/Shadow-Mapping

ftp://download.nvidia.com/developer/presentations/2004/GPU_Jackpot/Shadow_Mapping.pdf


http://roar11.com/2015/05/dealing-with-shadow-map-artifacts/


http://www.stevestreeting.com/2009/01/04/depth-shadow-mapping-dx9-depth-range-gotchas/

"So Why Doesn’t It Work?


That’s a bit of a generalization, but in many cases people will find this just doesn’t work as they’d expect - either no shadows, or large blocks of shadow where there should be none. There are several reasons why this can be the case, but the most common problem I’ve seen is to do with DirectX 9 and the clear colour of the shadow texture view-port.


You see, the problem is that DirectX 9 can only clear a view-port to a 32-bit number. When clearing a floating-point surface, it has to map this simple integer range onto a floating point range, and it effectively does it by dividing each channel clear colour by 255. This means it can’t clear floating point textures to any number higher than 1.0! When clearing the frame buffer for a shadow texture that stores depths, you need to initialize it to the highest depth value possible so that rendered objects will update it to be ‘closer’. If you’re storing raw unscaled depth, that value needs to be the light’s attenuation range or some other far scene distance. You simply can’t do that in Dx9, so what you find is that your texture contains all 1.0’s in initialized areas. You might think this isn’t so bad, since provided at least one thing is rendered at any particular point, the floating point buffer will be right. That’s true, except that if you have any single-sided geometry (terrain or a ground plane), and you use the default ‘render back faces to shadow texture’ option (highly recommended to make biasing much simpler), you can have significant problems.


Note that the 1.0 clear limit does not exist on GL or Dx10 - on those render systems you can set any floating point values in your Ogre::Colour as the clear colour and they will be respected.


So, how to deal with the 1.0 clear limit in Dx9, and write your shadowing system in a portable way? There are a number of approaches...
"


...See also the links in this post (with regard to depth bias):

http://www.fsdeveloper.com/forum/threads/gpw-error-when-adding-specular.437920/#post-750482

[END_EDIT]



BTW: 'Some' of the above FS web site links suggest that one must use "FSX Materials" to implement "Volume Shadows" versus "Self-Shadowing"; yet curiously, the tutorial linked below cites these terms ...in the context of working with FS9 3D objects: :confused:

http://windowlight.co.nz/store/index.php?main_page=page&id=24&chapter=1



My goal here is to see if there is an end-user work-around for the 'offset at high Altitude AGL' that might be currently utilized pending any possible "fix" of purported bugs by DTG in FSX_SE or their FS-derived "FSvNext".


Perhaps if one knows the 3D geometry and material mapping / display Altitude-related behavior relative to the FS "Quad Matrix Grid", one may be able to compute corrections for UVW mapping and/or "shadow mapping" during 3D modeling, or via an external FS utility (ex: MCX). :pushpin:


Who knows, maybe we can find a fix for MDL AttachPoint Effect / other attached object 'offset at high Altitude AGL' too !



Incidentally, here's an interesting option to 'force' use of shadow mapping with user aircraft interior versus exterior MDLs by the use of an undocumented parameter value in FSX.Cfg:

https://stevesfsxanalysis.wordpress.com/2014/10/23/new-fsx-setting-forcevcshadowmap/


All bets are off, though, as to how this may display with the P3D "work-in-progress" code base: o_O

http://www.prepar3d.com/forum/viewtopic.php?t=14165


GaryGB
 
Last edited:
Top