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

FS2004 ASM Code for empty LOD's

Messages
502
Country
unitedstates
Hi Folks,

I've got working LOD's for models - but - what's the deal with creating empty LOD's where the entire model vanishes and doesn't use any system resources any longer ? I can't seem to export an empty model for a LOD level from my modeling software... I am hand planting pretty vast forests - yeah - yeah - LOL - I need figure out that autogen placing tool - and - I want my forests to disappear at appropriate levels to reduce the load on resources... Is it an ASM tweak ? I hope I can do it in the ASM code since I've automated the entire model creation process with shell scripts and it's easier to script the mods than perform them manually... I have more than 40 different custom tree/vegetation models...

Regards,
Scott
 
Hi Scott,

In the ASM code it would be another IFVSIZE command, but then one jumping directly to the BGL_RETURN statement.

Do you have some levels of detail in your code already? Then you can probably see how the IFVSIZE commands are used to select the right LOD.

Like you already mentioned, I think you will get better performance when using autogen trees.
 
Hi Arno,

Thanks - yep - I have some LOD code that works - let me give that a try...

Are the autogen models inherently more efficient to use than stand alone models - or - is it simply the ease at which you can plant trees ???

My models are simple 2D 2 Poly one sided planes...

Thanks...
:)

Regards,
Scott
 
Last edited:
Hi Scott,

It's a long time ago I used FS2004, so what I say now is partly based on FSX as well. But with MDL files you always have the overhead of placing the object with XML code. When placing many objects, like trees, that overhead will cost quite some performance. It seems autogen does not have that overhead, and therefore it can cope much better with big quantities of trees. Also autogen seems to vanish earlier, which is better for the performance of course (even with an empty LOD in your model, the scenery engine still has to check all the time if it should be drawn or not).
 
Hi Arno,

Hmm - might have to reconsider my tree strategy... While I've got the hang of of the various compilers - ADE9X - SBuilder - my modeling tools - PSP - et etc etc - Annotator kicked my butt - maybe I'll have to give it another shot...
;)

Regards,
Scott
 
Morn'n Folks,

I have an example of an empty LOD working... In order to get it working I just commented (annotated in red) out what I believe was the call to display the second model... I couldn't get the BGL_Return suggestion to work... Is there a way to do this cleaner or easier ? Since I plan on doing this on a large number of models - I'd like to be sure I am doing it the best way possible...

In addition - while trying to get this to work - I came across a post that seemed to mention "Model Converter X" would do this for me as well... Would that work with FS9 models - I thought it was just for FSX...

Code:
;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------
;
; This file was automatically generated from C:\Users\N63503\Desktop\Apps\Games\MSFS\Scenery Design\Model Work\LOD Model Test\Tree.X
; using the MakeMDL tool.  Do not edit by hand, re-run the
; tool instead.
;
; generated on 01/03/13 22:43:11
;
;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------
; BGL model for C:\Users\N63503\Desktop\Apps\Games\MSFS\Scenery Design\Model Work\LOD Model Test\Tree.X
;
; $Header:$
;
;----------------------------------------------------------------------------
;
; Final Status:   4 polys
; Alpha Status:   0 polys
; Light Status:   0 polys
; Library Status: 0 polys
;
; Start Time: 01/03/13 22:43:11
; Stop Time : 01/03/13 22:43:11
;
; Modeling units = 1.0000
; Radius = 64.4410
; Radius in meters = 64.4410
; Radius in modeling units = 65
;
Tree_top label BGLCODE
texture_riff_start_Tree	label	word
    db  'T','E','X','T'   
    dd  texture_riff_end_Tree - $ - 4  
    TEXTURE_LIST_BEGIN
    TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 28.452538, "OCA SIGN.BMP"	; 0
    TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 33.941125, "TREES.BMP"	; 1
    TEXTURE_LIST_END
    BGL_RETURN
texture_riff_end_Tree label word       


