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

My first experience with ModelConverterX

Luis_Sá

Resource contributor
Messages
326
Country
portugal
Hello Arno,

I watched the video tutorial about ModelConvereterX and I was very impressed about the power of your tool. I will think tomorrow about getting my "Madeira Islands" into FSX :)

I only tried to import a SCM macro and the tool asked me to enter 4 values for variables. I was in doubt as to what supply:

1) would it be the %1 %2 %3 ... macro parameters?
2) would it be Some UVar() used in the macro for math calculations before any code is written?
3) or will it be variables actually used in SCASM commands?

I think it is 3) as I had 4 references in the drawing code. So tomorrow I will compile/decompile the macro and will run it through your tool.

I would like to ask you one thing that I did not try yet but saw in the manual. We can keep an ASM file when exporting to MDL. My question is: could that file (added with some placement ASM BGL macros) be compiled with BGLC_9? If the answer is yes, do you know about transparency problems when displaying objects in FSX SP2?

Many thanks and congratulations for this "professional" tool,

Regards,

Luis
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Luis,

I only tried to import a SCM macro and the tool asked me to enter 4 values for variables. I was in doubt as to what supply:

1) would it be the %1 %2 %3 ... macro parameters?
2) would it be Some UVar() used in the macro for math calculations before any code is written?
3) or will it be variables actually used in SCASM commands?

I think it is 3) as I had 4 references in the drawing code. So tomorrow I will compile/decompile the macro and will run it through your tool.

It is option 1. The number of four comes from the fact that in API macros there are four variables dedicated as user variables (%6 till %9), it are these that you can provide.

Now that you ask, I realize that in SCM macros there is no such limitation. So the form should probably offer more inputs in your case. If I remember correctly in SCM macros there is a header that defines which variable is what, while in API macros that is predefined.

I would like to ask you one thing that I did not try yet but saw in the manual. We can keep an ASM file when exporting to MDL. My question is: could that file (added with some placement ASM BGL macros) be compiled with BGLC_9? If the answer is yes, do you know about transparency problems when displaying objects in FSX SP2?

When working for FSX the normal approach would be to compile the MDL with XtoMDL and then place it with XML code and BGLComp. The ASM files are only kept if you use the FS2004 MakeMDL to compile.

To be able to do the placement in the same ASM you would even have to use the FS2002 MakeMDL (I never tried if that works with ModelConverterX). But since the purpose of the tool is to convert to FSX standards, I would not advice this approach :).

When you compile with the FSX SDK tools I think there should not be transparancy problems, that mainly happens when using old code.
 

Luis_Sá

Resource contributor
Messages
326
Country
portugal
Hi Arno,

I understand. You assume APIs where the standard was indeed as follows:

Code:
;   %1  Latitude
;   %2  Longitude
;   %3  Range 
;   %4  Scale
;   %5  Heading
;   %6  User
;   %7  User 
;   %8  User
;   %9  Shadow
;  %10  V1 value
;  %11  Elevation
;  %12  Scenery complexity

For ASD macros one could freely choose the macro parameters as in this example:

Code:
;ASDesign Compatible Macro
;Name=Fence_green, Type=General Objects, Bitmap=fence_green.jpg, \
;Latitude, Longitude, Range=30, \
;Density=2, Visibility=10000, Elevation=0, Rotation=0, \
;Scale=1, Width=2, Height=2, Length=20, Texture=fence_green.bmp, \

;   Fence using selectable texture

;   Author: Luis Vieira de Sa 
;   Texture: Luis Feliz-Tirado
;
;   Macro Parameters:
;   1 = latitude
;   2 = longitude
;   3 = range
;   4 = scenery complexity ( 0 ... 5 )
;   5 = visibility (in meters)
;   6 = elevation
;   7 = rotation
;   8 = scale
;   9 = width  (not used, except for footprint)
;  10 = height
;  11 = length
;  12 = texture


UVar( $V2 int[%11] )

UVar( $H0 0 )    ; ground
UVar( $H1 %10 )	 ; height	


UVar( $WN [ -0.5 * %11 ] )   ; negative
UVar( $WP [  0.5 * %11 ] )   ; positive

; each section of the fence will have a 2:1 ratio (width:height)
Uvar( $Tiling int[ (%11 / %10 / 2) + 0.5 ] )

; now form the Texture Mapping value
UVar( $T [$Tiling] )

