March 28, 2024, 11:30:32 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


3D object viewer - works, but looking for help improving

Started by Guilect, August 13, 2008, 05:24:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Guilect

Hi gang,

I have modified Zumwalt's 3D example to be able to simply load, display, and move around the 3D object types that EBASIC uses.

It works, but needs some improvements with the help of the community.

1.)  If, for example, I load the park.3ds object that comes with the EBASIC examples, it is not light correctly.
Yet I think the code is cut and paste from Zumwalt's example.  Any ideas?

2.)  If I try loading some of the dozens of other .3ds files that I own, only about 1/3 of them load correctly.
The remaining majority tend to crash the program.  Yet these same .3ds files load fine in other programs.
Any ideas here?

3.)  Loading time can be painfully slow.  If I load a large .3ds file in EBASIC it can take literally minutes before it is displayed.
Yet in other programs (modellers, other programming languages) they will load in a few seconds.

4.) My program does not seem able to sucessfully display .md2 object.
Suggestions?

' 3D object viewer.
'based on Zumwalt's example

'A simple test of the DirectX 9 engine.
'Arrow keys to move camera.
'PgUp/PgDn to pan up and down.
'Z and X to rotate on Z axis.
CONST DIK_UP = 0xC8 /* UpArrow on arrow keypad */
CONST DIK_PRIOR = 0xC9 /* PgUp on arrow keypad */
CONST DIK_LEFT = 0xCB /* LeftArrow on arrow keypad */
CONST DIK_RIGHT = 0xCD /* RightArrow on arrow keypad */
CONST DIK_END = 0xCF /* End on arrow keypad */
CONST DIK_DOWN = 0xD0 /* DownArrow on arrow keypad */
CONST DIK_NEXT = 0xD1 /* PgDn on arrow keypad */
CONST DIK_Z =              0x2C
CONST DIK_X =              0x2D
CONST DIK_R =              0x13
CONST DIK_ESCAPE =         0x01
CONST DIK_1 = 0x02
CONST DIK_2 = 0x03
CONST DIK_3 = 0x04

Def filename:STRING
Def filter : STRING


DEF w1 as WINDOW
OPENWINDOW w1,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"Simple Window",&main
BEGINMENU w1
    MENUTITLE "File"
        MENUITEM "Open", 0, 1
        MENUITEM "Quit", 0, 2
ENDMENU

C3DScreen s
C3DCamera c
C3DMesh m
C3DObject scene
C3DLight light

float fadjust,fTarget
'target 60FPS for camera movement
fTarget = 1.0f / /*FPS*/60.0f * 1000.0f
fAdjust = 1.0f

s.CreateWindowed(0,0,640,480,@NOCAPTION,"",w1,false,0)
c.Create(s)
c.Position(0,0,-8)
c.Orient(0,0,1,0,1,0)
c.SetBackPlane(500)

s.Clear(RGBA(0,0,0,255))
s.BeginScene(c)
s.RenderText(0,10,"Select file...",RGBA(255,255,0,255))
s.RenderScene()

WAITUNTIL w1 = 0
END

SUB main
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
    CASE @IDCLOSEWINDOW
        REM closes the window and sets w1 = 0
        CLOSEWINDOW w1
    CASE @IDMENUPICK
        SELECT @MENUNUM
            CASE 1: ' user selected Open
                loadfile()
            CASE 2: ' user selected Quit
                CLOSEWINDOW w1
        ENDSELECT
ENDSELECT
RETURN
ENDSUB

sub loadfile()
filter = "DirectX (*.x)|*.x|3DS (*.3ds)|*.3ds|MD2 (*.md2)|*.md2|All Files (*.*)|*.*|"
filename = filerequest("Select 3D Model",0,1,filter)

IF filename = "" then RETURN
Dim ext$ : STRING
Dim pos:INT
pos = Instr(filename, ".")
ext$= mid$(filename, pos)

Select LCASE$(ext$)
Case ".3ds"

If m.Load3DS(s,filename,FALSE)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF
Case ".x"
If m.LoadX(s,filename)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF
Case ".md2"
filter = "Graphic files (*.bmp)|*.bmp|All (*.*)|*.*"
dim tex:STRING
tex = filerequest("Select texture",0,1,filter)
if tex = "" then RETURN

If m.Loadmd2(s,filename,tex)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF

DEFAULT
MESSAGEBOX w1, "Could not load " + filename, "Unknown file type"
ENDSELECT

SETCAPTION w1, filename

scene.free()
viewmodel()