material_riff_start_Tree	label	word
    db  'M','A','T','E'   
    dd  material_riff_end_Tree - $ - 4  
    MATERIAL_LIST_BEGIN
    MATERIAL_DEF 1.000000,1.000000,1.000000,1.000000,  0.392157,0.392157,0.392157,  0.000000,0.000000,0.000000,  0.000000,0.000000,0.000000,  0.000000 ; 0
    MATERIAL_LIST_END
    BGL_RETURN
material_riff_end_Tree label word       


vertex_riff_start_Tree	label	word
    db  'V','E','R','T'   
    dd  vertex_riff_end_Tree - $ - 4  
    VERTEX_LIST_BEGIN
    VERTEX_DEF    -6.000530,    0.000657,   -0.000221,   0.000000, 0.000000, 1.000000,   -0.183600,1.867200 ;   0 part=  2 prim=0
    VERTEX_DEF    -6.000530,   12.000658,   -0.000221,   0.000000, 0.000000, 1.000000,   -0.183600,1.999000 ;   1 part=  2 prim=0
    VERTEX_DEF     5.999470,    0.000657,   -0.000221,   0.000000, 0.000000, 1.000000,   -0.858400,1.867200 ;   2 part=  2 prim=0
    VERTEX_DEF     5.999470,   12.000658,   -0.000221,   0.000000, 0.000000, 1.000000,   -0.858400,1.999000 ;   3 part=  2 prim=0
    VERTEX_DEF    -5.998985,    0.000000,    0.000488,   0.000000, 0.000000, 1.000000,   -0.750000,1.750000 ;   4 part=  3 prim=0
    VERTEX_DEF    -5.998985,   12.000001,    0.000488,   0.000000, 0.000000, 1.000000,   -0.750000,2.000000 ;   5 part=  3 prim=0
    VERTEX_DEF     6.001015,    0.000000,    0.000488,   0.000000, 0.000000, 1.000000,   -1.000000,1.750000 ;   6 part=  3 prim=0
    VERTEX_DEF     6.001015,   12.000001,    0.000488,   0.000000, 0.000000, 1.000000,   -1.000000,2.000000 ;   7 part=  3 prim=0
    VERTEX_LIST_END
    BGL_RETURN
vertex_riff_end_Tree label word       


bgl_riff_start_Tree	label	BGLCODE
    db	'B','G','L',' '
    dd	bgl_riff_end_Tree - $ - 4
LOD_0_Tree	label	BGLCODE

; NonAlpha
Tree_NonAlpha label BGLCODE
    BGL_CALL_32 Tree_Main_1        ; Node 1 - Main
    BGL_END
    BGL_RETURN


Tree_Main_1 label BGLCODE
    IFSIZEV  Tree_lod_1, 5370,1000 ; lod test 0..30
    JUMP     Tree_skip_1
Tree_lod_1 label BGLCODE

    ; Node 2 - Tree transform:

     BGL_SET_MATRIX_INDIRECT	0
   ; ### SCO #### [COLOR="Red"][B]BGL_CALL_32 Tree_Tree_2 [/B][/COLOR]       ; Node 2 - Tree
Tree_skip_1 label BGLCODE
    IFSIZEV  Tree_skip_2, 5370,1000 ; lod test 30..100

    ; Node 3 - Tree transform:

     BGL_SET_MATRIX_INDIRECT	1
    BGL_CALL_32 Tree_Tree_3        ; Node 3 - Tree
Tree_skip_2 label BGLCODE
    BGL_RETURN


Tree_Tree_2 label BGLCODE
    MATERIAL 0,0 ; <255,255,255,255> OCA SIGN.BMP;;;
    DRAW_TRI_BEGIN 0, 4
    DRAW_TRI    0,   1,   2 ; poly=2 part=2
    DRAW_TRI    1,   3,   2 ; poly=1 part=2
    DRAW_TRI_END
    BGL_RETURN


