• 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.

Textured PAPIs with 2004 gamepack problem

Messages
139
Country
unitedkingdom
Hi all

After enough of the BGL_LIGHT limitations, I've made some new APAPIs with textured light planes and multiple LODs. These work fine when compiled. I've tweaked the code to include 2 separation planes - one for each light fixture. However, only the 2nd sep plane works, no matter which way around they are in the code. So originally the left PAPI was 1st in the code, and would only show the white - never switches to the red. Right PAPI working fine. Change it in the code so the right PAPI is 1st in the code, it stops working and the left starts. I'm baffled at this one. Removing one of the sep planes so only 1 light is enabled causes it to still show white and never change to red. The code within both sep planes is identical except for the calling of the textured planes and jumps.

The code is quite lengthy to post, but to sum it up is goes like this:

DRAW_TRIs
DRAW_TRI_END

SEP_PLANE lamp1a, x, z, y, 32768
white light code
BGL_JUMP_32 lamp1b
lamp1a label BGLCODE
red light code
lamp1b label BGLCODE

SEP_PLANE lamp2a, x, z, y, 32768
white light code
BGL_JUMP_32 lamp2b
lamp2a label BGLCODE
red light code
lamp2b label BGLCODE

BGL_RETURN

So basically with the above lamp2 works and lamp1 is always white. Switch them around and lamp1 works and lamp2 doesn't. Any help would be greatly appreciated.
 
Hi,

The code structure you posted here looks fine. So I would double check your actual code to see if you did not misspell one label or so.
 
Hi Arno

Checked the code lots of times. With lamp2 working I remove lamp1 and lamp2 stops working. It seems to be that the 1st one of the 2 doesn't matter which it is doesn't work.
 
Can you show the part of your actual code with the SEPARATION_PLANE commands?
 
Code:
SEPARATION_PLANE lamp1below, -1001, 32715, 1565, 32768

    IFSIZEV  _13apapi_fs9_skip_11, 677,1000 ; lod test 70..100

    ; Node 45 - Plane101 transform:

     BGL_SET_MATRIX_INDIRECT	11
    BGL_CALL_32 _13apapi_fs9_Plane101_12        ; Node 45 - Plane101
_13apapi_fs9_skip_11 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_12, 1579,1000 ; lod test 30..70
    IFSIZEV  _13apapi_fs9_lod_9, 677,1000
    JUMP     _13apapi_fs9_skip_12
_13apapi_fs9_lod_9 label BGLCODE

    ; Node 46 - Plane102 transform:

     BGL_SET_MATRIX_INDIRECT	12
    BGL_CALL_32 _13apapi_fs9_Plane102_13        ; Node 46 - Plane102
_13apapi_fs9_skip_12 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_13, 4739,1000 ; lod test 10..30
    IFSIZEV  _13apapi_fs9_lod_10, 1579,1000
    JUMP     _13apapi_fs9_skip_13
_13apapi_fs9_lod_10 label BGLCODE

    ; Node 47 - Plane103 transform:

     BGL_SET_MATRIX_INDIRECT	13
    BGL_CALL_32 _13apapi_fs9_Plane103_14        ; Node 47 - Plane103
_13apapi_fs9_skip_13 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_14, 9479,1000 ; lod test 5..10
    IFSIZEV  _13apapi_fs9_lod_11, 4739,1000
    JUMP     _13apapi_fs9_skip_14
_13apapi_fs9_lod_11 label BGLCODE

    ; Node 48 - Plane104 transform:

     BGL_SET_MATRIX_INDIRECT	14
    BGL_CALL_32 _13apapi_fs9_Plane104_15        ; Node 48 - Plane104
_13apapi_fs9_skip_14 label BGLCODE
    IFSIZEV  _13apapi_fs9_lod_12, 9479,1000 ; lod test 0..5
    JUMP     _13apapi_fs9_skip_15
_13apapi_fs9_lod_12 label BGLCODE

    ; Node 49 - Plane105 transform:

     BGL_SET_MATRIX_INDIRECT	15
    BGL_CALL_32 _13apapi_fs9_Plane105_16        ; Node 49 - Plane105
_13apapi_fs9_skip_15 label BGLCODE