ENDSUB

sub viewmodel()
m.Position(0,0,0)
m.scale(.015,.015,.015)
m.EnableLighting(true)
m.UseVertexColor(true)
c.LookAt(0,0,0)

m.EnableLighting(true)
m.UseVertexColor(true)

light.Create(s,LIGHT_POINT,1)
light.Position(0,20,-150)
light.SetAttenuation(0,1/200.0,0)
light.SetSpecular(.5,.5,.5,1)
light.SetAmbient(.4,.4,.4,1)

scene.CreateScene(s)
scene.AddChild(light)
scene.AddChild(m)

do
'check for keys and move camera accordingly
IF KeyDown(DIK_UP) then _
c.Move(0.0f,.15f * fAdjust)
IF KeyDown(DIK_DOWN) then _
c.Move(0.0f,-.15f * fAdjust)
IF KeyDown(DIK_RIGHT) then _
c.Rotate(1*.01745 * fAdjust,0,0)
IF KeyDown(DIK_LEFT) then _
c.Rotate(-1*.01745 * fAdjust,0,0)
IF KeyDown(DIK_Z) then _
c.Rotate(0,0,-1 *.01745 * fAdjust)
IF KeyDown(DIK_X) then _
c.Rotate(0,0,1 *.01745 * fAdjust)
IF KeyDown(DIK_PRIOR) then _
c.Rotate(0,-1 *.01745 * fAdjust,0)
IF KeyDown(DIK_NEXT) then _
c.Rotate(0,1 *.01745 * fAdjust,0)
IF KeyDown(DIK_R) then _
c.LookAt(0,0,0)

s.Clear(RGBA(0,0,0,255))
s.BeginScene(c)
s.RenderText(0,10,"use keys:up, down, left, right, z, x, r, pageup, pagedown",RGBA(255,255,0,255))
scene.Draw()
s.RenderScene()

until w1 = 0
Scene.Free()

ENDSUB

RG

I had the same problem of many .3ds files not loading. When I changed this line from:

If m.Load3DS(s,filename,FALSE)

to

If m.Load3DS(s,filename,true)

All the files I tried would open, even some very complex ones.

The objects showed up very white with just a hint of shading. That indicates the light is too bright. I find it hard to set lighting in Ebasic - just have to use trial and error until you get it. Here's what I finally found worked:

light.Position(0,20,-500)  --> moved the light further away from the object
light.SetAttenuation(0,1/20.0,0) --> made the light less intense when it reached the object


Hope this helps you.

Rich

[Edited 8/18: Further down you can find modified code that allows you to easily test different light distance and intensity using scroll bars.]

Guilect

Hi Rich,

yes, your suggestions helped.

The lighting settings you recommended fixed the park 3ds model from being washed out from too much light.

The flag of true on the load3ds command also helped, but not completely.
With the flag set to true I can now load about 1/2 of my models.
Alas, 1/2 still can not be loaded by EBASIC.

Thanks.

barry

I think the single most valuable thing that could be added to EBasic is a simpe beginner's 3D tutorial; whether from Paul or from a user.  I'd like to play with it but I don't understand a lot of what I run into and things don't work the way I think they should and I have no idea why.

I've mentioned this before and the answer has always been that all the info is there or on the web and all I have to do is dig it out and from what I've seen that's probably true.  But I'd like to just play and I don't have any interest in spending upteen hours learning all the ins and outs of 3D and DX just to be able to play a little.  My hope and guess is that I'm not alone in this.

Barry

Ionic Wind Support Team

Barry,
The thing is, and I think you've taken me the wrong way, is I don't think I could write a "simple" 3D tutorial.  3D isn't simple, there is a lot of math involved at the lower levels, and so many object formats out there that it would be a bit of an undertaking.  I am sure there are users here that spend a lot more time writing 3D aps then I do, who could probably write a better tutorial.

I wrote the .3ds loader according to specification I found on the net.  The 'true' parameter in the Load3DS(s,filename,true) method separates multiple meshes in a .3ds file into a hierarchy, instead of loading in one big mesh, which is required by many .3ds objects.  Many .3ds objects scaling is just totally out of whack, and I have tried to compensate here and there in the loading code, but it isn't perfect in any sense of the word.  There are many 3ds meshes that you will need to adjust the scaling just to get them down to a reasonable size. I will go through the loading code again when I get time and see if I can spot the crash.