; add 5 pixels to repeat the post at the right end
UVar( $T [$T + (5 / 256)] )


Area( 5  %1 %2  %3 )
IfVarRange( : 346 %4 5 )
PerspectiveCall( :pcall )
Jump( : )
:pcall
mif( %6 )
	RefPoint(  abs  :return  %8 %1 %2  v1= %5  E= %6  v2= [$V2]   )
melse
	RefPoint(  rel  :return  %8 %1 %2  v1= %5  v2= [$V2]  )
mifend
RotatedCall( :start 0 0 [%7 + 90] )
:return
Return
:start
BGLVersion( 0800 )
TextureList( 0
    6 FF 255 255 255 0 50.0 "%12"
    )
MaterialList( 0
    0.75 0.75 0.75 1.00  0.25 0.25 0.25 1.00   0 0 0 1.00   0 0 0 1.00 0 )
VertexList( 0
    [$WN] [$H1] 0  0 0 -1  0 1
    [$WN] [$H0] 0  0 0 -1  0 0
    [$WP] [$H0] 0  0 0 -1  [$T] 0
    [$WP] [$H1] 0  0 0 -1  [$T] 1
    [$WP] [$H1] 0  0 0  1  [$T] 1
    [$WP] [$H0] 0  0 0  1  [$T] 0
    [$WN] [$H0] 0  0 0  1  0 0
    [$WN] [$H1] 0  0 0  1  0 1
   )
SetMaterial( 0 0 )
DrawTriList( 0
    0 1 2
    0 2 3
    4 5 6
    4 6 7
    )
EndVersion
Return
EndA

If you look to the VertexList you see a reference to [$WN] which in turn depends on parameter %11 through

Code:
UVar( $WN [ -0.5 * %11 ] )   ; negative

If a user wants to convert the macro into a FSX Library Object the best way would be to place it and decompile it back in order to get a clean input (without variables) to your ModelConverter.

You say: "To be able to do the placement in the same ASM you would even have to use the FS2002 MakeMDL".

I never used MakeMDL so excuse me if ask something that may be obvious, but MakeMDL also takes ASM files as input? I thought it could be only used from inside gmax or in a command line to compile a x file.

In my question on the previous post I was attempting to place an object without going through the "MDL phase". I will rephrase my concern hoping that you (or someone else) can give me a tip or say a definitive "no way to achieve". I agree that that the "FSX way" to put objects in the sim is to get a MDL and than use FSX's BGLComp for placing it. However this is, in certain way, a limitation. In fact I can only customize the "placement". I can customize lat, lon, alt, pitch, bank, heading, complexity, scale and AGL (I think I did not miss any parameter). The model, the MDL, is fixed. As per the example code above you will guess that I am looking for ways to produce fences. If we take a fence section in its simpler form we can think of 4 parameters: length, height, texture and heading. Only the last one is customizable as it is fixed in the XML placement file. The first 3 parameters are coded in the MDL. I could have a set of MDLs with different textures and solve the problem for that particular parameter. Same for height. With difficulty I can have several MDLs for all the possible lengths.

On the contrary if I have the fence in ASM format, I can have variables for length, height and texture. Before compiling I would just need to fill these variables with the desirable values.

As far as I read in this site BGLC_9.EXE will take an ASM and can produce a BGL or a MDL. I assume by adding "placement BGL codes" into the ASM before compiling it with BGLC_9.EXE like the ones I found in the house.asm example from the FS8 SDK

