It is currently Tue Jul 23, 2024 4:21 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 12:08 am  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
This script will draw a gray scale wireframe of an .obj file of your choice on to your active layer.
So have a black-filled layer selected, and use this script to draw a wireframe on to that layer.
The script will be available under File -> Open Object file (install this python into your gimp's plug-ins folder)
see #2 post for new version with some bugs fixed.

Options you can change look like below
Image
bz distance seems to distort your perception (you can read it about it at http://en.wikipedia.org/wiki/3D_projection scroll down till you see a diagram of an eye and BZ is distance from your eye to the monitor). I'd just leave it as default a high number to not distort anything.

Here's a sample .obj file (Suzanne the monkey from blender, or you can search on the internet for others, or maybe create your own in blender although if you use blender i don't see the point of this plug-in hence the "just for fun" part)
Attachment:
monkey.zip [6.09 KiB]
Downloaded 456 times


here's a sample of what the script produces (with scale 160 of monkey.obj)
Image

with scale of 320 of monkey.obj
Image

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 1:05 am, edited 2 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 12:42 am  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
found some bugs and fixed it.
here's the updated version and corrected the miss-spelling of obj instead of ojb (so delete the other version)
latest version found ->here<-

here's a teapot.obj (scale:2, rotateX:180, rotateY:35)
Image

and another angle of Suzanne :)
Image


Attachments:
open-obj-file.zip [2.35 KiB]
Downloaded 348 times

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 1:17 pm, edited 1 time in total.
Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 1:20 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
Doesn't show up under file, or anywhere else that I can see.

Image

_________________
Image


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 2:35 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Oct 07, 2010
Posts: 439
Location: home/Nixnine/.gimp-2.0/scripts/nixnine.scm
Down at the bottom it says "Open Object File"

