WaveFront File importer on Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

WaveFront File importer on Pharo

Jean Baptiste Arnaud
Hi, 
Under the pressure of Camillo i publish the code.
I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.

So i made a importer.
Not all the case are manage, only the case I need to import the current Obj model.

And a drawer which is in Alpha version.
face and normal vector are manage.
Missing color (in progress), and texturing.

You need .obj file and all the .mtl related (open you blender and make it nice).

If you are not running on Mac os comment this code in GLWorldTest>>#render, the 

display makeCurrent.

else if you running on mac os implement it in 
NBMSAAOffscreenDisplay>>#makeCurrent 
^driver makeCurrent.

My code can be find on JBARepo on squeaksource 
ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

So 
put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
open a workspace and do

"s := ObjImporter importFrom: 'xwing-map.obj'.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld."

3d result with normal 


With normal and color but not texture : 


Enjoy




Best Regards
Jean Baptiste Arnaud







Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Stéphane Ducasse

On Jul 17, 2012, at 2:21 PM, Jean Baptiste Arnaud wrote:

> Hi,
> Under the pressure of Camillo i publish the code.

Thanks camillo :)


> I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.
>
> So i made a importer.
> Not all the case are manage, only the case I need to import the current Obj model.

you relax from PhD writing :).

>
> And a drawer which is in Alpha version.
> face and normal vector are manage.
> Missing color (in progress), and texturing.
>
> You need .obj file and all the .mtl related (open you blender and make it nice).
>
> If you are not running on Mac os comment this code in GLWorldTest>>#render, the
>
> display makeCurrent.
>
> else if you running on mac os implement it in
> NBMSAAOffscreenDisplay>>#makeCurrent
> ^driver makeCurrent.
>
> My code can be find on JBARepo on squeaksource
> ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

Keep it up to date.


>
> So
> put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
> open a workspace and do
>
> "s := ObjImporter importFrom: 'xwing-map.obj'.
> s parse.
> object := s objects.
>
> w := GLWorldTest new.
> object do: [:e | w addElement: e].
> w openInWorld."
>
> 3d result with normal
> <Screen Shot 2012-07-17 at 1.59.22 PM.png>
>
>
> With normal and color but not texture :
>
> <Screen Shot 2012-07-17 at 1.58.18 PM.png>
>
> Enjoy
>
>
>
>
> Best Regards
> Jean Baptiste Arnaud
> [hidden email]
>
>
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Tudor Girba-2
In reply to this post by Jean Baptiste Arnaud
Very nice!

Doru


On 17 Jul 2012, at 14:21, Jean Baptiste Arnaud wrote:

> Hi,
> Under the pressure of Camillo i publish the code.
> I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.
>
> So i made a importer.
> Not all the case are manage, only the case I need to import the current Obj model.
>
> And a drawer which is in Alpha version.
> face and normal vector are manage.
> Missing color (in progress), and texturing.
>
> You need .obj file and all the .mtl related (open you blender and make it nice).
>
> If you are not running on Mac os comment this code in GLWorldTest>>#render, the
>
> display makeCurrent.
>
> else if you running on mac os implement it in
> NBMSAAOffscreenDisplay>>#makeCurrent
> ^driver makeCurrent.
>
> My code can be find on JBARepo on squeaksource
> ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).
>
> So
> put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
> open a workspace and do
>
> "s := ObjImporter importFrom: 'xwing-map.obj'.
> s parse.
> object := s objects.
>
> w := GLWorldTest new.
> object do: [:e | w addElement: e].
> w openInWorld."
>
> 3d result with normal
> <Screen Shot 2012-07-17 at 1.59.22 PM.png>
>
>
> With normal and color but not texture :
>
> <Screen Shot 2012-07-17 at 1.58.18 PM.png>
>
> Enjoy
>
>
>
>
> Best Regards
> Jean Baptiste Arnaud
> [hidden email]
>
>
>
>
>
>
>

--
www.tudorgirba.com

"To utilize feedback, you first have to acquire it."


Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Jean Baptiste Arnaud
I have transparency now and i beginning texturing.
I just need to check the rule for drawing to be more accurate with .obj model (basically change to parameter and take the best result).
I need to parse and to rewrite all the path for texture it did not find (every texture in fact, blender export in a really strange way). 
And in addition there are plenty of different kind of texture and I need to learn OpenGL. :-)
i already success to texturing the vador starship. I need to generalise process now.



On Jul 18, 2012, at 7:37 AM, Tudor Girba wrote:

Very nice!

Doru


On 17 Jul 2012, at 14:21, Jean Baptiste Arnaud wrote:

Hi,
Under the pressure of Camillo i publish the code.
I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.

So i made a importer.
Not all the case are manage, only the case I need to import the current Obj model.

And a drawer which is in Alpha version.
face and normal vector are manage.
Missing color (in progress), and texturing.

You need .obj file and all the .mtl related (open you blender and make it nice).