Quote
I've mentioned this before and the answer has always been that all the info is there or on the web and all I have to do is dig it out and from what I've seen that's probably true.  But I'd like to just play and I don't have any interest in spending upteen hours learning all the ins and outs of 3D and DX just to be able to play a little.

I was probably the one that told you that. If you just want to experiment then you are probably better off playing with Creative BASIC and its retained mode 3D interface.  When I started the 3D library, many years ago, I knew nothing about DX9 and had to go through months of reading, bought a few books, etc. just to get the knowledge necessary to make DX9 a little easier for users.  Of course the best source of DX9 information was the SDK docs from Microsoft.  Things like lighting are well documented there, and 3D library wraps the lighting methods almost directly. 

If something doesn't work the way you expect then this is the place to ask about it.  And if I know the answer I'll be the first to chime in.  In many cases there are questions asked that I don't have an immediate answer for, especially when it works on my machine and not yours. 

Paul.

Ionic Wind Support Team

RG

I've been involved with writing 3D modelers since 2000, almost all using .obj format. I also have used about a dozen different 3D modelers (from free to pricey). 3D file formats can be all over the map with all sorts of options, so I'm not surprised that some open and others don't. Some modelers also produce models with reversed normals - in that case, the model might have loaded but not be visible because the defined face points away from you.

You can search google and find descriptions for all the common formats. I like .obj as it's common to hobbist 3D and is a text file which is easy to read in notepad to see how it is structured.

Barry, are you interested in making meshes yourself or loading already made models? A big difference in what you need to know between the two.

Rich

barry

Paul, maybe you're not the one to write such a tutorial but that doesn't change the fact that it's needed.

I have played with Creative Basic's 3D a little and I was able to get that going more easily, but I still didn't get very far.  Also I was using Ebasic for everything else and it was confusing going back and forth.  I'd done almost no programming till a few months before I got involved with Ibasic, for over a decade, having retired about 1996, and it's hard getting back into it after being that rusty.  I realize that isn't your problem and I'm not trying to make it your problem.  But that's why I keep getting stuck.  A new language, or two new languages, and 3D is new to me, and what little math I've had was many decades ago, in the 50s and 60s.

My situation is probably a bit unusual but I don't think it's unusual that people with no experience want to dabble in 3D programming and I think that, unless they're highly motivated, they're going to find that they can't.

Actually my suggestion wasn't as much for my benefit, since I'm off doing other stuff now and I'll probably stay there, but because, having tried it, I've seen the need for something to help get people started.  It's something that I think is needed for Ebasic.

