Archived

This topic is now archived and is closed to further replies.

.ASC File Format

This topic is 6357 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, does anyone know the .asc file format for 3d models themselves and/or know a site where I can find out? I''ve been looking around without luck ------------------------------ fclose(fp) ------------------------------

Share this post


Link to post
Share on other sites
Have you tried checking Wotsit''s File Format page? I think the url is http://www.wotsit.org/ but I could be wrong. I haven''t used it in a long time; matter of fact, I haven''t coded in a long time either

dea

Share this post


Link to post
Share on other sites
Hmm, it''s not on wotsit either, I dont understand why it''s o hard to find.

The only reason I''m looking for it is because I heard that the ASC file format is the simplest 3d file format there is. I started 3d programming about a week ago (literally, I started plotting points last week in 3d space

So I know the time is gonna come when I want to view a real object with what I''ve programmed and not define the vertices myself, so that''s why I want to understand the format.

Is there any easier file format for 3d files than ASC?

All I would really want in a 3d file is vertices and the polygons'' ambient color.
I may be way off though, what are the bare essentials you need in a 3d file?



------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
this is the ''file format'' of an asc file as I know them:


    
Named Object: model1
Tri-mesh, Vertices: 438 Faces: 856
Vertex list:
Vertex 0: X:-0.577808 Y:-0.678195 Z:11.2768
Vertex 1: X:-0.384295 Y:-0.770226 Z:11.3829
Vertex 2: X:2.53756 Y:-0.618069 Z:0.51637
Vertex 3: X:3.06358 Y:-0.263694 Z:-0.25044
Vertex 4: X:2.53756 Y:0.0906813 Z:0.51637
Vertex 5: X:1.88957 Y:-0.618069 Z:0.33578
.
.
.
Vertex 435: X:1.6118 Y:-0.263694 Z:0.19926
Vertex 436: X:1.88957 Y:0.0906813 Z:0.33578
Vertex 437: X:-0.415568 Y:-0.618069 Z:0.63322
Face list:
Face 0: A:0 B:7 C:114 AB:0 BC:0 CA:0
Smoothing: 1
Face 1: A:1 B:113 C:109 AB:0 BC:0 CA:0
Smoothing: 1
Face 2: A:5 B:10 C:118 AB:0 BC:0 CA:0
Smoothing: 1
.
.
.
Face 854: A:6 B:117 C:110 AB:0 BC:0 CA:0
Smoothing: 1
Face 856: A:8 B:14 C:122 AB:0 BC:0 CA:0
Smoothing: 1


You should watch out, though.
since I ''ve come across files where there are spaces
between the explanation of the number and the number itself

i.e.

Vertex 5: X: 1.88957 Y: -0.618069 Z: 0.33578
and
Vertex 5: X:1.88957 Y:-0.618069 Z:0.33578


I think that should be enough.
If you need more, be sure to ask.

The Rock

-BAD software-
http://members.spree.com/entertainment/bad_software

Share this post


Link to post
Share on other sites
Gladiator: I''d be happy to, couldn''t hurt to have someone going through the same thing as I am to have on my side. I''m sure we could help each other now. How much do you know exactly and when did u start 3d? Up till now, since last week, I got a rotating triangle going with flat-filling, and flat-shading (Lambert) going on it.

The Rock:
What exactly do you do with that face information?
And since the vertices are just lined up likethat, do you assumethey are all triangles and take every 3 and through them into the poly/triangle creator?



------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
It''s like this.

You''ve got an array of vertices.
Each veritice has an x, y and z coordinate.
Then you ''ve also got an array of faces.

A face is a triangle.
And has three numbers wich represent vertice 1, 2 and 3
They contain the index of the 3 vertices, the triangle
is made of.


I hope I explained this well enough,
If you still don''t understand, please ask

The Rock

-BAD software-
http://members.spree.com/entertainment/bad_software/

Share this post


Link to post
Share on other sites
Ok, I think I understand it a little better now

So the vertices are jut listed, but one vertex could be used for more than one face so then the faces are defined.

let'' say Face A:3 B:12 C:241 means this triangle is made up of vertex[3]vertex[12] and vertex[241]?

And one more thing, what''s AB BC CA for?

Thanks for all the info Rock!!
Just what I wanted to know

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
They''re used for smoothing.

You can just ignore them if you want to.



No problem, glad I could help.

CU

The Rock

-BAD software-

http://members.spree.com/entertainment/bad_software/


Share this post


Link to post
Share on other sites
I have done a simple 3D rotationg cube, that''s flat shaded.. ive also done an unoptimized (meaning slow) 3D terrain with gouraud shading which is geneerated from a height map, with the help of Witchlord... Im learning all the maths behind 3D now and i think im starting to understand some of them.. i know matrix math and just need to learn how to apply it to transform objects in 3D space (i kinda know how to do it, but have some more learning to do)..

Share this post


Link to post
Share on other sites
Rock: Thanks again. Btw,my friend is from Belgium

Gladiator: How long have you been trying to leearn 3d (In other words, how long did it take you from knowing nothing to making that cube rotate and that landscape?)

Before I move onto anything else I am going to tryto getthat spinning cube going. I feel I could''ve had it done by now but I never have any free time.
I know nothing about terrain imaging or height maps and all that jargon, I just want my spinning cube first (I want it to be gourad shaded too)

Speaking of gourad shading, anyone know how you getthe normal of a vertex to do the gourad? I read all about it, with interpolating and all that, I''m prettysure i can get that down no problem,but I just need to figure out how to get the normals of vertices. Maybe I should start a new pot for that :o)

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
it took me a while... in the beginning i started with a simple pixel drawing.. then the line algorithm... then i read on 3D a little and projection and that type of thing... then i created my wireframe cube.,., then i learned about rotation of 3D points... so i coded the rotation for my wireframe cube... the next thing i did was to color my cube... so i learned how to fill polygons (rectangles and triangles) with color, so i had my colored cube going on... the only problem was the backface culling... with the help of Witchlord (thanks man) i got it to work.. he showed (and explained to) me the backface culling algorithm, and how to implement it into code... which is pretty easy now when i think about it (whereas i had some difficulty in the beginning, and that was less than a month ago)... so it took about a week to get everything working as i want it... then Witchlord guided me through creating a 3D landscape out of heights array... that''s about it... now im still learning..

