Ok, there are a few here... I want to create a terrain demo in asm using DX8 as my renderer. I've used OpenGL before, but DX is knida different.

First, I want to know if loading a .x file is exactly the same thing as me creating an array of vertexes on my own.

Second, I want to know the best way to display like 10,000 polys of terrain, and preferably, I would like it able to be deformed.

Third, do I have to use the .x format for small objects such as trees? On some of the trees I want to use multi-texturing to make them look good up close, and I don't know if I can have more than 2 uv coords in a .x format.

Fourth, what is the OBSOLUTE fastest way to display large amounts of polys on the screen?

I have more but I can't remember them, so I will ask them later.
Posted on 2001-08-21 22:50:01 by Kenny
hey fella, Id love to help you out but Im still learning myself ;)
Its too bad that people are reluctant to help with things like that.. at least to point you in the right direction.. I know they are working hard at translating the DirectX8 headers+libraries and examples from the SDK, so you should look around the forum for all that.. Like I say Id help out if I could but first off Im a newbie too and second I dont have DX8 Im still with 7 (DAMN THOSE SIMS!) yup so I cant even begin to play with DX8 or anything that needs it right now.. ah well sorry I cant be of much help
Posted on 2001-08-22 17:37:25 by closed_casket
I'm still reading the documentation. Scronty's page is the best starting point, and when he pulls himself away from his coding, he might be able to give some insight based on his experience.
Posted on 2001-08-22 17:50:09 by bitRAKE
closed_casket

dude, those sims are backwards compatible. Everything that works in DX7 works in DX8. If it doesn't work, you have permission to shoot me.

Bitrake

I've been emailing Scronty about stuff, and he's been answering, but I figured that I would post here instead so others can read the replies. I'm sure I'm not the only person with these questions.

So, since no one really knows what their doing (besides Scronty), I decided I would figure out what I'm doing. I've almost got it, and when I do, I will post the source right here.

----------------------------

I guess the fastest way to display polygons is to do a tristrip, but since I can't figure out how to mathamatically make a solid terrain from a single tristrip, I might just plot polys. Plotting polys also allows me to do some LOD and other cool stuff to the terrain easier. I'll let you know what I find out...
Posted on 2001-08-22 18:33:52 by Kenny
Afternoon, all.

bitRake - Where'd you get the idea that I was experienced? I'm just throwing stones(bits of code) at the brick wall(Directx8), and waiting for it to collapse. I'm still a newbie like most people here.:grin:

I haven't even found out the answers to the questions which Kenny has asked, yet.

However, from my current understanding (which may be incorrect):

First:
First, I want to know if loading a .x file is exactly the same thing as me creating an array of vertexes on my own.
As far as I can tell, a Mesh has it's own IndexBuffer/VertexBuffer/D3DFVF_.... That's why there are Methods which allow you to Lock/UnLock the buffers and copy the Mesh with its' FVF. An '*.x' file is a Mesh file, and a Mesh is a 'container' which holds Index/Vertex/Texture-coords/FVF information. So, in answer to the question; No. An '*.x' file(a Mesh) is not exactly the same as creating a VertexBuffer. A Mesh is more versatile, because of the extra Methods available for it. If you're just going to crete simple objects (like a cube), then use an array of vertices. If you're going to create a complicated object (100+ poly) then use a Mesh ('*.x' file).

Second:
Second, I want to know the best way to display like 10,000 polys of terrain, and preferably, I would like it able to be deformed.
Ha! I wouldn't have a clue! I'm using a CeleronIII 700 without a graphics acceleration card, so I'm quite restricted to what I throw at the screen. If you look at the larger pictures on my examples page, you'll see that the frame-rate is pretty low compared to what it should be. Of course, it doesn't help using a GDI-based font method (ID3DXFont_DrawTextA) to display the text. It really should be at about the ~700 fps mark for these low-poly objects. To display a 10000+ poly object, use a mesh and display it in the usual way. As to the deformation, are you really wanting to deform a 10000+ poly object in 'real-time'? I don't know how to do this, yet. It'll have something to do with 'Vertex Tweening' etc.