Tree_Tree_3 label BGLCODE
    MATERIAL 0,1 ; <255,255,255,255> TREES.TGA;;;
    DRAW_TRI_BEGIN 4, 4
    DRAW_TRI    0,   1,   2 ; poly=4 part=3
    DRAW_TRI    1,   3,   2 ; poly=3 part=3
    DRAW_TRI_END
    BGL_RETURN


bgl_riff_end_Tree	label	BGLCODE
;
; STATIC ANIMATION BLOCK
;
static_matrix_list_riff_start_Tree	label	word
    db  'T','R','A','N'   
    dd  static_matrix_list_riff_end_Tree - $ - 4

; Static matrix parameters for transform: 0
    real4      1.000000,     0.000000,     0.000000,     0.000000  
    real4      0.000000,     1.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000000,     1.000000,     0.000000  
    real4    -33.183472,    -1.076657,   -34.963779,     1.000000  

; Static matrix parameters for transform: 1
    real4      1.000000,     0.000000,     0.000000,     0.000000  
    real4      0.000000,     1.000000,     0.000000,     0.000000  
    real4      0.000000,     0.000000,     1.000000,     0.000000  
    real4    -47.849018,     0.000000,   -33.300491,     1.000000  
static_matrix_list_riff_end_Tree label word       

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

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

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

     BGL_TRANSFORM_INDIRECT  0, 0

Regards,
Scott
 
Hi Scott,

The way you did it seems fine. I would also remove the geometry that was being called, that is only taking up memory space now and you don't use it anymore.

I think ModelConverterX should also work, although it is a long time ago I tested the empty LOD in FS2004. You can add an empty LOD in the LOD Creator form. And it should export to FS2004 MDL as well.
 
Hi Arno,

After reading some posts last night I figured out that MCX did work with FS9... I download and install MCX... Wow - what a Swiss Army knife of scenery development... It's an incredible tool and can see it will prove very useful going forward... From what I tried last night - it doesn't appear to work for the specific task at hand as it doesn't seem able to process my FS9 specific mods - such as face the user - and - my 5 seasonal vegetation textures... After I processed the models through MCX - all my modifications were gone... I didn't spend a lot of time on it - - it might have been operator error - so I'll play around some more this weekend and see if I can get it to do what I need...

Appreciate all your help and contributions - sir... Hope your electrical job went well... Have a great weekend...
:)

Regards,
Scott
 
Hi Scott,

Correct, ModelConverterX uses MakeMDL to compile the models. So that means that rotate to user and seasonal textures do not work.
 
Hi Arno,

Just FYI for anyone that comes along - I've got my scripts modified to create the ASM files properly - in bulk - with empty LOD's... Now I'm just playing with LOD levels to match the surrounding autogen... All thanks to your help... If you note anything that could be done better - please feel free to point it out... OBTW: This model will crash MCX...
:)

Full Example:

.ASM (Kill Shadow)

Code:
; compile with BGLC /MDL Con01f12.asm
    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  14
    dd  0
    dd  0
    dd  152
    db  'F','S','8','0'
    dd  2304
visual_model_header_end  label dword

    db  'I','S','F','T'   
    dd  ver_end - $ - 4  
    db  "MakeMDL - FS90 (9.00.030612.02)",0
ver_end label word       

bounding_box_riff_start	label	word
    db  'B','B','O','X'   
    dd  bounding_box_riff_end - $ - 4
    real4  -6.000, 0.000, 0.000  
    real4  6.000, 12.000, 0.000  
bounding_box_riff_end label word       

[COLOR="Red"]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[/COLOR]