I think you can see that for yourself if you look at the forums here.  All the forums for EBasic (I don't know about the others) get into a lot of different areas, some introductory and some pretty technical and in-depth.  But the few discussions in the 3D forum are almost always about either getting started or something just a little beyond that.

It may be that 3D just isn't that important to the future of Ebasic.  I can't judge that and that's probably a reasonable position.  But if it is important think it needs a chance to be useful.

Barry

Ionic Wind Support Team

Barry,
True.  But with only 748 forum members, and only a small percentage of those doing 3D programming, it will be a while before the posts start to fill up.  Of course 2D/3D are important for Emergence BASIC, Aurora and Creative, but it is not their primary focus.  When I decided that the 2D/3D had to be built in, not just wrapping another engine like a lot of languages, I knew it would be a great undertaking, and it will be evolving as time goes by, and more users start experimenting.

When you think about it, it does make our languages somewhat unique.  Our languages are all-around general purpose compilers suitable for pretty much any development project.  There are others that make 3D simpler, but they fail in general application development.  Blitz3D is one hell of a 3D language, but for building a business application?, and it is dying a slow and painful death.  PureBASIC wraps the Ogre library, which you could also use from either Aurora or Emergence.  Darkbasic has major problems. PowerBASIC isn't even a contender since it has no built in 2D or 3D capabilities. BlitzMax has no 3D engine yet, although Mark has been working hard on the GL library but users are estimating it will probably be Christmas 2009 before he's finished.

Microsofts offerings?  Well you can use C#/ C++ with an existing 3D library or DirectX coding directly...yuck. 

So keep patient, ask the questions you need to ask, and we'll jump in to help as needed.

Paul.
Ionic Wind Support Team

RG

Guilect,

I modified your code by adding in two controls to set the light distance and intensity. This lets folks play around with the settings by adjusting scroll bars. Hope you don't mind.

Rich


' 3D object viewer.
'based on Zumwalt's example

'A simple test of the DirectX 9 engine.
'Arrow keys to move camera.
'PgUp/PgDn to pan up and down.
'Z and X to rotate on Z axis.
CONST DIK_UP = 0xC8 /* UpArrow on arrow keypad */
CONST DIK_PRIOR = 0xC9 /* PgUp on arrow keypad */
CONST DIK_LEFT = 0xCB /* LeftArrow on arrow keypad */
CONST DIK_RIGHT = 0xCD /* RightArrow on arrow keypad */
CONST DIK_END = 0xCF /* End on arrow keypad */
CONST DIK_DOWN = 0xD0 /* DownArrow on arrow keypad */
CONST DIK_NEXT = 0xD1 /* PgDn on arrow keypad */
CONST DIK_Z =              0x2C
CONST DIK_X =              0x2D
CONST DIK_R =              0x13
CONST DIK_ESCAPE =         0x01
CONST DIK_1 = 0x02
CONST DIK_2 = 0x03
CONST DIK_3 = 0x04

Def filename:STRING
Def filter : STRING
DEF w1, controls as WINDOW

OPENWINDOW w1,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"Simple Window",&main
BEGINMENU w1
    MENUTITLE "File"
        MENUITEM "Open", 0, 1
        MENUITEM "Quit", 0, 2
ENDMENU

DEF light_distance as INT
DEF light_intensity as FLOAT

light_distance=500
light_intensity=20

OPENWINDOW controls,0,0,300,300,@MINBOX|@MAXBOX|@SIZE,0,"Controls",&main
control controls,@static,"",6,20,300,20,0x50008000,103
setcontroltext controls,103,"Light Distance:"
setcontrolcolor controls,103,rgb(0,0,0),rgb(255,255,255)
control controls,@ScrollBar,"",6,45,101,16,0x50000000,1
control controls,@Edit,"Edit1",130,44,70,20,0x50800800,2
setscrollrange controls,1,1,1000 
setscrollpos controls,1,light_distance 
setcontroltext controls,2,str$(light_distance) 

control controls,@static,"",6,75,370,20,0x50008000,104
setcontroltext controls,104,"Light Intensity:"
setcontrolcolor controls,104,rgb(0,0,0),rgb(255,255,255)
control controls,@ScrollBar,"",6,100,101,16,0x50000000,8
control controls,@Edit,"Edit2",130,99,70,20,0x50800800,9
setscrollrange controls,8,2,200 
setscrollpos controls,8,light_intensity 
setcontroltext controls,9,str$(light_intensity)


C3DScreen s
C3DCamera c
C3DMesh m
C3DObject scene
C3DLight light

float fadjust,fTarget
'target 60FPS for camera movement
fTarget = 1.0f / /*FPS*/60.0f * 1000.0f
fAdjust = 0.1f

s.CreateWindowed(0,0,640,480,@NOCAPTION,"",w1,false,0)
c.Create(s)
c.Position(0,0,-8)
c.Orient(0,0,1,0,1,0)
c.SetBackPlane(500)

s.Clear(RGBA(0,0,0,255))
s.BeginScene(c)
s.RenderText(0,10,"Select file...",RGBA(255,255,0,255))
s.RenderScene()

WAITUNTIL w1 = 0
END

SUB main
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
    CASE @IDCLOSEWINDOW
        REM closes the window and sets w1 = 0
        CLOSEWINDOW w1
    CASE @IDMENUPICK
        SELECT @MENUNUM
            CASE 1: ' user selected Open
                loadfile()
            CASE 2: ' user selected Quit
                CLOSEWINDOW w1
        ENDSELECT
case @idhscroll   
select @code 
case @sbthumbpos:case @sbthumbtrack 
setscrollpos controls,@controlid,@qual 
case @sblineleft   
setscrollpos controls,@controlid,(getscrollpos(controls,@controlid)-1)
case @sblineright   
setscrollpos controls,@controlid,(getscrollpos(controls,@controlid)+1) 
case @sbpageleft   
setscrollpos controls,@controlid,(getscrollpos(controls,@controlid)-5) 
case @sbpageright   
setscrollpos controls,@controlid,(getscrollpos(controls,@controlid)+5) 
endselect
light_distance= getscrollpos(controls,1)
light_intensity= getscrollpos(controls,8)
setcontroltext controls,2,str$(light_distance)
setcontroltext controls,9,str$(light_intensity)
light.Position(0,20,-light_distance)
light.SetAttenuation(0,1/light_intensity,0)
ENDSELECT
RETURN
ENDSUB

sub loadfile()
filter = "3DS (*.3ds)|*.3ds|DirectX (*.x)|*.x|MD2 (*.md2)|*.md2|All Files (*.*)|*.*|"
filename = filerequest("Select 3D Model",0,1,filter)

IF filename = "" then RETURN
Dim ext$ : STRING
Dim pos:INT
pos = Instr(filename, ".")
ext$= mid$(filename, pos)

Select LCASE$(ext$)
Case ".3ds"

If m.Load3DS(s,filename,TRUE)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF
Case ".x"
If m.LoadX(s,filename)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF
Case ".md2"
filter = "Graphic files (*.bmp)|*.bmp|All (*.*)|*.*"
dim tex:STRING
tex = filerequest("Select texture",0,1,filter)
if tex = "" then RETURN

If m.Loadmd2(s,filename,tex)
ELSE
MESSAGEBOX w1, "Could not load " + filename, "Error"
ENDIF

DEFAULT
MESSAGEBOX w1, "Could not load " + filename, "Unknown file type"
ENDSELECT

SETCAPTION w1, filename

scene.free()
viewmodel()

ENDSUB

sub viewmodel()
m.Position(0,0,0)
m.scale(.015,.015,.015)
m.EnableLighting(true)
m.UseVertexColor(true)
c.LookAt(0,0,0)

light.Create(s,LIGHT_POINT,1)
light.Position(0,20,-light_distance)
light.SetAttenuation(0,1/flt(light_intensity),0)
light.SetSpecular(.5,.5,.5,1)
light.SetAmbient(.4,.4,.4,1)

scene.CreateScene(s)
scene.AddChild(light)
scene.AddChild(m)

do
'check for keys and move camera accordingly
IF KeyDown(DIK_UP) then _
c.Move(0.0f,.15f * fAdjust)
IF KeyDown(DIK_DOWN) then _
c.Move(0.0f,-.15f * fAdjust)
IF KeyDown(DIK_RIGHT) then _
c.Rotate(1*.01745 * fAdjust,0,0)
IF KeyDown(DIK_LEFT) then _
c.Rotate(-1*.01745 * fAdjust,0,0)
IF KeyDown(DIK_Z) then _
c.Rotate(0,0,-1 *.01745 * fAdjust)
IF KeyDown(DIK_X) then _
c.Rotate(0,0,1 *.01745 * fAdjust)
IF KeyDown(DIK_PRIOR) then _
c.Rotate(0,-1 *.01745 * fAdjust,0)
IF KeyDown(DIK_NEXT) then _
c.Rotate(0,1 *.01745 * fAdjust,0)
IF KeyDown(DIK_R) then _
c.LookAt(0,0,0)

s.Clear(RGBA(0,0,0,255))
s.BeginScene(c)
s.RenderText(0,10,"use keys:up, down, left, right, z, x, r, pageup, pagedown",RGBA(255,255,0,255))
scene.Draw()
s.RenderScene()

until w1 = 0
Scene.Free()

ENDSUB

barry

Quote from: Paul Turley on August 17, 2008, 10:03:48 PMWhen you think about it, it does make our languages somewhat unique.  Our languages are all-around general purpose compilers suitable for pretty much any development project.  There are others that make 3D simpler, but they fail in general application development.  Blitz3D is one hell of a 3D language, but for building a business application?, and it is dying a slow and painful death.

I agree.  The first Basic I bought when I decided to play with this was DarkBasic but 3 weeks after they got my payment they were still deciding if I was a real person and never did send it to me.  They were real happy to give me a refund.  I never did get that. :)