Third:
Third, do I have to use the .x format for small objects such as trees? On some of the trees I want to use multi-texturing to make them look good up close, and I don't know if I can have more than 2 uv coords in a .x format.
If you're just going to create a tree like in the 'BillBoarding' M$ P/SDK samples, then don't use a Mesh ('*.x' file). In an '*.x' file, each Material can have its' own texture. I haven't looked into using this yet. I also haven't checked out mipmapping, so I can't help you with regards to multi-texturing (yet).

Fourth:
Fourth, what is the OBSOLUTE fastest way to display large amounts of polys on the screen?
I don't know, yet. I currently concerned with getting Directx8 examples up and running. That's why I haven't been so worried about using the 'ID3DXFont' object to display text. At the moment, speed is not a priority in the examples.

As a side note; I've started cleaning up the Tutorials and getting rid of Micro$ofts code in the files. I only had it in there while I was figuring out how to tranlate it correctly into Win32ASM. Would it be more useful if I left the M$ code in the files?

Cheers,
Scronty
Posted on 2001-08-22 18:43:08 by Scronty
Ok, I'm pretty determined to make the terrain deformable, but even if I can't how would I ever be able to do physics with .x? So, this is what I've decided: I'm gonna just gonna DUP 10000 triangles and then go through a loop in InitVB and setup the locations of the terrain using the fpu, and then just use DrawPrimitave and matrix transformations to fly the camera around.

Sound good? I don't think it is, but it's the best I can come up with right now. Anyways, I'm probably gonna post the source, so stick around.

Oh, and as a reply, the trees I want to be high quality, like with branches and everything, and when up close you can see the light coming through the leaves and even more up close I want the trunk of the trees and the leaves to have multitexture blending to make the detail texture appear to make the normal texture more detailed (a good example is in Serious Sam).
Posted on 2001-08-22 18:58:45 by Kenny
Scronty, you've provided more help in the posting of your code than anyone else here, when it comes to DX8. That makes you the resident Guru. :)
Posted on 2001-08-22 19:52:07 by bitRAKE
Hi Folks

I've just programmed a Starfield using pointsprites and some Blurr-FX. I followed the way the Pointsprite example in the D3D-examples goes.

But I didn't use much textures so this first answere is just a hint

At first I think You have to do some order with your textures, that means that on thousands of polygons with different textures it isn't good do do thousands of SETTEXTURES and DRAW, because setting a new texture will take some time ..!

The way to draw 3D-scenes fast is, that you tile your polyons into chunks of polygons and chunk by chunk you do this as many chunks you have:

calculation in actual chunk,
drawing the chunk,
get next chunk

I can tell you more if I have some more experience ....

Greetings, CALEB
Posted on 2001-08-23 05:13:33 by Caleb
Scronty,
If a .X model is a VertexBuffer can it be loaded with openGL? Id really like to know how to load up a Model format, (especially .MD2's!) but .X files would be nice too.. you are doing some amazing work translating all those demos and includes I will have to play with them once I get a machine with DX8 on it..

Kenny,
Well I havent been to the site myself but my freakishly sim-addicted sister says their website tells people not to install DX8 or sims wont run. Not sure if this has changed or not since then (this was a while back) but if her precious sims game doesnt load up she will kill me. I really just need my own computer, so I wont have to worry about her and her sims anymore..!
Posted on 2001-08-24 09:28:00 by closed_casket
I have sims and it works fine on DX8 :)
Posted on 2001-08-24 09:29:33 by Kenny
Oh, and the .x format is much easier to load than a md2. A .x file just consists of a text file denoting the locations of vertexes. All you have to do is write a parser, and just feed those falues right into glvertex3f. Or, you could make a macro to convert the file to a .cpp include if you want to hardcode the .x file.
Posted on 2001-08-24 09:31:47 by Kenny
Really? cool thanks I will have to try that out. Being able to load models would be very useful. What do you mean hardcore it? Im totally new so I dont know about that method and I dont even know what a parser really is..

Hmmm ok maybe Ill try installing DX8 now that you said that, if it works for you it should work for us too.. and if not I can always fix it I suppose..
Posted on 2001-08-24 11:12:21 by closed_casket
Ok, sorry for confusing you. I seem to confuse myself often. I program in C and PHP and asm, and all seem to be comepletely different, but very simmilar. What I meant is you can take your .x file and make a macro, or write a simple C program to take the vertexes and change them from .x file format to an inc file.

To parse or to make an include file, you need to know the .x format. I don't remember how the .x file goes, but states the number of vertexes and faces, and then tells all the vertex locations. (I think...)