model_outside    label    BGLCODE
model_shadow label BGLCODE
model_inside  label    BGLCODE
crash_riff_start label BGLCODE
    db  'C','R','A','S'   
    dd  crash_riff_end - $ - 4
    BGL_CRASH_START   model_crash_end, 6
    BGL_CRASH_OCTTREE  crash_end_1
    dw     CRASH_FLAG_BUILDING_PLANE            ; crash type
    dw     5            ; nodes used
    real4  -6.000000,0.000000,0.000000      ; Box x,y,z 
    real4  12.000100,12.000100,4.000033      ; Box w,h,d 
    dw   1,   2,   2,   3,   3,   4,   4,   5    ; base offset into node table, one for each top-level branch
    ; So if you take branch 2 (count from 0), you add 2 to indices you encounter on that branch
    ; Nodes (254=empty 255=full, else an index into branch)
    OCTTREE_NODE     0, 254,   0, 254,   0, 254,   0, 254           ; node   0
    OCTTREE_NODE   255, 254, 255, 254, 255, 254, 255, 254           ; node   1
    OCTTREE_NODE   255, 254, 255, 254, 255, 254, 255, 254           ; node   2
    OCTTREE_NODE   255, 254, 255, 254, 255, 254, 255, 254           ; node   3
    OCTTREE_NODE   255, 254, 255, 254, 255, 254, 255, 254           ; node   4
crash_end_1 label word
model_crash_end label word
    BGL_RETURN
crash_riff_end	label	BGLCODE

exterior_riff_start_0 label BGLCODE
    db  'E','X','T','E'   
    dd  exterior_riff_end_0 - $ - 4
LOD_0L    label    BGLCODE
    include    Con01f12_0.asm
exterior_riff_end_0	label	BGLCODE



bgl_data_end label     BGLCODE

####################################################

_0.ASM (Seasonal Textures, Unify Normals, Empty LOD, Face User)

Code:
;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------
;
; This file was automatically generated from Con01f12.X
; using the MakeMDL tool.  Do not edit by hand, re-run the
; tool instead.
;
; generated on 01/08/13 07:19:19
;
;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------
; BGL model for Con01f12.X
;
; $Header:$
;
;----------------------------------------------------------------------------
;
; Final Status:   2 polys
; Alpha Status:   0 polys
; Light Status:   0 polys
; Library Status: 0 polys
;
; Start Time: 01/08/13 07:19:19
; Stop Time : 01/08/13 07:19:19
;
; Modeling units = 1.0000
; Radius = 13.4164
; Radius in meters = 13.4164
; Radius in modeling units = 14
;
Con01f12_top label BGLCODE
texture_riff_start_Con01f12	label	word
    db  'T','E','X','T'   
    dd  texture_riff_end_Con01f12 - $ - 4  
[COLOR="Blue"]    TEXTURE_LIST_BEGIN
    TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 42.426408, "TREES.BMP"	; 0
	TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 42.426407, "TREES_WI.BMP"	; 1
	TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 42.426407, "TREES_SP.BMP"	; 2
	TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 42.426407, "TREES_FA.BMP"	; 3
	TEXTURE_DEF TEXTURE_BUILDING    , <255,255,255,255>, 42.426407, "TREES_HW.BMP"	; 4
    TEXTURE_LIST_END[/COLOR]
    BGL_RETURN
texture_riff_end_Con01f12 label word       


material_riff_start_Con01f12	label	word
    db  'M','A','T','E'   
    dd  material_riff_end_Con01f12 - $ - 4  
    MATERIAL_LIST_BEGIN
    MATERIAL_DEF 1.000000,1.000000,1.000000,1.000000,  0.392157,0.392157,0.392157,  0.000000,0.000000,0.000000,  0.000000,0.000000,0.000000,  0.000000 ; 0
    MATERIAL_LIST_END
    BGL_RETURN
material_riff_end_Con01f12 label word       