Then I bought Blitz3D and the 3D was indeed simple but it wasn't any fun for anything else and I don't want to just do 3D.  I also want to just use one tool and that wasn't it.

Then I got BBC Basic and Liberty Basic.  Liberty was nice and they had a good forum, which is part of the fun for me.  But I guess I wanted to feel like I was playing with a real language and it, like Blitz, seemed like a toy.  BBC Basic was really good but it was too strange.  None if this is to put those languages down.  They were all good in their way but they didn't fit me.

I also got PowerBasic and I liked it a lot but I thought it would involve a steep learning curve.  I've been learning it anyway and for GUI stuff I like it as well as EB.  Turns out that learning curve was more about Windows than about the language.  I'd never done much GUI programming before.  It's a whole new way to think and at my age learning to think new ways isn't that easy. :)

IBasic Pro was the one that did fit.   Actually my intent was to try IB Standard but the Gold CD went on sale I and got it and tried Pro and liked it a lot better.

I'm not complaining that you don't have a 3D tutorial.  I don't think you're obligated to provide that.  I'd like it and I think it would be worthwhile for you to have one so I suggested it.

I think I was born in the wrong world.  In the right world everybody would see things my way. :)

Barry

Guilect

@ Rich,

QuoteHope you don't mind
Not at all.
I asked for help in improving it, and that was definately an improvement.  :)