_________________
I refuse to be confused, but am often confused at this refusal.


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 3:23 am  (#5) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2446
Sort of works, a quick test, PClinuxOS, Gimp 2.8.10, Art of Illusion v3

You do need a canvas open for the menu item.

Two objects no problem, http://i.imgur.com/xY8NowY.jpg

Add a cylinder and it crashes, http://i.imgur.com/srcmwZa.jpg

but it is the cylinder, if I replace that with a elongated 'cube' then it renders ok.

As title, just for fun but interesting.

_________________
Image


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 8:44 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jun 02, 2013
Posts: 2075
nixnine wrote:
Down at the bottom it says "Open Object File"

Oh duh, didn't even see it there, haha. Thanks.

_________________
Image


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 11:38 am  (#7) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
It is conventional for menu commands that result in interactive dialogs to include ellipses: "Open Object File..."

Nitpicking a bit further, for consistency with the grammatical approach taken with the popup blurbs of the other GIMP commands (as well as most of the menu commands themselves), your blurb should describe what running the command will do, not what running the command does -- i.e., "Open an obj file", not "Opens an obj file".

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 1:05 pm  (#8) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
rich2005 wrote:
Sort of works, a quick test, PClinuxOS, Gimp 2.8.10, Art of Illusion v3

You do need a canvas open for the menu item.

Two objects no problem, http://i.imgur.com/xY8NowY.jpg

Add a cylinder and it crashes, http://i.imgur.com/srcmwZa.jpg

but it is the cylinder, if I replace that with a elongated 'cube' then it renders ok.

As title, just for fun but interesting.


Can you attached your .obj file zipped up so i can debug it and see why it crashes.

_________________
TinT


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 1:06 pm  (#9) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
saulgoode wrote:
It is conventional for menu commands that result in interactive dialogs to include ellipses: "Open Object File..."

Nitpicking a bit further, for consistency with the grammatical approach taken with the popup blurbs of the other GIMP commands (as well as most of the menu commands themselves), your blurb should describe what running the command will do, not what running the command does -- i.e., "Open an obj file", not "Opens an obj file".


I will add the "..." and will make it say "Open an obj file". Thank you for our suggestions.

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 1:18 pm, edited 1 time in total.

Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 1:16 pm  (#10) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
this version is a little faster, it only draws an edge once instead of multple times (since 2 faces can share an edge).
lastest version ->here<-

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 2:08 pm, edited 1 time in total.

Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 1:39 pm  (#11) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2446
trandoductin wrote:

Can you attached your .obj file zipped up so i can debug it and see why it crashes.


Two files, as a comparison. One with a cylinder (crashes here) and one without (renders ok).

I did dig up a blender cylinder from the web and that crashed as well.

edit: still have that one, give it a try.


Attachments:
blender_cylinder.obj.zip [746 Bytes]
Downloaded 83 times
cylinder.obj.zip [4.16 KiB]
Downloaded 82 times

_________________
Image
Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 2:07 pm  (#12) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
rich2005 wrote:
trandoductin wrote:

Can you attached your .obj file zipped up so i can debug it and see why it crashes.


Two files, as a comparison. One with a cylinder (crashes here) and one without (renders ok).

I did dig up a blender cylinder from the web and that crashed as well.

edit: still have that one, give it a try.


rich2005, try this version (i've changed it so that i recognizes different types of faces' definitions)
Attachment:
open-obj-file.zip [2.29 KiB]
Downloaded 478 times

an even more updated version of this plug-in: ->here<-

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 7:12 pm, edited 1 time in total.

Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 2:54 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
May try this one later trandoductin; looks cool for importing wireframes of Sculpture Generator output. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 3:30 pm  (#14) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2446
That is working with cylinders now.

I thought I would be a bit more ambitious and try some extruded text. Took some time to render but it got there.

However, I need to do some work on the orientation. ;)

Image

All good fun, thanks

_________________
Image


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 3:38 pm  (#15) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
rich2005 wrote:
That is working with cylinders now.

I thought I would be a bit more ambitious and try some extruded text. Took some time to render but it got there.

However, I need to do some work on the orientation. ;)

[ Image ]

All good fun, thanks


looks better if you try it on black background because i draw it with gray shades fades to white where white is the closest edges and and dark gray are further edges.

_________________
TinT


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 7:11 pm  (#16) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
lylejk wrote:
May try this one later trandoductin; looks cool for importing wireframes of Sculpture Generator output. :)


I looked up Sculpture Generator and gave it a try. It exports to .stl file. So i used an converter (http://www.greentoken.de/onlineconv/).

I found that the .obj file converted had duplication of vertices and faces defined. So I changed the plug-in to find unique vertices and unique edges only.

With the below test/sample (from 12601 vertices down to 2099 unique vertices, from 12600 edges down to 6300 unique edges)
so it reduces the workload to call gimp_pencil so not as slow (still slow since there's a lot of edges to draw)
Image


Here's the updated version of the plug-in that finds unique vertices and edges only.
Attachment:
open-obj-file.zip [2.76 KiB]
Downloaded 183 times


Go ->here<- for later version (auto-scale version)

_________________
TinT


Last edited by trandoductin on Fri Jun 13, 2014 9:58 pm, edited 2 times in total.

Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 7:20 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14728
Location: USA
Oh great now you have me breaking out Sculpture Gen again. :lol
Lyle will know what i mean.

Nice filter by the way.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 7:40 pm  (#18) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4041
Location: Canada
break it out :hehe

_________________
TinT


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 7:54 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14728
Location: USA
trandoductin wrote:
break it out :hehe

Already have. Notice the change in the interface :lol

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: draws .obj file inside gimp (just for fun) (Plugin)
PostPosted: Fri Jun 13, 2014 8:13 pm  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14728
Location: USA
www.youtube.com Video from : www.youtube.com

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Script-fu select outline of image inside png

1

No new posts Attachment(s) manipulate a portion of text inside a text layer using python-fu

2

No new posts "New"file replacing "open" file?

2

No new posts Attachment(s) Baby's first GEGL plugin - a very basic GEGL plugin anyone can make.

9

No new posts GIH FILE

2



* Login  



Powered by phpBB3 © phpBB Group