obj file loader

Post your Construct-made creations!

Post » Sun Jan 03, 2010 1:07 am

[URL=http://img189.imageshack.us/i/tempxk.jpg/" rel="nofollow][IMG]http://img189.imageshack.us/img189/5131/tempxk.th.jpg][/URL]
Here is a .obj file loader. It will load obj files with UV coordinates exported by Blender, but it will only read lines that start with v, vt or f. It uses a 128x128 texture, but if you use another it will need to be flipped vertically.

Usage is pretty straight forward. Select a file to load. Press the "load" button then the "prime" button, and viola!

obj loader cap:
EDIT: http://dl.dropbox.com/u/5426011/examples%209/fileload94.zip
blender exported obj file (texture already in cap):
[url:11zelqjy]http://www.filedropper.com/bear[/url:11zelqjy]

It serves as a nice benchmark for Construct. I get about 25 fps with the bear.obj file. What do you get?

On a side note I notice construct is able to add files to a cap through the project bar. It would be a useful feature if the added files were accessible at runtime, but there seems to be no way to access them.R0J0hound2012-03-02 23:04:27
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Jan 03, 2010 1:28 am

thats insanely cool, but its pretty slow? the model doesn't seem very high poly at all but its running at 35 fps, and ive gotten 300+ on models with alot more "polygons", but i used only maybe 5-10 distort maps on those models, and wrapped them up in a special way since i didn't need to fit into any real 3d format.

from looking at your code im assuming your using a sprite as a quad for every face of the model? is that the cause or is it something else?
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Jan 03, 2010 2:16 am

Yeah I'm using a quad for every face, both three and four sided. Your method with distort maps with more control points is probably faster. I'm running into a slowdown associated with a high object count. Also if you look at the last event it only needs to be active when the point locations change. That loop when disabled almost triples my frame rate.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sun Jan 03, 2010 8:21 am

Congrats, that's quite a feat. :D

I figured the first loader would have been in Python, didn't even imagine text manipulator could have done it.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Jan 03, 2010 9:17 am

HOLY CRAP THAT'S EFFING CRAZY
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jan 04, 2010 3:04 am

BLENDER INTEGRATION ASFOHAIDVHDOCKSD
*dies*
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Mon Jan 04, 2010 5:06 am

And suddenly, a new contender emerges.

Very cool man, and more efficient than my own obj loader by a pretty decent margin (I think, can't check using my own computer at the moment).

3500~ faces at 35 fps is pretty impressive knowing how unsuited Construct is for 3D.
B
2
S
2
G
5
Posts: 108
Reputation: 1,866

Post » Mon Jan 04, 2010 5:28 am

well construct can do 3d, but not in this sense, you have to scale back and using a sprite for each quad is seriously gonna cause some slowdown. i actually have a 3D game running WITH collision detection and a bunch of pretty smooth models, rudimentary shading and other stuff working along side the 3d engine, and basically no load time since models are created using loops and beziers and fancy tricks. and i get 120-145 fps.

Construct wont be able to actually use real meshes, loaded externally at an acceptable frame rate until a mesh object is created, using built in direct 3D stuff, which ive heard rumors about btw ;P
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Mon Jan 04, 2010 6:05 am

[quote="QuaziGNRLnose":11w2m7t8]well construct can do 3d, but not in this sense, you have to scale back and using a sprite for each quad is seriously gonna cause some slowdown.[/quote:11w2m7t8]
Scaling back is a given.

I disagree that using 1x1 distorted sprites as quads is less efficient than using 'meshes'; in all of my testing, meshes yeild noticably lower FPS.

I hope that rumour about proper mesh support holds true. Would makes things much easier in the future :).
B
2
S
2
G
5
Posts: 108
Reputation: 1,866

Post » Mon Jan 04, 2010 6:54 am

well i cant say for sure anything about the mesh stuff cause i haven't tested it, or haven't tried it, but i know that when i wrap a 20x20 mesh onto a sphere, it runs pretty damn fast even in a cap with other models, but i dont think having the 400? quads (im kind of tired and im not sure if my are of the mesh equates to number of quads) would be faster would it? it seems it would take up way more memory, and be a lot bulkier to handle, but like i said, ive only tried the mesh way of doing things, and im basing it on the good performance i got with it, not to mention i dont know how youre handling face wrapping, and that could very well be a contributing factor.

anyways, i think anyones that dabbled with making models knows just how unsuited construct is to it.
a mesh object would make it so much easier and better performing anyways
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Next

Return to Your Creations

Who is online

Users browsing this forum: No registered users and 4 guests