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

A cry for Help

Messages
406
I know this has been covered a thousand times but I just cannot get my head around creating a street light that casts a beam on the floor. I have nearly finished my project and this is the final area that simply does my head in. I have created my light and put a simple box where the light should be. I then try to follow all of the instructions but I get completely and utterly baffled. I would be really grateful if someone could explain this to me in words that a child of 6 may understand I may have a fighting chance. it is the one thing in this whole project that has scuppered me

Thank you in anticipation of some kind soul helping me out
 
Hi,

this is not an effect but a downward pointing spotlight (just the beam on the ground). Look in this topic the first code. Compile it to BGL (with BGLC_9) and now you can use as a library and place everywhere with XML code for example. Very easy because rhumbaflappy already made the code (thx!) so you just have to compile and use it :D Higher the altitude wider the beam.
 
Yes I have seen that but where does it fit with the light I have made and exported? Thats the bit I do not get, have I got it right in Gmax for example. When I export I get my normal mdl, xml, Asm and asm_0 files, what do I do with this code :confused:

Told you this is one thing that just will not sink in?
 
Okay so here is the code:

Code:
    db  'R','I','F','F'				; RIFF file identifier
    dd  bgl_data_end - $ - 4		    ; size of RIFF data
    db  'M','D','L','9'				; file identifire (FS9 model)

    db  'M','D','L','H'
    dd  visual_model_header_end - $ - 4
    dd  visual_model_header_end - $ - 4
    dd  0
    dd  0
    dd  2
    dd  0
    dd  0
    dd  156
    db  'F','S','8','0'
    dd  2304
visual_model_header_end  label dword

    db  'I','S','F','T'   
    dd  ver_end - $ - 4  
    db  "BGLC_9",0
ver_end label word       

bounding_box_riff_start	label	word
    db  'B','B','O','X'   
    dd  bounding_box_riff_end - $ - 4
    real4  -100.000, -100.000, -100.000  
    real4  100.000, 100.000, 100.000  
bounding_box_riff_end label word       


model_outside    label    BGLCODE
model_shadow label BGLCODE
model_inside  label    BGLCODE


exterior_riff_start_0 label BGLCODE
    db  'E','X','T','E'   
    dd  exterior_riff_end_0 - $ - 4
LOD_0L    label    BGLCODE
bgl_riff_start_Light01	label	BGLCODE
    db	'B','G','L',' '
    dd	bgl_riff_end_Light01 - $ - 4
LOD_0_Light01	label	BGLCODE

; Alpha
LIGHT_TAXI_beta_Alpha label BGLCODE

    ; Node 1 - MasterScale transform:

     BGL_SET_MATRIX_INDIRECT	0
    BGL_CALL_32 LIGHT_TAXI_beta_MasterScale_1        ; Node 1 - MasterScale
    BGL_END
    BGL_RETURN


LIGHT_TAXI_beta_MasterScale_1 label BGLCODE

    ; Node 2 - MasterUnitConversion transform:

     BGL_SET_MATRIX_INDIRECT	1

    ; Node 3 - RotateAroundX transform:

     BGL_SET_MATRIX_INDIRECT	2

    ; Node 4 - LightCone transform:

     BGL_SET_MATRIX_INDIRECT	3


    BGL_LIGHT LIGHT_TAXI, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0FFABABABh, 0.000000, 0.000000, 0.000000 ; Color is AB AB AB (rgb)

    BGL_RETURN


bgl_riff_end_Light01	label	BGLCODE
;
; STATIC ANIMATION BLOCK
;
static_matrix_list_riff_start_Light01	label	word
    db  'T','R','A','N'   
    dd  static_matrix_list_riff_end_Light01 - $ - 4

; Static matrix parameters for transform: 0
    real4      0.000997,     0.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000997,     0.000000,     0.000000  
    real4      0.000000,     0.000000,     0.000997,     0.000000  
    real4      0.000000,     0.000000,     0.000000,     1.000000  

; Static matrix parameters for transform: 1
    real4   1024.000000,     0.000000,     0.000000,     0.000000  
    real4      0.000000,  1024.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000000,  1024.000000,     0.000000  
    real4      0.000000,     0.000000,     0.000000,     1.000000  

; Static matrix parameters for transform: 2
    real4      1.000000,     0.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000000,     1.000000,     0.000000  
    real4      0.000000,    -1.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000000,     0.000000,     1.000000  

; Static matrix parameters for transform: 3
    real4      1.000000,     0.000000,     0.000000,     0.000000  
    real4      0.000000,     1.000000,     0.000000,     0.000000  
    real4      0.000000,    -0.000001,     1.000000,     0.000000  
    real4      0.000000,     0.000000,     0.000000,     1.000000  
static_matrix_list_riff_end_Light01 label word       