Code:
; DATABASE HEADER *******************************************
DATABASE_HEADER:
	dw	0001			; 00 World set number
	dd	0004FB2EAH		; 02 North bound (N  47 00'  0.3203'')
	dd	0004FB2D6H		; 06 South bound (N  46 59' 59.6725'')
	dd	0EFA4FA50H		; 10 East bound (W  22 59' 59.9998'')
	dd	0EFA4FA4EH		; 14 West bound (W  23 00'  0.0004'')
	dd	0			; 18 VOR DATA pointer
	dw	0			; 22 Lowest VOR channel (108.00 MHz)
	dw	0			; 24 Highest VOR channel (108.00 MHz)
	dd	0			; 26 Seed level 8 pointer
	dd	0			; 30 Seed level 9 pointer
	dd	0			; 34 Seed level 10 pointer
	dd	0			; 38 Seed level 11 pointer
	dd	0			; 42 Seed level 12 pointer
	dd	0			; 46 Seed level 13 pointer
	dd	0			; 50 Seed level 14 pointer
	dd	0			; 54 Seed level 15 pointer
	dd	(offset OBJECT_DATA) - (offset DATABASE_HEADER)		; 58 OBJECT DATA pointer
	dd	0			; 62 LIBRARY DATA pointer
	dd	0			; 66 FACILITY DATA pointer
	dd	0			; 70 Old Anchor Point
	dd	0			; 74 COM RADIO DATA pointer
	dd	0			; 78 ADF RADIO DATA pointer
	dd	0			; 82 DYNAMIC OBJECT DATA pointer
	dw	0			; 86 Library minimum 1
	dw	0			; 88 Library minimum 2
	dw	0			; 90 Library minimum 3
	dw	0			; 92 Library minimum 4
	dw	0			; 94 Library maximum 1
	dw	0			; 96 Library maximum 2
	dw	0			; 98 Library maximum 3
	dw	0			; 100 Library maximum 4
	dd	0			; 102 (0x66) MISCELANEOUS DATA pointer
	dd	0			; 106 (0x6A) TITLE & DESC. DATA pointer
	dd	0			; 110 (0x6E) MAG. VAR. DATA pointer
	dd	0			; 114 (0x72) EXCEPTION DATA pointer
	dd	000000000h		; 118 (0x76) Magic Number
	dd	000000000h		; 122 (0x7A) Spare2 (32 bits)
	dw	0000h			; 126 (0x7E) Spare3 (16 bits)


; OBJECT DATA *********************************************** 00000080
OBJECT_DATA:
	LATBAND_START
	LATBAND_REL	027D9H,027DAH,OBJ_00008A	; N 46 59 53 N 47 00 09
	LATBAND_END

OBJ_00008A:
; OBJECT_1	Object Start = 0000008AH, Size = 00001852H, End = 000018DCH
	NEAR_FAR_HUGE_OBJECT_HEADER	0004FB2E0H, 0EFA4FA4FH, Object_1_End
	IFIN1		Label_Obj_1_32, image_complex, 2, 32767
	ADDOBJ		Label_Obj_1_38	;(offset 14)
	SHADOW_CALL	Label_Obj_1_38

Label_Obj_1_32:	;(0x000000aa)
	BGL_JUMP_32	Object_1_End

Label_Obj_1_38:	;(0x000000b0)
	SCALE_AGL	Label_Obj_1_80, 10000, 11, 131072, 0004FB2E0H, 7282, 0EFA4FA4FH, -23302, 0, 0	; (N 46 59 60 W 23 00 00)
	INSTANCE_CALL	Label_Obj_1_82, 00000h, 00000h, 0471ch
........................ etc ..........

the BGL that I will end up can be directly usable. Or not? :confused:

If I want to follow the "FSX way to do things" and noting that I want to start with a line in SBuilderX and end up with a fence, I would need to create a MDL for each fence section giving the points, the texture that I set through the SBuilderX interface. I do not know of such a tool. That the reason way I am trying to explore the possibility of using BGLC_9/ASM.

Sorry for this long post (and, may be, for being out of topic).

Best Regards,

Luis

EDITED AFTER SOME EXPERIMENTATION: I completely mixed things. The placement that I was referring to is FS8!!! So I really need to created a MDL and then use XML placement! And I said " ...I do not know of such a tool". The tool is clearly BGLC_9. I compiled my ASD macro and then I dissambled it with BGL_Analyse getting a SCA file. ModelConverterX imported that SCA. I exported and got the ASM. Now what I have to do when I need to compile is fill that basic ASM with the data that I need and then BGLC_9 followed by BGLComp.
 
Last edited:

Luis_Sá

Resource contributor
Messages
326
Country
portugal
Hello,

The fence.scm in my previous post produces the same results: (i) if placed with SCASM (ii) if converted to a FS9 MDL model with ModelConverterX followed by FS9 BGLComp (iii) or if the ASM is converted to a BGL with BGLC_9. In all cases the transparent parts of the DXT1 texture are not painted, as expected, but, unfortunately, update the Z-buffer. Therefore we only see the ground on the other side of the fence. If there is an object on the other side, it will be cut.

Of course, as explained in several posts in this site, the FSX MDL model produces the required transparency. Unfortunately I can not get an ASM file in this case. Therefore I started to look into the FSX MDL format (but I do not feel that I will be able to make FSX MDL files directly from SBuilderX). I will study the X file that ModelConverterX produces. May be I will be able to generate them for my simple model requirement (a rectangular fence). Any pointer for a basic introduction to X file format will be much appreciated.

Arno: 2 notes about ModelConverterX. The only way I found to exit the programme is to click on the "X" on the top right of the main form. But when I do that I get a crash. The 2nd note: where should be located the textures that the model requires so that the preview gets them=

Kind Regards,

Luis
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Luis,

If you are working for FSX, I would not try to use the FS2004 MDL format for your fences. Using the FSX format and the FSX material settings is much better.

As you say there is no ASM format for them. You'll just have to make the MDL file and then place it with XML code. There is no intermediate format, like the ASM files, available for tweaking.

Why do you want to have those intermediate files? I am not sure if I understand that now.

The only way I found to exit the programme is to click on the "X" on the top right of the main form. But when I do that I get a crash.

Can you give me the details of the crash? I have seen it on my computer at work as well, but I can't reproduce the problem at home. So that makes it very hard to debug it.

The 2nd note: where should be located the textures that the model requires so that the preview gets them

On the options tab there are the texture loader settings. In there the search path for the textures is defined. You can add additional folders to it if needed.
 

Luis_Sá

Resource contributor
Messages
326
Country
portugal
Hello Arno,

Why do you want to have those intermediate files? I am not sure if I understand that now.

I want to draw a line with many points in SBuilderX and then give it the property of "being a fence with posts on the vertices". The location of the points is arbritary and so I can not use a "fixed" FSX library to use. On the contrary I need to generate, on the fly, the FSX MDL. I am reading about the X file format and it seems that I will be able to achieve that.

Can you give me the details of the crash? I have seen it on my computer at work as well, but I can't reproduce the problem at home. So that makes it very hard to debug it.

If I start ModelConverterX and close it right away it exits without error. If I start ModelConverterX and import the attached SCA and close it when the import finishes I get the crash shown on the attached GIF.

Regards,

Luis

Edited to add a question: I am playing with the SCA that I attached. It is a rectangular fence painted both sides. In SCASM it is coded with 8 points (4 locations with opposite normals) and 4 triangles. In the X file that translates to 12 points and each point only apperas once in the traingle list. Is this a requirement of for the X file? I will try to find the answer by editing the X file.
 

Attachments

  • Image1.zip
    19.7 KB · Views: 296
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Luis,

I want to draw a line with many points in SBuilderX and then give it the property of "being a fence with posts on the vertices". The location of the points is arbritary and so I can not use a "fixed" FSX library to use. On the contrary I need to generate, on the fly, the FSX MDL. I am reading about the X file format and it seems that I will be able to achieve that.

Yes, I think in that case making the MDL object on the fly is the only option for you. The SDK also has some information on the X file format that you might find useful.

If I start ModelConverterX and close it right away it exits without error. If I start ModelConverterX and import the attached SCA and close it when the import finishes I get the crash shown on the attached GIF.

Thanks, that the same problem I have at work. Looks like something goes wrong after the OpenGL preview has been initialized. But since I can not reproduce the problem on my development machine, it is hard to figure out which part of the code causes it.

I am playing with the SCA that I attached. It is a rectangular fence painted both sides. In SCASM it is coded with 8 points (4 locations with opposite normals) and 4 triangles. In the X file that translates to 12 points and each point only apperas once in the traingle list. Is this a requirement of for the X file? I will try to find the answer by editing the X file.

No, that in the tool. But XtoMDL will optimize this away, so I was just lazy in this case. But it is something I want to improve in the future.
 
Messages
7,450
Country
us-illinois
Hello:

I don't know if this is directly related, but on my FS computer I am unable to get ModelConverterX to render the 3D preview unless I go into the ATI Catalyst Control Center in Advanced mode for my ATI video card drivers and check the box under "OpenGL Settings" to enable "Triple Buffering".


It seems like most folks nowadays are using NVidia cards, but I would wonder if there is a comparable NVidia driver setting which needs to be enabled for full functionality in ModelConverterX that might explain variable results on differing system hardware?

Hope this helps! :)

GaryGB
 
Last edited:
Top