1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Shadows from underlying scenery objects

Discussion in 'Airport Design General' started by Here for the Beer, 11/3/07.

  1. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Dear everybody - I've lurked here often and now I finally surface with a question (doesn't everybody?).

    I am making a small addon to an existing scenery for my own amusement, I just wanted a couple of changes to bring this old scenery up-to-date without changing the original itself. I don't have the sources for it because it is someone else's scenery. This is in FS9.

    Anyhow, it involves making new apron areas which I've done successfully enough, layering the macadam, the surface markings etc in EOD and FSSC. The apron areas I've laid with the shadows option switched off. These apron areas also involved the removal of some buildings in the main scenery which I did by setting my addon at a higher scenery layer

    I finally started testing the new apron areas at dawn and dusk in the sim and I've noticed that objects in the original scenery (lighting poles and the control tower, for instance) won't cast shadows across my addon, presumably because it sits at a higher layer (?). Is there a tried and tested way to get a lower scenery to work with one of a higher priority, or do I have to put some elements of my scenery (the apron areas) with this other scenery, and setting my textures to get priority over the original scenery's ones. If they're at the same layer as the original scenery's BGLs, I'm assuming that the control tower etc will then cast shadows across them.

    Am I thinking along the right lines or is this idea a non-starter?
    Last edited: 11/3/07
  2. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,515
    Country:
    netherlands
    Hi,

    I am not sure if I understood every correct, but did you make your aprons as API macros? In that case they will have to wrong code and that causes the missing shadows. The code used in API macros is optimized for 3D objects and for ground objects you need slightly different code.

    What you can do best is change the PerspectiveCall command in the API with a LayerCall command. Behind the label in the LayerCall command, you also need to enter a layer number. If there is a ShadowCall command in the API aswell, you can remove that.
  3. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Well, I'm using EOD to place ground textures including the aprons. In the texturing dialog box there's an option to specify what kind of textures they are, eg building, effects, sky and ground. Some I've set inadvertently to building textures (!) but the large flat areas are ground. I assume that EODs options in this little drop down box (at the lower right of the texturing dialog) are what activates the different sorts of code? Having said that, the shadows still don't appear there, so I may be missing something else.

    I've also noticed that from some angles the aircraft I'm using to pan around the scenery in slew mode does not cast shadows when it is standing on the ground (Posky 737-800W). It seems, as you said, that the sim is treating the objects as buildings and not rendering shadows on them.

    I'd originally thought it might be because my addon is at a higher scenery layer and the lower scenery's objects can't interact with mine, but the simulator presumably sees all the objects together after it has finished assembling the airport from the two different layers. After that, it has to be the way I've coded my objects. Thanks for pointing this out to me, Arno.
  4. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,515
    Country:
    netherlands
    I haven't used EOD for years, but I don't think that is the case. Those names are the texture types you can have without the LoadBitmap command, but it has nothing to do with the code used to draw the polygons. Have a look in your API macro to see which code is used (or else post it here and I'll have a quick look).
  5. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Hi Arno, thanks for the info.

    I can see the details you mean in the API source and they look easy enough to change. However, I create API and SCM files from EOD but don't use the API files at the next stage. I assemble the scenery using FSSC and place the SCM macros using that program. These SCM look much harder to change, with PerspectiveCall leading to a label with just Perspective as the command after which the code seems to fall though to the next lines, as with normal software program code.

    I have to admit I don't want to get too far into this as I'm probably not going to work on any other sceneries after this (I'm too short on time). If there's no easy edit for the SCM I'd probably have to hand-edit the API macros, lay out the scenery with another program and then just leave it there. The ground polys are also in two separate macros - one for the underlying textures, taxiway markings, stop bars, no-parking areas etc, and the other with a semi-transparent set of tiles that give the apron its overall texture/roughness look.

    The lack of shadows is almost certainly related to this ...

    [​IMG]Ryanair 737
    with vanished wheels and lower nacelles. It is partway onto the new area (to the right of the image). If it was one wingspan to the left it would be on the older airport and look fine. My ground textures are all at ground level, they still show through the lower part of the plane! I imagine that this is what the perspective operators are designed to prevent.

    I may need to place the APIs using some other program, perhaps SceneGenX or something since I also need to place a couple of library Gmax lighting poles anyway, but it would be nice not to go back through all the painful alignment I've done so far (and from the image you can see I've a bit more to do on that!).

    I had been wondering whether I was just putting some ground scenery objects on too high a layer (I use as high as 11).
    Last edited: 16/3/07
  6. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,515
    Country:
    netherlands
    Hi,

    Editing a SCM or an API should be about the same, there are only minor differences in the code. So the same kind of tweaks could be applied.

    Also, FSSC is capable of placing API macros as well. I thought SCM was only used for ASD :D.
  7. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Hey, what would I know? :D I'm not a scenery designer, I just make sceneries now and then!

    I was thinking this morning that I might end up editing the final BGLs using a Hex Editor instead rather than destroy my nice, established workflow, but I'll give this API/FSSC thing a shot. Good grief, I'm talking in TLA's already! :p

    EDIT: I've experimented with using the APIs created by EOD rather than the SCMs, and editing the sources to use LayerCall rather than any Perspective... commands. Yep, I get shadows on my scenery at last, and the aircraft is no longer sliced through with the lower parts becoming invisible! Thanks!

    It brings me another problem though, now there are blank areas running across my apron markings . taxiway lines vanish at particular places and reappear further along. I've discovered that it happens at places where an underlying (and now invisible) taxiway is running beneath my textures. It's strange that just the markings do this - my apron textures are there as is my semi-transparent overlay texture that makes them look like tarmac. Just the yellow lines, no-parking area markings and so on. Looks like underlying taxiways are on some different priority again. Raising the LayerCall parameter #2 to high values makes no difference. I went up to 80.


    Actually, I have one other question - if I tweak an API to use Layercall, and that single API contained multiple surface objects (apron and markings as I described above) with different drawing priorities, are those priorities still honoured within that API file - one layer with an object drawing hierarchy within it?
    Last edited: 17/3/07
  8. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Okay - I seem to have replaced one problem with another.

    I dropped the use of perspectivecall and my shadows returned, and aprons and their markings were always under the aircraft. I can see that the perspective was making those textures want to appear in front of the plane.

    The problem I now have is that elements of the underlying scenery (Simwings' Marseille, I'm trying to add the MP2 terminal) are showing through my ground textures and some of my surface markings are gone while others are still okay. I think this is due to the influence of the underlying scenery - for example some of the semi-transparent textures that Simwings use to add definition to the surfaces are overlaid on my aprons - slab patterns appear where there is now smoothed concrete or asphalt but no slabs.

    Since I fly from within the cockpit (I seldom ever watch my plane from outside) using perspectivecall is not such a great problem for me, but after this work I'd like to share the MP2 somewhere and other people won't like the texture problem. I've been through the relevant parts of the wiki, but I don't often have enough knowledge of the basics that the wiki requires from me.

    So, using perspectivecall gives me absolute control, but problems. Using layercall (even extreme values) is more subtle but the underlying scenery is showing through and sometimes taking away markings etc.
  9. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,515
    Country:
    netherlands
    Hi,

    The LayerCall command has a layer number as the second parameter. With that layer number you can define the order of your polygons. So you could try to increase the number a bit, that should make them appear on top of the other scenery. Of course this will take some trial and error, as you don't know the exact layers used in that other scenery.
  10. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    I tried bumping the value right up (to 2000!). I guess that even 200 is probably out of range and gets ignored, because things just looked worse.

    Is there the possibility that the underlying scenery is using maximum layer values and even though my addon is at a higher level in the scenery.cfg they are still interfering?

    The SCASM documentation shows

    4 Mesh, seed, ground
    8 ground polygon/texture overlays
    12 river
    16 road
    20 lines, strobes
    24 runways, taxiways
    28 mountain
    32 crater
    60 shadows

    and I'm using 50+ to get the best effect.

    I've noticed one other thing. I use a base to draw all objects, and in some cases where there's a long line (using the "base" type of object) running across a large square base, the line will vanish at some point along its length - half is visible, half is not. I moved the large base to one side and recompiled. Now the whole line shows up, but obviously having moved the base away, the scenery below also shows through. My tarmac object is at Zbias 2 and the line across it is at Zbias 7 so in theory the line's entire length should draw over the tarmac, which in turn should draw over the Simwings scenery beneath. More strange still, some lines draw visibly and others seem to lie beneath the tarmac, so entire lines can vanish, or a single line can vanish halfway along.

    I'm now going slightly mad.

    [​IMG]
    links to an annotated picture.
    Last edited: 19/3/07
  11. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    20,515
    Country:
    netherlands
    Hi,

    For ground polygons the zbias option is normally not used, as they can be layered with the LayerCall command. ZBias is used to give priority to polygons on 3D objects (for example a logo on a buidling).

    It is hard to tell which layers the other scenery uses, but in general you should be able to stay below 60. For most sceneries I expect values below 30 should already by enough to show on top of them.
  12. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    Hi Arno - thanks for your quick reply!

    I use EOD to composite several flat objects and use ZBias to paint the objects in the required order, so one EOD object can actually be several flat objects layered internally. I then just place one object per apron area. FSSC simply places a set of large tiles that I designed in EOD.

    I was coming back to add an interesting (well, to me) note that I just duplicated one of the large lines that don't draw properly, and created shorter lines. I then put these beside the larger line (alongside the bit that doesn't draw properly) and the shorter lines drew okay. It is as though the longer lines cannot draw properly but below a certain length they'll work okay.

    It will be a bit of a struggle but I might be able to finish my project this way.

    ... okay, you can be sure I'll ask if there's another problem. :) Hopefully I can use this work-around. If I do okay I might not need to call back in the near future, so I'll say right now that I'm very grateful for all your assistance.
  13. Here for the Beer

    Here for the Beer

    Joined:
    11/3/07
    Messages:
    344
    Country:
    unitedkingdom
    I fixed the problem. I'd originally composited everything into a single apron using EOD and then placed it and a semi-transparent apron texture overlay in FSS, one on top of the other.

    What I did was make 2 copies of the composited apron and on one I removed all the markings while on the other I removed all the ground textures. I then placed a third layer in FSSC (completely matched co-ordinates so one overlaid the other) and set the LayerCall second parameter so that tarmac was overlaid by markings, which in turn was overlaid by the semi-transparent layer. Now they all behave and I can move on to finish the scenery without the need to lay out all the markings a second time - something I was dreading.

    Success!

Share This Page