NUMFACES 12
NUMVERTEXES 20
VERTEX 1 1.00000 -1.0000 0.00000

... until you have all of them done. What your parser will do, is when you tell it which .x file to load, it will look for 'NUMFACES' in the text by repeatedly looking though esi as you stosb, and once you find it, you delete white space and convert from ascii to data and store that data in a peice of assigned memory (malloc). Your program can then retrieve that information and plug the values into glvertex3f by just updating the pointer by the amount of bytes and moving.

my_pointer dd 0
I get back the address after the malloc and store it in malloc
mov esi, my_pointer
glvertex3f , ,
add esi, 20 ;the next vertex is 10 bytes from the last one. See structure below.


Or you can write a macro that just changes:
NUMFACES 12
to:
modelname_NUMFACES dd 12
modelname_NUMVERTEXES dd 20
modelname_VERTEX VERTEX <1, 1.0000f, -1.0000f, 0.000f>

VERTEX struct
num dd 0
x real4 0.0f
y real4 0.0f
z real4 0.0f
VERTEX ends

See kinda what I'm saying?
Posted on 2001-08-24 14:02:57 by Kenny
Afternoon, Closed_Casket.

That's an interesting idea. Using both D3D8 and OpenGL functions in the same program.:grin: .

People who are more comfortable with OpenGL can use that for most rendering, and just use the '*.x' file loading/saving functions for their objects.

Afternoon, Kenny.

The '*.x' file can be in a 'text', 'compressed', or 'binary' format. The '*.x' file loading and saving functions in D3D8 automatically loads it, no matter which format it's in.

Cheers,
Scronty
Posted on 2001-08-25 06:46:25 by Scronty
Wow scronty, so are you telling me I can use a DX8
command to load X models, and then render them in OpenGL??!
I was about to try and make a process for OpenGL to load up and display .X files, but if I can use a "loadXmodel" type command from DX wouldnt I be wasting my time?
Posted on 2001-08-25 17:56:11 by closed_casket
Afternoon, Closed_Casket.

You'll still have to transfer the vertex info in the mesh into whatever format OpenGL uses.

Cheers,
Scronty
Posted on 2001-08-25 20:46:56 by Scronty
Kenny,
Thanks for the advice.. you obviously have the process all figured out.. thats dirty man if I had it and you needed it Id put it right up for you..! But thanks I do appreciate the tips

I think someone (besides me?) needs to make some open-source ASM loading procedures for models, like .X, .Md2, halflife, quake3, etc..
Everyone needs to load up models to make their programs, and its stupid for all of us to struggle and waste time writing the same exact routine over and over. I cant see any reason why NOT to have them publicly availible, except for a childish "I know something you dont know" type attitude..which is harmful when it comes to development. if you have a routine like that sitting on your HD, its just like having a extra pencil on final exam day and not giving it to your buddy, forcing him to either cut his finger and write in blood, or fail the test.
Making commands like that availible would allow developers to spend more time on creating the models and figuring out how they interact..

Needless to say, if and when I figure out how to load any type pf models, I will be posting up the source code.. I have a few demos for loading .MD2's, halflife, and Quake3 models, but they are all in C code not ASM.. might take a while for me to translate since Im a total newbie to ASM..if anyone would like to help out that would be great.. Im hoping Im not the only one struggling with this here!
Posted on 2001-08-27 10:03:56 by closed_casket
I think I might have found some useful information at Nehe's

http://nehe.gamedev.net/gametutorials/lesson04.asp

tells you how to load up .md2's and more..I really want to convert this to MASM so I can use these model types.. once I figure out how Ill put up the code if anyone wants to use it..
Posted on 2001-08-29 16:16:36 by closed_casket
Kenny

there are programs like: Crossroads and Win3D thar can export a .x file into a C source code or a raw text format

i gues you can process or include those files ;)

But i think i whould do my own 3D format after a while if i was makeing a 3D game engine, however this depends on how current available formats suit your needs
Posted on 2001-08-29 19:19:01 by BogdanOntanu
Hi !

Here are some Delphi-Sources for loading Models of different -types (e.g. Dungeon-Kepper II, Half-Life)


http://www.delphi-jedi.org/DelphiGraphics/jedi-index.htm

Greetings, CALEB
Posted on 2001-08-30 05:34:18 by Caleb