vertex_riff_start_Con01f12	label	word
    db  'V','E','R','T'   
    dd  vertex_riff_end_Con01f12 - $ - 4  
    VERTEX_LIST_BEGIN
    VERTEX_DEF -6.000000, 0.000000, 0.000000,   [COLOR="Green"]0.000000, 1.000000, 0.000000,[/COLOR] -0.750000,1.250000 ; 0 part= 1 prim=0
    VERTEX_DEF -6.000000, 12.000001, 0.000000,   [COLOR="Green"]0.000000, 1.000000, 0.000000,[/COLOR] -0.750000,1.500000 ; 1 part= 1 prim=0
    VERTEX_DEF 6.000000, 0.000000, 0.000000,   [COLOR="Green"]0.000000, 1.000000, 0.000000,[/COLOR] -1.000000,1.250000 ; 2 part= 1 prim=0
    VERTEX_DEF 6.000000, 12.000001, 0.000000,  [COLOR="Green"] 0.000000, 1.000000, 0.000000,[/COLOR] -1.000000,1.500000 ; 3 part= 1 prim=0
    VERTEX_LIST_END
    BGL_RETURN
vertex_riff_end_Con01f12 label word       


bgl_riff_start_Con01f12	label	BGLCODE
    db	'B','G','L',' '
    dd	bgl_riff_end_Con01f12 - $ - 4
LOD_0_Con01f12	label	BGLCODE

; NonAlpha
[COLOR="DarkOrange"]Con01f12_NonAlpha label BGLCODE
		; Node 1 - masterfrm transform:

		BGL_SET_MATRIX_INDIRECT	0
		BGL_CALL_32 LODzero		        ; Node 1 - masterfrm
    BGL_END
    BGL_RETURN


	LODzero label BGLCODE
		IFSIZEV LODzero_skip, 8385,1000 ; lod test 05..100 SKIP
		[COLOR="DarkOrchid"]SPRITE_VICALL Con01f12_Main_1, 0, 0, 0, 0, 0, 0, 0, 1, 0   ;ROTATE TO USER[/COLOR]
		LODzero_skip label BGLCODE
	BGL_RETURN[/COLOR]	

Con01f12_Main_1 label BGLCODE

[COLOR="Blue"]    IFIN1 tex_01, 038Ah, 107, 137		;WINTER APR17-MAY17
	MATERIAL 0,1 ;  winter
	JUMP tex_continue
	tex_01 label word

	IFIN1 tex_02, 038Ah, 138, 168		;SPRING MAY18-JUN17
	MATERIAL 0,2 ; spring
	JUMP tex_continue
	tex_02 label word

	IFIN1 tex_03, 038Ah, 169, 261		;SUMMER JUN18-SEP18
	MATERIAL 1,0 ; summer
	JUMP tex_continue
	tex_03 label word

	IFIN1 tex_04, 038Ah, 262, 292		;FALL SEP19-OCT19
	MATERIAL 0,3 ; fall
	JUMP tex_continue
	tex_04 label word

	IFIN1 tex_05, 038Ah, 293, 354		;WINTER OCT20-DEC20
	MATERIAL 0,1 ; winter
	JUMP tex_continue
	tex_05 label word

	MATERIAL 0,4 ; hard winter			;HARD WINTER DEC21-APR16
	tex_continue label word[/COLOR]
 
    DRAW_TRI_BEGIN 0, 4
    DRAW_TRI    0,   1,   2 ; poly=2 part=1
    DRAW_TRI    1,   3,   2 ; poly=1 part=1
    DRAW_TRI_END
    BGL_RETURN


bgl_riff_end_Con01f12	label	BGLCODE

;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------
;
; This file was automatically generated from Con01f12.X
; using the MakeMDL tool.  Do not edit by hand, re-run the
; tool instead.
;
; generated on 01/08/13 07:19:19
;
;--------- WARNING - WARNING - WARNING - WARNING - WARNING - WARNING ---------

Regards,
Scott
 
Last edited:
Hi,

Code looks fine. I am only not sure about the BGL_END in your empty lod. This riff section normally does not contain an end statement.
 
Back
Top