Page 2 of 3

Re: Widget request: Extract model data

Posted: 29 Oct 2009, 21:30
by zwzsg
I'm not bright enough to see what difference it makes to wireframes, please enlighten me.

Re: Widget request: Extract model data

Posted: 29 Oct 2009, 21:32
by Argh
Check what a 3DO wireframe looks like, and then view a S3O one in Spring. Return enlightened.

Re: Widget request: Extract model data

Posted: 29 Oct 2009, 21:37
by zwzsg
Ah, I guess you mean the diagonals, thanks.

Re: Widget request: Extract model data

Posted: 29 Oct 2009, 21:41
by Argh
And that's just the tip of the iceberg. Having a S3O parser, either engine-side or Lua, is a Big Deal.

Re: Widget request: Extract model data

Posted: 30 Oct 2009, 12:04
by Tribulex
@det

How am I insulting people by calling 1 person "not so incredibly dense"? Thats actually what I would consider a compliment. Im pointing out something good about him.

@others:

You guys really dont get it. Ill use big text so you can read it better:

I dont care about drawing. I dont want to know how to draw a wireframe. I dont want to know how to do what you want to know how to do. I dont want to convert to quads. I dont want to do anything except for this: Extract a list of vertices from a model, and extract a list of lines I could use to connect those vertices.

I have learned from Argh, who is a really great guy (no really), that this can only be done right now by parsing the s3o file. Has anyone done anything on this?


Aside from this, does anyone have a way of extracting this data from a file outside of spring? I dont care about the 3d model format or the programming language or what. I need a list of points and lines that form a model. If i have to calculate it outside of spring, then thats what I will do.

Re: Widget request: Extract model data

Posted: 30 Oct 2009, 12:33
by hoijui
best would have been/would be, if you had outlined what yo uare trying to do in general, as in:
i want to do a programm/mod/widget that does X and Y, and to do this i need to do Z, and therefore ... i have to get the points and vertices.

Re: Widget request: Extract model data

Posted: 30 Oct 2009, 17:44
by lurker
I'm going to put this as gently and non-insulting as I can.

If you ask about a widget rendering wireframes, you get told how to render wireframes from a widget.

If you ask about extracting model data with a valid reason, despite the difficulties involved, you will get an answer about that.

Don't insult other people when you came in with a two sentence post expecting it to be easy to get complex 3d model data and failed to clarify why you wanted it, instead repeating your original request.
d_b wrote:@det
How am I insulting people by calling 1 person "not so incredibly dense"? Thats actually what I would consider a compliment. Im pointing out something good about him.
This is either trolling or you're posting at 4am high on cough syrup. Either way, stop it.

Re: Widget request: Extract model data

Posted: 30 Oct 2009, 18:37
by Kloot
d_b wrote:Basically, i need the coordinates so that I can draw a wireframe.
d_b wrote:I dont care about drawing.
Maybe get your story straight before asking people to "right" you any code, CMU's finest.

d_b wrote:this can only be done right now by parsing the s3o file. Has anyone done anything on this?
Yes.

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 08:01
by Forboding Angel
det wrote:Way to insult the people who are trying to help you.
The way he was being "answered" and spoken to was insulting. I would have had the same reaction.

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 17:46
by Tribulex
Kloot wrote:
d_b wrote:this can only be done right now by parsing the s3o file. Has anyone done anything on this?
Yes.
What? w2dl?

At others: >:( Meanface

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 18:19
by AF
Where would I find the details on parsing and extracting all the data in an s3o?

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 18:24
by jK
Spring is what? O p e n S o u r c e :p

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 18:38
by Tribulex
jK wrote:jK is what? L u a / S p r i n g W i z a r d :p
Please bless me with your powers.

Re: Widget request: Extract model data

Posted: 31 Oct 2009, 23:21
by Argh
He can't, that involves answering questions, and he doesn't do that until you're semi-competent.

OK...

1. Kloot, do you have any source you'd be willing to share? All I want, personally, is to be able to read a single-object S3O (i.e., it's 'base'). That would be fine, for the things I want to do (read model data for Lua rendering, instead of having to build the display lists in Lua, or porting said objects to OBJ and manually parsing their points, blech).

2. If no... here's what we need to read:

http://github.com/spring/spring/blob/a2 ... Parser.cpp

I'm stuck at step 1 of the process: how do we convert the header and the rest of the hex back into a format we can use?

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 00:10
by Argh
OK... how's about an easier idea: an OBJ parser? I might be able to do that, it's a non-hex format. Let me look at some stuff.

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 01:04
by Argh
OK, so an OBJ is pretty close to being a display list already. The data we need is:

For each vertex:

Vertex Coordinates:
v 5.956962 0.000000 -14.999999

Vertex Normal:
vn 0.000000 0.242536 -0.970142

Texture coordinates (?)
vt 0.109027 0.142404 0.0

Triangles are defined by specifying the entry X of the vertex coodinates, the vertex normal coordinates, and the texture coordinates:
f 1/1/1 2/2/2 3/3/3

Where 1,2,3 are entries with vertex positions, normals, texture coordinates. Texture coordinates are in order- 1 would use the first entry, 2 would use the second entry, 3 would use the third (I assume that the 0.0 third entry is there for either material support or for 3D textures- not that important either way).

So... basically, we need to read the OBJ file, parse it into lists according to type, and use the "f" lists to build our display list.

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 01:05
by aegis
Argh wrote:I'm stuck at step 1 of the process: how do we convert the header and the rest of the hex back into a format we can use?
http://www.inf.puc-rio.br/~roberto/struct/

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 01:08
by Argh
That's a C file, intended to add that functionality. Question then is: does our Lua allow for struct atm? If not, that would need to be added to the engine.

That said, if the struct is already a complete display list, it'd sure save some time. I suck at parsing / sorting, and the OBJ loader is basically all about that.

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 01:11
by aegis
routines to unpack C structs are for parsing binary data.
it would merely help you implement spring's parser.

Re: Widget request: Extract model data

Posted: 01 Nov 2009, 01:18
by Argh
Right, you're unpacking the data, so that Lua can read it, then we'd have to go through the same routine as here:

http://github.com/spring/spring/blob/a2 ... Parser.cpp

To arrive at final TRIANGLE_STRIP display lists, more or less. The problem I have with attacking the problem that way is that, very simply, IDK if I can read that well enough to convert it, and it assumes a lot of utility / math functions are present (although some of that is available in LUPS, IIRC, such as cross).