;
; ANIMATION PARAMETER BLOCK
;
animation_parameters_riff_start_Light01	label	word
    db  'A','N','I','P'   
    dd  animation_parameters_riff_end_Light01 - $ - 4
animation_parameters_riff_end_Light01 label word       

;
; ANIMATION COMMAND BLOCK
;
animation_commands_riff_start_Light01	label	word
    db  'A','N','I','C'   
    dd  animation_commands_riff_end_Light01 - $ - 4

; Animation command for transform: 0  output index: 0
bgl_animation_command_start_LIGHT_LANDING_beta_0	label	BGLCODE

     BGL_TRANSFORM_INDIRECT  0, 0
 bgl_animation_command_end_LIGHT_LANDING_beta_0	label	BGLCODE

; Animation command for transform: 1  output index: 1
bgl_animation_command_start_LIGHT_LANDING_beta_1	label	BGLCODE

     BGL_TRANSFORM_INDIRECT  1, 1
 bgl_animation_command_end_LIGHT_LANDING_beta_1	label	BGLCODE

; Animation command for transform: 2  output index: 2
bgl_animation_command_start_LIGHT_LANDING_beta_2	label	BGLCODE

     BGL_TRANSFORM_INDIRECT  2, 2
 bgl_animation_command_end_LIGHT_LANDING_beta_2	label	BGLCODE

; Animation command for transform: 3  output index: 3
bgl_animation_command_start_LIGHT_LANDING_beta_3	label	BGLCODE

     BGL_TRANSFORM_INDIRECT  3, 3
 bgl_animation_command_end_LIGHT_LANDING_beta_3	label	BGLCODE
animation_commands_riff_end_Light01 label word       

;
; SCENE GRAPH RIFF BLOCK
;
scene_graph_riff_start_Light01	label	word
    db  'S','C','E','N'   
    dd  scene_graph_riff_end_Light01 - $ - 4

    dw 4
bgl_scene_graph_entry_LIGHT_LANDING_beta_0	label	byte
BGL_SCENEGRAPH_ENTRY	0, 1, -1, bgl_animation_command_end_LIGHT_LANDING_beta_0 - bgl_animation_command_start_LIGHT_LANDING_beta_0, bgl_animation_command_start_LIGHT_LANDING_beta_0 - bgl_scene_graph_entry_LIGHT_LANDING_beta_0
bgl_scene_graph_entry_LIGHT_LANDING_beta_1	label	byte
BGL_SCENEGRAPH_ENTRY	1, 2, -1, bgl_animation_command_end_LIGHT_LANDING_beta_1 - bgl_animation_command_start_LIGHT_LANDING_beta_1, bgl_animation_command_start_LIGHT_LANDING_beta_1 - bgl_scene_graph_entry_LIGHT_LANDING_beta_1
bgl_scene_graph_entry_LIGHT_LANDING_beta_2	label	byte
BGL_SCENEGRAPH_ENTRY	2, 3, -1, bgl_animation_command_end_LIGHT_LANDING_beta_2 - bgl_animation_command_start_LIGHT_LANDING_beta_2, bgl_animation_command_start_LIGHT_LANDING_beta_2 - bgl_scene_graph_entry_LIGHT_LANDING_beta_2
bgl_scene_graph_entry_LIGHT_LANDING_beta_3	label	byte
BGL_SCENEGRAPH_ENTRY	3, -1, -1, bgl_animation_command_end_LIGHT_LANDING_beta_3 - bgl_animation_command_start_LIGHT_LANDING_beta_3, bgl_animation_command_start_LIGHT_LANDING_beta_3 - bgl_scene_graph_entry_LIGHT_LANDING_beta_3
scene_graph_riff_end_Light01 label word       


exterior_riff_end_0	label	BGLCODE


shadow_riff_start_0 label BGLCODE
  db 'S','H','A','D' 
  dd shadow_riff_end_0 - $ - 4
SHADOW_0L label BGLCODE

Kill_Shadow_top label BGLCODE
bgl_riff_start_Kill_Shadow label BGLCODE
  db 'B','G','L',' '
  dd bgl_riff_end_Kill_Shadow - $ - 4

LOD_0_Kill_Shadow label BGLCODE
  BGL_END
  BGL_RETURN

bgl_riff_end_Kill_Shadow label BGLCODE
shadow_riff_end_0 label BGLCODE


bgl_data_end label     BGLCODE

Copy it to a TXT file call it light_beam.txt for example. Compile it with BGLC_9.exe to an .MDL file. For this use the /MDL parameter for BGLC_9.exe. The easiest way to do this that you create a TXT file the same folder in your BGLC_9.exe and write into it this:

BGLC_9.exe /MDL light_beam.txt

After saveing the file rename it to .BAT so change extension to BAT. For example: light_compile.bat
Make sure that you see the file extensions in windows so the document icon would have to change after renameing it to BAT file.
After that put the light_beam.txt to the same folder as well and double click on your BAT file. If everything is ok you will get an MDL file.

