Prepar3D v4 visibility conditions for scenery?

This evening I have been testing Prepar3D v4 a bit more and I have especially looked at using visibility conditions in scenery MDL files. Before these were not supported at all for MDL files placed through BGL. We had to use SimObject for them, as tools like SODE do.

But with Prepar3D v4 things have changed a bit here, and I have been testing what that could mean. So what I did is add a simple visibility condition to part of an object. This the test code I used:

<PartInfo> 
  <Name>vis_december</Name>
  <Visibility>
    <Parameter>
      <Code>
      (E:ZULU MONTH OF YEAR, number) 12 == if{ 1 } els{ 0 }
      </Code>
    </Parameter>
  </Visibility>
</PartInfo>

It is just a simple condition to show the scenegraph node only when it is the 12th month of the year. And the good news is that these kind of conditions now work. So you can have part of your MDL only show at a certain time of the year. This can be very useful if you want to show snow only in the winter or so. As a proof here are two picture, one taken in September and the other in December.

  

At the moment I could only use the variables from the environment section, which would limit the kind of visibility conditions only to time related settings (day, month, year, etc). I tried to test with some other variables, but didn’t have success with that yet. So it might be that interesting variables like the weather are still not support for scenery (or I just did something wrong).

13 thoughts on “Prepar3D v4 visibility conditions for scenery?

  1. Steffen says:

    Arno, where do you enter the CODE exactly?

    • arno says:

      The code goes into the modeldef.xml file. And from MCX or your modelling tool you can then reference the visibility condition.

  2. Ken says:

    Hello Arno,

    This works fine when I set the visibility condition in 3DSMax and place an object (e.g. a box) using MCX. However, when I try with a ground poly using the ground poly wizard it does not work.

    Do you know if the visibility condition works with the ground poly wizard?

    Thank you.

    Ken

    • arno says:

      Hi Ken,

      How are you adding the visibility condition? If you add it to the object before the wizard slices the polygons I think it will be lost. So you might have to create the BGL file first and then import it again to set the conditions right.

      Arno

      • Ken says:

        Thanks for the rapid reply Arno and for your wonderful tools.

        I add the visibility condition in 3DSmax; however, I have the slice option unchecked in the GP wizard because all GPs are small.

        Might it be lost at another step in the wizard?

        Thanks

        Ken

  3. Ken says:

    An update:

    Yes, adding the visibility condition after the GP wizard rather than before (in 3DSMax) works fine.

    Thanks for the tip.

    Ken

  4. Gary Burns says:

    Hi Arno
    How would the above xml code be written for visibility for December AND February so that January could be left out for “Hard Winter”

    Thanks

    Gary

    • arno says:

      To be honest, I’m not sure. I’m not so good at the modeldef.xml code yet either. If you ask in the fsdeveloper forum I’m sure some aircraft developer can tell you.

      • Gary Burns says:

        Thanks Arno

        I think I’ve figured it out. I’m not very good at XML either, but the below appears to work for me.
        I’ll share it for others.
        I used your code above for January (Hard Winter) as below:

        Month_January


        (E:ZULU MONTH OF YEAR, number) 1.0 == if{ 1 } els{ 0 }

        and then I use the following for December and February (Winter) visibility:

        Month_December_February


        (E:ZULU MONTH OF YEAR, number) 12.0 == (E:ZULU MONTH OF YEAR, number) 2.0 == or if{ 1 } els{ 0 }

        All seems to work fine with textures switching at the appropriate times.

        Orbx appears to have different “season” months than the default FSX/P3D.
        I’ve modified the season switching to match FTX/Orbx seasons for EU England, Scotland and Wales as below:

        Month_March_April_May


        (E:ZULU MONTH OF YEAR, number) 3.0 >= (E:ZULU MONTH OF YEAR, number) 5.0 <= and if{ 1 } els{ 0 }

        Month_June_July_August_September


        (E:ZULU MONTH OF YEAR, number) 6.0 >= (E:ZULU MONTH OF YEAR, number) 9.0 <= and if{ 1 } els{ 0 }

        Month_October_November


        (E:ZULU MONTH OF YEAR, number) 10.0 >= (E:ZULU MONTH OF YEAR, number) 11.0 <= and if{ 1 } els{ 0 }

        Month_December_February


        (E:ZULU MONTH OF YEAR, number) 12.0 == (E:ZULU MONTH OF YEAR, number) 2.0 == or if{ 1 } els{ 0 }

        Month_January


        (E:ZULU MONTH OF YEAR, number) 1.0 == if{ 1 } els{ 0 }

        It all seems to work fine for me.
        Hope it helps someone

        Gary

  5. Cornel Grigoriu says:

    Hello
    Can anyone lighten me up on this where exact in modeldef.xml should this code be inserted. tryed with the mcx and via the modeldef editor put this in. Only end up with som error message.

    Cornel

    • arno says:

      You can just add it at the end of the file, behind the last definition in there.

      What error message you get?

      • Cornel Grigoriu says:

        Hello
        I did put the code in as in your test case! But I did it in the modeldef.xml directly. (that gave no error)
        What I don’t get in what way should it be referenced to the MCX
        cant see anything in MCX so I can make an reference to the code??
        i tried wit an bgl file that I did compile, it is a xmas tree just to show up in December.

        Cornel

        • arno says:

          Once you have added the definition to the modeldef.xml file, you can use the hierarchy editor in MCX to assign the visibility condition to (part of) your object.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.