Loading Object Files (.obj)

View: New views
7 Messages — Rating Filter:   Alert me  

Loading Object Files (.obj)

by Knut Urdalen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

Just wanted to notice you that I'm currently writing an OBJ-parser for
Papervision following the specification for Object Files
(http://people.scs.fsu.edu/~burkardt/txt/obj_format.txt).

I've just started and here's the first test loading of vertices and faces:

Source: http://www.urdalen.com/lab/OBJ.as
Test: http://www.urdalen.com/lab/objtest/

Next up is object groups and texture coordinates.

I'm currently writing this for my own purpose. Is anybody else
interested in this parser? I'm not sure how much this format is used,
but since it's a universally accepted format between most modeling tools
my assumption is that it's a wanted feature.

Best Regards,
Knut Urdalen

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Jon Bradley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Feb 3, 2008, at 7:43 PM, Knut Urdalen wrote:

> I'm currently writing this for my own purpose. Is anybody else
> interested in this parser? I'm not sure how much this format is used,
> but since it's a universally accepted format between most modeling  
> tools
> my assumption is that it's a wanted feature.

As far as the prevalence of the format, it's used way more than  
formats like Collada - even more so than FBX files (which have lots  
of annoying issues and a very buggy SDK).

very cool and thanks for sharing!

- jon



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Fabrice closier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Groups and mtl's support are not added yet,
but there is an Obj parser into Away3D's repository
might save you some typing.

Fabrice


On Feb 4, 2008, at 10:57 AM, Jon Bradley wrote:

>
> On Feb 3, 2008, at 7:43 PM, Knut Urdalen wrote:
>
>> I'm currently writing this for my own purpose. Is anybody else
>> interested in this parser? I'm not sure how much this format is used,
>> but since it's a universally accepted format between most modeling
>> tools
>> my assumption is that it's a wanted feature.
>
> As far as the prevalence of the format, it's used way more than
> formats like Collada - even more so than FBX files (which have lots
> of annoying issues and a very buggy SDK).
>
> very cool and thanks for sharing!
>
> - jon
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Knut Urdalen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the feedback Jon and Fabrice.

Here's an updated version supporting automatic material creation based
on the Material Library File (.mtl) and grouping more objects into the
same object file.

Source: http://www.urdalen.com/lab/OBJ.as
Test: http://www.urdalen.com/lab/objfish/

Do you know about any libraries for extracting gzip files in AS3? This
object file containing ~6000 triangles and is about 1.1MB in file size.
Using gzip on this simple format would help a lot on lowering the file
size the client has to download.

Best Regards,
Knut Urdalen
http://www.urdalen.com


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Kim Daniel Arthur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

cool!

for the zip related you can check out:
http://code.google.com/p/vanrijkom-flashlibs/
or
http://www.nochump.com/blog/?p=15

kim

On 09/02/2008, Knut Urdalen <knut.urdalen@...> wrote:

> Thanks for the feedback Jon and Fabrice.
>
> Here's an updated version supporting automatic material creation based
> on the Material Library File (.mtl) and grouping more objects into the
> same object file.
>
> Source: http://www.urdalen.com/lab/OBJ.as
> Test: http://www.urdalen.com/lab/objfish/
>
> Do you know about any libraries for extracting gzip files in AS3? This
> object file containing ~6000 triangles and is about 1.1MB in file size.
> Using gzip on this simple format would help a lot on lowering the file
> size the client has to download.
>
> Best Regards,
> Knut Urdalen
> http://www.urdalen.com
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Fabrice Closier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well done!
However,  you may have made a little mistake in the parsing, your  
faces are flipped...
If the model is correct and have all faces unified,
then a,b,c needs to be b,a,c

Fabrice
On Feb 9, 2008, at 11:09 AM, Knut Urdalen wrote:

> Thanks for the feedback Jon and Fabrice.
>
> Here's an updated version supporting automatic material creation based
> on the Material Library File (.mtl) and grouping more objects into the
> same object file.
>
> Source: http://www.urdalen.com/lab/OBJ.as
> Test: http://www.urdalen.com/lab/objfish/
>
> Do you know about any libraries for extracting gzip files in AS3? This
> object file containing ~6000 triangles and is about 1.1MB in file  
> size.
> Using gzip on this simple format would help a lot on lowering the file
> size the client has to download.
>
> Best Regards,
> Knut Urdalen
> http://www.urdalen.com
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D@...
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

Re: Loading Object Files (.obj)

by Knut Urdalen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the tip Fabrice, now the demo [1] works and I'm able use the
OBJ-parser like this:

var fish:OBJ = new OBJ("fish.obj", "fish.mtl");

and create BitmapMaterials from the material file [2] using the
referenced texture [3]. The MTL-file [2] also support bumpmaps [4] (see
the "map_Bump" keyword). It would be nice to also load this
automatically if it's already defined in the material file.

Could you put me in the right direction on how to add the bump map data
to a TriangleMesh3D?

Knut

[1] http://www.urdalen.com/lab/objfish/
[2] http://www.urdalen.com/lab/objfish/fish.mtl
[3] http://www.urdalen.com/lab/objfish/sakura_p3b-3.jpg
[4] http://www.urdalen.com/lab/objfish/sakura_p3bBump3.jpg

Fabrice Closier wrote:
> Well done!
> However,  you may have made a little mistake in the parsing, your  
> faces are flipped...
> If the model is correct and have all faces unified,
> then a,b,c needs to be b,a,c
>
> Fabrice
>  


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
LightInTheBox - Buy quality products at wholesale price