If you are not running on Mac os comment this code in GLWorldTest>>#render, the

display makeCurrent.

else if you running on mac os implement it in
NBMSAAOffscreenDisplay>>#makeCurrent
^driver makeCurrent.

My code can be find on JBARepo on squeaksource
ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

So
put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
open a workspace and do

"s := ObjImporter importFrom: 'xwing-map.obj'.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld."

3d result with normal
<Screen Shot 2012-07-17 at 1.59.22 PM.png>


With normal and color but not texture :

<Screen Shot 2012-07-17 at 1.58.18 PM.png>

Enjoy




Best Regards
Jean Baptiste Arnaud
[hidden email]








--
www.tudorgirba.com

"To utilize feedback, you first have to acquire it."



Best Regards
Jean Baptiste Arnaud







Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

melkyades
Wow! this is cool!

On Wed, Jul 18, 2012 at 8:35 AM, Jean Baptiste Arnaud <[hidden email]> wrote:
I have transparency now and i beginning texturing.
I just need to check the rule for drawing to be more accurate with .obj model (basically change to parameter and take the best result).
I need to parse and to rewrite all the path for texture it did not find (every texture in fact, blender export in a really strange way). 
And in addition there are plenty of different kind of texture and I need to learn OpenGL. :-)
i already success to texturing the vador starship. I need to generalise process now.



On Jul 18, 2012, at 7:37 AM, Tudor Girba wrote:

Very nice!

Doru


On 17 Jul 2012, at 14:21, Jean Baptiste Arnaud wrote:

Hi,
Under the pressure of Camillo i publish the code.
I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.

So i made a importer.
Not all the case are manage, only the case I need to import the current Obj model.

And a drawer which is in Alpha version.
face and normal vector are manage.
Missing color (in progress), and texturing.

You need .obj file and all the .mtl related (open you blender and make it nice).

If you are not running on Mac os comment this code in GLWorldTest>>#render, the

display makeCurrent.

else if you running on mac os implement it in
NBMSAAOffscreenDisplay>>#makeCurrent
^driver makeCurrent.

My code can be find on JBARepo on squeaksource
ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

So
put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
open a workspace and do

"s := ObjImporter importFrom: 'xwing-map.obj'.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld."

3d result with normal
<Screen Shot 2012-07-17 at 1.59.22 PM.png>


With normal and color but not texture :

<Screen Shot 2012-07-17 at 1.58.18 PM.png>

Enjoy




Best Regards
Jean Baptiste Arnaud
[hidden email]








--
www.tudorgirba.com

"To utilize feedback, you first have to acquire it."



Best Regards
Jean Baptiste Arnaud










--
Lic. Javier Pimás
Ciudad de Buenos Aires
Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Luc Fabresse
In reply to this post by Stéphane Ducasse
Hi JB,

 Excellent!
 I tried to give it a try for the fun.
 I couldn't make it work.
 
 I updated some stuff (find it attached):
 - ConfigurationOfObjModel-LucFabresse.2.mcz
    added repository for package OBJModel in baseline
 - OBJModel-LucFabresse.7
    add support for empty lines and "g" lines in wavefront format parser (ObjImporter>>dispach:)
 
 Here the snippet I tried:
 
filename := 'teapot.obj'.
response := ZnEasy get: 'http://people.sc.fsu.edu/~jburkardt/data/obj/',filename.
(FileSystem disk workingDirectory / filename)
writeStreamDo: [ :stream | stream nextPutAll: response contents].

s := ObjImporter importFrom: filename.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld.

Parsing seems to be ok.
But, creating the GL context failed: invalid pixel format.
On a mac OSX 10.6.8.

I am eager to play deeper with that ;-)
 
#Luc



2012/7/18 Stéphane Ducasse <[hidden email]>

On Jul 17, 2012, at 2:21 PM, Jean Baptiste Arnaud wrote:

> Hi,
> Under the pressure of Camillo i publish the code.

Thanks camillo :)


> I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.
>
> So i made a importer.
> Not all the case are manage, only the case I need to import the current Obj model.

you relax from PhD writing :).

>
> And a drawer which is in Alpha version.
> face and normal vector are manage.
> Missing color (in progress), and texturing.
>
> You need .obj file and all the .mtl related (open you blender and make it nice).
>
> If you are not running on Mac os comment this code in GLWorldTest>>#render, the
>
>       display makeCurrent.
>
> else if you running on mac os implement it in
> NBMSAAOffscreenDisplay>>#makeCurrent
>       ^driver makeCurrent.
>
> My code can be find on JBARepo on squeaksource
> ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

Keep it up to date.