Share this post


Link to post
Share on other sites
Wow, all that took you about a week??
Nice

Thanks for the link, but I think I read every article in there and just about every 3d article on the web I could get my hands on.

I think I understand backface culling pretty well, I just havent had time to implement it.
About drawinga rotating cube, I realize you could use rectangle instead of triangle, but can you still use triangles and have it look the same? I dont know anything about vertex sharing and stuff like that though.

Here is my plan of attack on 3D from where I am right now:
1) Get gourad shading to work
2) Get backface culling to work and then
3) Get a cube rotating around with gourad shading
4) Clipping (have you done clipping yet gladiator?)

I''m so full of questions about the topic, here are a few more:
Say you have a polygon filler function, should it take any kind of polygon (meaning any amountof points), 3 OR 4 vertices, or ONLY 3 vertices?

And one more...
Once you get backface culling, ordered polygons, shading and roations and all that, could u then load up a mesh and display it accurately? (Without textures) Because I imagine it takes much more than that, but I''m not sure. If that''s all it takes to get a solid lighted mesh displayed that would be pretty cool.

After the 3d cube I plan on learning how to create environments (like draw a floor/ceilings/walls etc.), and then work on a very small and simple 3d game using my engine

Hey, a man can dream can''t he?

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
quote:

Wow, all that took you about a week??
Nice



yeah... pretty much.. it took a couple, almost sleepless, nights of couse, but that''s not the point

quote:

Thanks for the link, but I think I read every article in there and just about every 3d article on the web I could get my hands on.



I gotta start searching/reading/coding more since lately, I''ve been spending my computer time, on gamedev, and don''t have time to really code anything...

quote:

I think I understand backface culling pretty well, I just havent had time to implement it.



easy to implement... the theory makes it sound like it''s impossible to code, but the fact is that it''s easy...

quote:

About drawinga rotating cube, I realize you could use rectangle instead of triangle, but can you still use triangles and have it look the same? I dont know anything about vertex sharing and stuff like that though.



Okay, the way I''ve coded it, is by using rectangles, and not triangles. That technique only works for simple objects as a cube itself. In fact, a rectangle is made up of two triangles, so your best bet is to use triangles (3 vertices/points), which gives you more flexibility...