Now you can position it with an XML code. For example this is an XML code:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<FSData version="9.0" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation="bglcomp.xsd">

	<SceneryObject lat="47 26.31" lon="19 13.77" alt="50" pitch="0" bank="0" heading="0" altitudeIsAgl="TRUE" imageComplexity="NORMAL">
		<LibraryObject name="75B3FE2747B3987F3DFEBEA2BE0F0E48" scale="1.0" />
	</SceneryObject>
	<SceneryObject lat="47 26.36" lon="19 13.69" alt="50" pitch="0" bank="0" heading="0" altitudeIsAgl="TRUE" imageComplexity="NORMAL">
		<LibraryObject name="75B3FE2747B3987F3DFEBEA2BE0F0E48" scale="1.0" />
	</SceneryObject>

	<ModelData name="75B3FE2747B3987F3DFEBEA2BE0F0E48" sourceFile="light_beam.mdl" />
</FSData>

As you can see you can place the MDL object (now the light beam) to the "FS world" with XML file. You can position them by coordinates. The code above place the beam on two different place. You can change the coordinates whatever you want. Use the FS to get the right coordinates for your lights. Yes it takes long time :( Maybe there are easiest way but i don't know any other methods now :( But for example you can combine the spot light code with your street light model so in this case you don't have to place the model separately by the light beam. Or you can make the street light model as a library file with BGLC_9 as well and use one XML to place the objects. For example the next XML code place a street light model and a beam on the same place:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<FSData version="9.0" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation="bglcomp.xsd">

	<SceneryObject lat="47 26.31" lon="19 13.77" alt="200" pitch="0" bank="0" heading="0" altitudeIsAgl="TRUE" imageComplexity="NORMAL">
		<LibraryObject name="75B3FE2747B3987F3DFEBEA2BE0F0E48" scale="1.0" />
	</SceneryObject>
	<SceneryObject lat="47 26.31" lon="19 13.77" alt="0" pitch="0" bank="0" heading="0" altitudeIsAgl="TRUE" imageComplexity="NORMAL">
		<LibraryObject name="6653FE2747B3H533DDFE889411FDBEE1" scale="1.0" />
	</SceneryObject>

	<ModelData name="75B3FE2747B3987F3DFEBEA2BE0F0E48" sourceFile="light_beam.mdl" />
	<ModelData name="6653FE2747B3H533DDFE889411FDBEE1" sourceFile="street_light.mdl" />
</FSData>

When you ready place your MDL and XML file at the same folder and drag and drop the XML file onto your BGLCOMP.exe. This make the final BGL. BGLCOMP.exe can be downloadable from Microsoft website together with the FS2004 SDK. Don't forget to put BOTH .bgl files into your scenery folder. The "final" bgl just indicate for FS that your models are in the library BGL.

I'm sure that there are other easiest way to do this but ask a guru like Arno etc :)
 
I used these great pieces of code from the earlier thread and they worked fabulously! Thank you again for posting the code!

The only thing I'll add is that after several instances of going back and forth trying to get the bulb and beams situated correctly, I purchased EZScenery from Abacus, which I now use to place my GMAX objects precisely.

Cheers,
Paul
 
Well I got everything to work re coding and mdl/bgl creation, but nothing in FS9, I used EZ scenery to place and although I see the light I created there is no beam :( this has to be one of the most annoying things I have ever tried to do :banghead: :banghead: :banghead: :banghead:


Update, it works, now how do get something that looks like a bul to appear on my light itself, and.......how do I change the colour of the ground light to be more amber at last I am getting somewhere :rotfl: :laughing:
 
Last edited:
in the code:
------------------
BGL_LIGHT LIGHT_TAXI, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0FFABABABh, 0.000000, 0.000000, 0.000000 ; Color is AB AB AB (rgb)

BGL_RETURN
------------------
Use any graphics program to find the color you want and use the rgb hex values.

PD
 
Great stuff :D I now have the right colour beam on the floor for my streetlight, however I cannot seem to get anything to work in the actual Gmax Streetlight that is 'the bulb' I have tried creating a box in the top of the light and calling this attachpont_LightNav, but then what happens is my light is lying flat on FS9 and there is no glowing bulb after dark...told you I was stupid
 
I have cured my light lying flat and I also have a nice orange glow on the ground. What I cannot seem to get to work is a bulb appearance. Am I doing this right.

Created a box within the top of the light

Attached an effect to that box


Is it that simple? if it is what am I doing wrong

 
Just to understand this right, you used a bgl light to create the light on the ground and using an effect for the bulb part of the light. If this is the case, make sure you dont have an exclude in your scene...otherwise the effect wont work.

Dave
 
Back
Top