>
> So
> put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
> open a workspace and do
>
> "s := ObjImporter importFrom: 'xwing-map.obj'.
> s parse.
> object := s objects.
>
> w := GLWorldTest new.
> object do: [:e | w addElement: e].
> w openInWorld."
>
> 3d result with normal
> <Screen Shot 2012-07-17 at 1.59.22 PM.png>
>
>
> With normal and color but not texture :
>
> <Screen Shot 2012-07-17 at 1.58.18 PM.png>
>
> Enjoy
>
>
>
>
> Best Regards
> Jean Baptiste Arnaud
> [hidden email]
>
>
>
>
>
>
>




OBJModel-LucFabresse.7.mcz (25K) Download Attachment
ConfigurationOfObjModel-LucFabresse.2.mcz (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Jean Baptiste Arnaud
I will check tomorrow, because i don't manage all the dispatch case g Object001
in file is not manage is do that tomorow fast.
 

On Jul 21, 2012, at 9:44 AM, Luc Fabresse wrote:

Hi JB,

 Excellent!
 I tried to give it a try for the fun.
 I couldn't make it work.
 
 I updated some stuff (find it attached):
 - ConfigurationOfObjModel-LucFabresse.2.mcz
    added repository for package OBJModel in baseline
 - OBJModel-LucFabresse.7
    add support for empty lines and "g" lines in wavefront format parser (ObjImporter>>dispach:)
 
 Here the snippet I tried:
 
filename := 'teapot.obj'.
response := ZnEasy get: 'http://people.sc.fsu.edu/~jburkardt/data/obj/',filename.
(FileSystem disk workingDirectory / filename)
writeStreamDo: [ :stream | stream nextPutAll: response contents].

s := ObjImporter importFrom: filename.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld.

Parsing seems to be ok.
But, creating the GL context failed: invalid pixel format.
On a mac OSX 10.6.8.

I am eager to play deeper with that ;-)
 
#Luc



2012/7/18 Stéphane Ducasse <[hidden email]>

On Jul 17, 2012, at 2:21 PM, Jean Baptiste Arnaud wrote:

> Hi,
> Under the pressure of Camillo i publish the code.

Thanks camillo :)


> I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.
>
> So i made a importer.
> Not all the case are manage, only the case I need to import the current Obj model.

you relax from PhD writing :).

>
> And a drawer which is in Alpha version.
> face and normal vector are manage.
> Missing color (in progress), and texturing.
>
> You need .obj file and all the .mtl related (open you blender and make it nice).
>
> If you are not running on Mac os comment this code in GLWorldTest>>#render, the
>
>       display makeCurrent.
>
> else if you running on mac os implement it in
> NBMSAAOffscreenDisplay>>#makeCurrent
>       ^driver makeCurrent.
>
> My code can be find on JBARepo on squeaksource
> ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

Keep it up to date.


>
> So
> put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
> open a workspace and do
>
> "s := ObjImporter importFrom: 'xwing-map.obj'.
> s parse.
> object := s objects.
>
> w := GLWorldTest new.
> object do: [:e | w addElement: e].
> w openInWorld."
>
> 3d result with normal
> <Screen Shot 2012-07-17 at 1.59.22 PM.png>
>
>
> With normal and color but not texture :
>
> <Screen Shot 2012-07-17 at 1.58.18 PM.png>
>
> Enjoy
>
>
>
>
> Best Regards
> Jean Baptiste Arnaud
> [hidden email]
>
>
>
>
>
>
>



<OBJModel-LucFabresse.7.mcz><ConfigurationOfObjModel-LucFabresse.2.mcz>

Best Regards
Jean Baptiste Arnaud







Reply | Threaded
Open this post in threaded view
|

Re: WaveFront File importer on Pharo

Jean Baptiste Arnaud
In reply to this post by Stéphane Ducasse

On Jul 18, 2012, at 7:34 AM, Stéphane Ducasse wrote:


On Jul 17, 2012, at 2:21 PM, Jean Baptiste Arnaud wrote:

Hi,
Under the pressure of Camillo i publish the code.

Thanks camillo :)


I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.

So i made a importer.
Not all the case are manage, only the case I need to import the current Obj model.

you relax from PhD writing :).
Exactly ^^.


And a drawer which is in Alpha version.
face and normal vector are manage.
Missing color (in progress), and texturing.

You need .obj file and all the .mtl related (open you blender and make it nice).

If you are not running on Mac os comment this code in GLWorldTest>>#render, the

display makeCurrent.

else if you running on mac os implement it in
NBMSAAOffscreenDisplay>>#makeCurrent
^driver makeCurrent.

My code can be find on JBARepo on squeaksource
ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

Keep it up to date.



So
put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
open a workspace and do

"s := ObjImporter importFrom: 'xwing-map.obj'.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld."

3d result with normal
<Screen Shot 2012-07-17 at 1.59.22 PM.png>


With normal and color but not texture :

<Screen Shot 2012-07-17 at 1.58.18 PM.png>

Enjoy




Best Regards
Jean Baptiste Arnaud
[hidden email]










Best Regards
Jean Baptiste Arnaud