quote:

Here is my plan of attack on 3D from where I am right now:
1) Get gourad shading to work
2) Get backface culling to work and then
3) Get a cube rotating around with gourad shading
4) Clipping (have you done clipping yet gladiator?)



Seems like a good plan, and no, I haven''t done any clipping on my cube since I don''t move the camera around (it''s static )

quote:

I''m so full of questions about the topic, here are a few more:
Say you have a polygon filler function, should it take any kind of polygon (meaning any amountof points), 3 OR 4 vertices, or ONLY 3 vertices?



Make it only 3 vertices... That''s the way all (well almost) 3D polygon-based engines work...

quote:

And one more...
Once you get backface culling, ordered polygons, shading and roations and all that, could u then load up a mesh and display it accurately? (Without textures) Because I imagine it takes much more than that, but I''m not sure. If that''s all it takes to get a solid lighted mesh displayed that would be pretty cool.



Yes you can. You''ve got all the information in the 3D file (just like the ASC case) and you need to load all the vertices in a buffer, and then all the faces... Without any type of shading, it would be difficult to get a good view of the object you''ve loaded, but once you learn gourad shading, you can use some algos to make your object look more like 3D... or you can even use other flat shading techniques to make it look more real... (shading each polygon in a different color, according to it''s z value)... something like that...


quote:

After the 3d cube I plan on learning how to create environments (like draw a floor/ceilings/walls etc.), and then work on a very small and simple 3d game using my engine



Yes, that''s where I''m heading too

quote:

Hey, a man can dream can''t he?



Wait until you hear MY dream

..-=ViKtOr=-..

Share this post


Link to post
Share on other sites
So, what''s your dream?

The reason I dont have time to wokr on this 3d stuff is cause I got a summer job (I''m actually 19, I''ll be 20 in 2 weeks, and I''m a student at NYU, so I got a full time summer job)

Anyway, I never have time cause by the time I get home, I leave. But in my hour of free time yesterday I managed to get a rotating cube (without backface culling or polygon sorting).
Oh, and for some reason I''m getting a very strange error now. I''m using Turbo C to do all this cause I find it easier and faster to compile, and I''m using Andre''s Lamothe''s code to do it (his basic 2d gfx stuff like set_video_mode and plot_pixel)
Well, when I try to create a double buffer it just crashes on me and I dont know why, so I only got to view this cube while it was being blitted to the display so there was a LOT of flickeringand I dont really know how it looks.

I think I''m gonna port all this into DX, set up in 640x480x16b mode, Lock the back buffer and work from there. Then I get 65K colors to work with which would be nice.

What are you using to test all this stuff out Gladiator?

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
Hope you don''t mind me butting in - the way I see it, you have two options for the rasteriser.

1) It only does triangles.
2) It handles polygons with any number of vertices.

When you clip a polygon, you might discover that your resulting polygon has more than 3 vertices. Now either you can triangulate it and use your triangle filler or you can just fill it using a generic polygon filler.

In my case, I have an generic polygon filler (using integer arithmetic), but at some point I will write an optimised triangle filler (for those polygons that did not need clipping).

Share this post


Link to post
Share on other sites
quote:

So, what''s your dream?



I was just kidding I don''t think I have a dream... how could that be? I dont know...

quote:

The reason I dont have time to wokr on this 3d stuff is cause I got a summer job (I''m actually 19, I''ll be 20 in 2 weeks, and I''m a student at NYU, so I got a full time summer job)



same here... i got a full time summer job( probably will be part time during school)... im 18 now and will be a freshman in college this fall... by the time i get home it''s already evening.. so i go to my girlfriend, spend some time here, and the time passes by so quickly,.. that''s basically why i dont have much time to code... i answer questions on gamedev when there''s not much to do at work during the day...


quote:

Anyway, I never have time cause by the time I get home, I leave. But in my hour of free time yesterday I managed to get a rotating cube (without backface culling or polygon sorting).
Oh, and for some reason I''m getting a very strange error now. I''m using Turbo C to do all this cause I find it easier and faster to compile, and I''m using Andre''s Lamothe''s code to do it (his basic 2d gfx stuff like set_video_mode and plot_pixel)
Well, when I try to create a double buffer it just crashes on me and I dont know why, so I only got to view this cube while it was being blitted to the display so there was a LOT of flickeringand I dont really know how it looks.