BGL_JUMP_32 lamp1above
lamp1below label BGLCODE

     ;BGL_SET_MATRIX_INDIRECT	0
    IFSIZEV  _13apapi_fs9_skip_1, 677,1000 ; lod test 70..100

    ; Node 35 - Plane01 transform:

     BGL_SET_MATRIX_INDIRECT	1
    BGL_CALL_32 _13apapi_fs9_Plane01_2        ; Node 35 - Plane01
_13apapi_fs9_skip_1 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_2, 1579,1000 ; lod test 30..70
    IFSIZEV  _13apapi_fs9_lod_1, 677,1000
    JUMP     _13apapi_fs9_skip_2
_13apapi_fs9_lod_1 label BGLCODE

    ; Node 36 - Plane02 transform:

     BGL_SET_MATRIX_INDIRECT	2
    BGL_CALL_32 _13apapi_fs9_Plane02_3        ; Node 36 - Plane02
_13apapi_fs9_skip_2 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_3, 4739,1000 ; lod test 10..30
    IFSIZEV  _13apapi_fs9_lod_2, 1579,1000
    JUMP     _13apapi_fs9_skip_3
_13apapi_fs9_lod_2 label BGLCODE

    ; Node 37 - Plane03 transform:

     BGL_SET_MATRIX_INDIRECT	3
    BGL_CALL_32 _13apapi_fs9_Plane03_4        ; Node 37 - Plane03
_13apapi_fs9_skip_3 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_4, 9479,1000 ; lod test 5..10
    IFSIZEV  _13apapi_fs9_lod_3, 4739,1000
    JUMP     _13apapi_fs9_skip_4
_13apapi_fs9_lod_3 label BGLCODE

    ; Node 38 - Plane04 transform:

     BGL_SET_MATRIX_INDIRECT	4
    BGL_CALL_32 _13apapi_fs9_Plane04_5        ; Node 38 - Plane04
_13apapi_fs9_skip_4 label BGLCODE
    IFSIZEV  _13apapi_fs9_lod_4, 9479,1000 ; lod test 0..5
    JUMP     _13apapi_fs9_skip_5
_13apapi_fs9_lod_4 label BGLCODE

    ; Node 39 - Plane05 transform:

     BGL_SET_MATRIX_INDIRECT	5
    BGL_CALL_32 _13apapi_fs9_Plane05_6        ; Node 39 - Plane05
_13apapi_fs9_skip_5 label BGLCODE

lamp1above label BGLCODE

SEPARATION_PLANE lamp2below, -1308, 32678, 2046, 32768

    IFSIZEV  _13apapi_fs9_skip_16, 677,1000 ; lod test 70..100

    ; Node 50 - Plane111 transform:

     BGL_SET_MATRIX_INDIRECT	16
    BGL_CALL_32 _13apapi_fs9_Plane111_17        ; Node 50 - Plane111
_13apapi_fs9_skip_16 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_17, 1579,1000 ; lod test 30..70
    IFSIZEV  _13apapi_fs9_lod_13, 677,1000
    JUMP     _13apapi_fs9_skip_17
_13apapi_fs9_lod_13 label BGLCODE

    ; Node 51 - Plane112 transform:

     BGL_SET_MATRIX_INDIRECT	17
    BGL_CALL_32 _13apapi_fs9_Plane112_18        ; Node 51 - Plane112
_13apapi_fs9_skip_17 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_18, 4739,1000 ; lod test 10..30
    IFSIZEV  _13apapi_fs9_lod_14, 1579,1000
    JUMP     _13apapi_fs9_skip_18
_13apapi_fs9_lod_14 label BGLCODE

    ; Node 52 - Plane113 transform:

     BGL_SET_MATRIX_INDIRECT	18
    BGL_CALL_32 _13apapi_fs9_Plane113_19        ; Node 52 - Plane113
_13apapi_fs9_skip_18 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_19, 9479,1000 ; lod test 5..10
    IFSIZEV  _13apapi_fs9_lod_15, 4739,1000
    JUMP     _13apapi_fs9_skip_19
_13apapi_fs9_lod_15 label BGLCODE

    ; Node 53 - Plane114 transform:

     BGL_SET_MATRIX_INDIRECT	19
    BGL_CALL_32 _13apapi_fs9_Plane114_20        ; Node 53 - Plane114
_13apapi_fs9_skip_19 label BGLCODE
    IFSIZEV  _13apapi_fs9_lod_16, 9479,1000 ; lod test 0..5
    JUMP     _13apapi_fs9_skip_20