J B Wood (Zumwalt)

Is this thing working for you now?
Is the program crashing on the other 1/2 models or is it loading and no model shows?
If it is the latter of the two, then the model loaded, its just out of scale. move the camera around a bit, see if you see the model.

Guilect

@ Jonathan,

For the ones that load but show nothing, I have tried zooming both way in and way out.
Still I see nothing.  I understand it could have been scaling, I have loaded objects before to find out that the view
is actually right inside of the object and I have to zoom back out in order to see the object properly.

A lot of them just cause the program to immediately exit upon trying to load them.

If anyone else has some 3D models, what kind of luck are you having?

3Dpdk

I know this is an older post, but I don't get a chance to check in too often.

I am more of a 3D modeler and content author than a 3D programmer but I did write a program in Creative Basic for my fellow modelers to view all of our content models. As Paul has pointed out elsewhere, the CBasic 3D was written for earlier DirectX (6 & 7 I think). I have restarted the next version of my viewer in EBasic because the 3D in EBasic uses features from DirectX 8 & 9 and keyframe animation is easily displayed with Ebasic.

One of the things I have learned is that DirectX itself, in many cases, is responsible for crashing the host application. If your program crashes without warning or error message, just closes without a whimper, chances are it was DX that crashed the application and it was either caused by a format discrepancy in the model data file or the associated texture was either in a wrong format or wrong size for that format (such as DDS texture dimensions not being to the power of two which will crash DX in a heart beat!)

I have seen this happen with non-standard size DDS textures and even with bad texture file path notation in the model file. "//"instead of "\\" (or something similar). In the case of X files, if the X file header indicates a 32 bit floating point integer and the model data is in 64 bit ... crash!

I work only with X format models because almost all 3D authoring programs can at least import and export X files and it's the native format for DirectX and the game program we provide models for. I'm only assuming, but I imagine that Paul's routines merely convert a 3ds file to X file data, so it might be better to work in X format.

The main thing to realize, and Paul can correct me if I'm wrong, EBasic mostly passes the model data file on to DirectX "as is". Your program is responsible for determining and adjusting what scale to display the model. The problem is, as Paul pointed out, that display scales can range wildly from one model to the next even when produced with the same 3D program and by the same modeler!

The program I provide for uses an external "parameters" list for each model used in the program so all my viewer has to do is read that scale adjustment factor for that model and set the frame's scale accordingly.

One "trick" is to reset your camera or view pretty far back from the view space center every time you laod a new model. Then if you can't see the model it's probably too small and you can create a control to move the camera in, increase the "zoom" of the camera, or increase the scale of the object.

Another cause of "invisible" objects can be caused by some DXT3 and DXT4 format DDS textures, especially if the alpha channel is full of 0s (black=transparent). You can try opening the model data file (if it's in text format as apposed to binary) and remove the texture paths from the materials lists. Leave the procedural parts of the materials (color, specularity,transparency, illumination) and see if the model shows up with just the procedural coloring.

As explained, there is nothing easily explained about anything 3D! I have been modeling and animating for over 7 years and content authoring for 3. I learn new stuff every day about modeling and it took nearly a full year to learn to provide stable reliable "X" models for game content.

The best thing you could do is to learn DirectX requirements (NOT an easy task). Knowledge of DX will better help you understand what EBasic is doing with your models.

J B Wood (Zumwalt)

Hi folks, sorry I am late on responding lately, but 3Dpdk hit the nail on the head, the modeling program you are using can export out the 3d object in a DirectX format that is not totally compatible with DirectX, for instance, I created a model in Blender, exported it as DirectX and the native DirectX X mesh viewer refused to open it, crashed every time, so I used GameSpace 1.6 by caligari, and it opened it fine, so I resaved it through Caligari as a DirectX Mesh (no changes to the model, just saved it again) and the one based on Caligari's X formula worked in the DirectX X file viewer. Best bet, if it opens in the DirectX Mesh Viewer that comes with the SDK, it will open in EBasic and Aurora, otherwise, it will possibly crash.

Also as far as I am aware, the native scale to DirectX for models is in meters. So if you export all models in Meters and keep them scaled to each other via meters you should be fine.