show me the double buffer code... how are you allocating it.. how much memory do you allocate..??

quote:

I think I''m gonna port all this into DX, set up in 640x480x16b mode, Lock the back buffer and work from there. Then I get 65K colors to work with which would be nice.



I think DOS is easier to work with at least in the beginning...

quote:

What are you using to test all this stuff out Gladiator?



I used Watcom C++ for my Cube/Landscape demos...


..-=ViKtOr=-..

Share this post


Link to post
Share on other sites
TPH: Please feel free to butt in, I can use all the info I can get.

So you suggest I use a general poly filler for clipping. If I were clipping, from what I understand, the most vertices per polygon I can get are 4 correct? Hmmm, actually now that I think of it if it''s cut bymore than one plane then I guessit''ll be more. So how do you doa general poly filer? Could it actually take x number of vertices or is there a limit? Got any code i could look at perhaps?


Gladiator: It''s like we''re the same person. I also go on gamedev during the day at work cause I get bored sometimes and this is the only place that getsme through the day.

The double buffer code doesnt have anything wrong with it, I''ve been using it for years and it''s really basic. andre Lamothe wrote it himself :o)

it''s something alongthe lines of :

CreateDoublebuffer(int numlines)
{
//double_buffer defined as unsigned char far*
double_buffer = (unigned char far *)farmalloc(screenwidth*(numlines+1));
if null quit

_fmemset(double_buffer, 0, screenwidth*numlines);

}

I debugged and it crashes on the _fmemset. It has never donethis before, i was using double buffering when I had my triangle spinningwith no problem and I never touched the code.
Maybe I''m declaring something wrong in my main program that''s causing some meory leak that''s affecting this, who knows.

But dont worry about it, if i cant fix it up I''ll go to DX. The only reason I would consider doing that is to get 16bit mode for the coloringso it looks awesome (also for the 640x480 i guess)

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
Regarding the number of vertices in a clipped polygon, potentially there are more than four. If the triangle is clipped against, lets say the left, top and bottom planes, that could be five vertices. An ASCII example!

TOP
********
L **********
E ************
F **********
T ********
*****
BOTTOM

I dunno, maybe it''s better to triangulate so you can optimise the filler to do just triangles. But that means learning to triangulate. Urgh! Not for me just yet...

Share this post


Link to post
Share on other sites
Any tutorials on how to triangulate???
:o)

I was just trying to figure it out over the past 5 minutes. It doesnt look like it would be too hard to triangulate it.

Anyone know what the common practice is for the high level 3d games? Triangulation or >3 vertexed polys

Anyway, for triangulation, I think I''m right when I say you can figure out how many triangle there would be by doing NumPoints-2.
A triangle (3 points) would have 1 triangle, dur
A square, 4-2, 2 tris
pentagon, 5-2, 3 tris

Ihavent proven this mathematically, ijust drew a few pictures

So I think if you picka vertex and then pick 2 more in clocwise order and make a triangle, that''ll be one. Then you gotta use the last vertex u used asthe first vertex ofthe next triangle, but i dont knowwhere to go from there

I''m sure we could figure this out, but is it worth our time?

------------------------------
fclose(fp)
------------------------------

Share this post


Link to post
Share on other sites
Hi Guys....

U look like your trying to put a 3d Engine together....
Just wanted to say, that u can write the fastest code, but u won''t sucseed without implementing some kind of Datasorting....
As an Exemple, implement BSP (Binary Space Partitioning) or Octtrees, or whatever...
I know, it might be a bit early, but if u r already up to Backfaceculling u might want to think of that...
It took me some time to understand it, but once u know how to do it....

For myself i haven''t implemented it yet, since i''m working in a team, and i''m writing diffrent konverters for our modelformat.

for the file format: I don''t think i''d use ASC cause it could happen too easy that u loose a space or something, and then u''ll search forever to find that bug...
I''d rather use the .3ds file format, there''s a nice FDK for it...
I''m still learning to use that too...but at the moment i''m rather thinking of writing an plugin for 3ds MAX rather than writing a konverter...
gotta go now...

good luck,

cya,

Phil

Share this post


Link to post
Share on other sites