_13apapi_fs9_lod_16 label BGLCODE

    ; Node 54 - Plane115 transform:

     BGL_SET_MATRIX_INDIRECT	20
    BGL_CALL_32 _13apapi_fs9_Plane115_21        ; Node 54 - Plane115
_13apapi_fs9_skip_20 label BGLCODE

BGL_JUMP_32 lamp2above
lamp2below label BGLCODE

    IFSIZEV  _13apapi_fs9_skip_6, 677,1000 ; lod test 70..100

    ; Node 40 - Plane11 transform:

     BGL_SET_MATRIX_INDIRECT	6
    BGL_CALL_32 _13apapi_fs9_Plane11_7        ; Node 40 - Plane11
_13apapi_fs9_skip_6 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_7, 1579,1000 ; lod test 30..70
    IFSIZEV  _13apapi_fs9_lod_5, 677,1000
    JUMP     _13apapi_fs9_skip_7
_13apapi_fs9_lod_5 label BGLCODE

    ; Node 41 - Plane12 transform:

     BGL_SET_MATRIX_INDIRECT	7
    BGL_CALL_32 _13apapi_fs9_Plane12_8        ; Node 41 - Plane12
_13apapi_fs9_skip_7 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_8, 4739,1000 ; lod test 10..30
    IFSIZEV  _13apapi_fs9_lod_6, 1579,1000
    JUMP     _13apapi_fs9_skip_8
_13apapi_fs9_lod_6 label BGLCODE

    ; Node 42 - Plane13 transform:

     BGL_SET_MATRIX_INDIRECT	8
    BGL_CALL_32 _13apapi_fs9_Plane13_9        ; Node 42 - Plane13
_13apapi_fs9_skip_8 label BGLCODE
    IFSIZEV  _13apapi_fs9_skip_9, 9479,1000 ; lod test 5..10
    IFSIZEV  _13apapi_fs9_lod_7, 4739,1000
    JUMP     _13apapi_fs9_skip_9
_13apapi_fs9_lod_7 label BGLCODE

    ; Node 43 - Plane14 transform:

     BGL_SET_MATRIX_INDIRECT	9
    BGL_CALL_32 _13apapi_fs9_Plane14_10        ; Node 43 - Plane14
_13apapi_fs9_skip_9 label BGLCODE
    IFSIZEV  _13apapi_fs9_lod_8, 9479,1000 ; lod test 0..5
    JUMP     _13apapi_fs9_skip_10
_13apapi_fs9_lod_8 label BGLCODE

    ; Node 44 - Plane15 transform:

     BGL_SET_MATRIX_INDIRECT	10
    BGL_CALL_32 _13apapi_fs9_Plane15_11        ; Node 44 - Plane15
_13apapi_fs9_skip_10 label BGLCODE

lamp2above label BGLCODE

    BGL_RETURN
 
Hi,

How did you produce this overly complex code? I don't actually see the part that actually draws any light.

Since there are so many checks and jumps, it could very well be that one jump is skipping part of your logic. But that is very hard to debug.

Do you actually need the LOD checks and all those on the lights? My feeling is that it should be possible to make this much simpler.
 
OK after a few hours of messing I've figured out the problem. It appears that the X and Y values needed to have their signs changed around, so the + value was made -, and vice-versa. Interestingly the other lamp was correct. Glad it works, can finally move away from bgl lighting :). Thanks Arno - if you have a way of making the code simpler please let me know.
 
Last edited:
Glad to hear you got it working.

About the code, I assume you used GMax to model? I have not seen such complex code for lights before made by GMax. So not sure how to improve it.
 
Hi Arno

Yes Gmax and FS2004 gamepack - this is the code it spewed out. Technically they are not lights they are planes textured with bright light looking circles. That's ok they work which is the main thing. Just trying to get wind direction factored in and they should be finished.

EDIT: Turns out I can't get the wind working - does it work in FSX? I've added this on the line before the sep plane:

IFIN1 windrange, 0C74h, 1999h, 9999h

and windrange label word at the end.

According to MDLTweakerII the c74 variable takes 0-65535 for headings 0-360. After trying IFIN1 windrange, 0C74h, 36, 216 for my heading range I divided 65536 by 360 to get 182.04, which I multiplied 36 and 216 with to get 6553 and 39321 respectively. The hex values of these are the ones above. None of the 3 sets of values work. Which one is the correct one for only showing the sep plane at a certain wind direction (between 36 and 216 degrees)?
 
Last edited:
Back
Top