[Plugin] Bitmap To Mesh

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Fri Oct 01, 2010 6:47 pm

1.25 million entities? :shock: That would let the magic smoke out of this computer for sure. :lol:
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby jeff hammond » Fri Oct 01, 2010 6:58 pm

with this bmp, i added a few extra pixels along the top and bottom making it an even 125x500px which brought the entities down by 75%..
(make sure to scale the y axis to 25% in order to fix the proportions)

Untitled-1.bmp.zip



untitled1.jpg
0
dotdotdot
User avatar
jeff hammond 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby dedmin » Fri Oct 01, 2010 7:59 pm

No, there is a similar command in Rhino - Mesh Heightfield. I just used your image to test it - the mesh is quite small 33 by 8 by 1,3 mm. I doubt this can be done in SketchUP.
0

dedmin 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby dedmin » Fri Oct 01, 2010 8:13 pm

And Rhino maps the image as a texture

Untitled-1.jpg


2010-10-01_221122.jpg


2010-10-01_221044.jpg
0

dedmin 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby notareal » Fri Oct 01, 2010 8:18 pm

Nice one! I can imagine that one day this will be in need.
0
Welcome to try Thea Render, Thea support | kerkythea.net -team member

notareal 
Thea Render Support
Thea Render Support
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Fri Oct 01, 2010 8:47 pm

Dedmin, that looks nice.

I did make the heighfield map in SketchUp so I know that part can be done. Here's the mesh from which I made the map.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby dedmin » Fri Oct 01, 2010 9:02 pm

Sure - I mean the plugin. Can that plugin make so small mesh from an image without scaling? Looks good Dave :thumb:
By the way, did You notice that Layout 3 can now paste Excel tables - very handy!
0

dedmin 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby shura » Fri Oct 01, 2010 9:05 pm

Jeff, that concentric wave looks great!

Thomas, sorry but I won't be able to get out of Berlin atm. We are preparing to move to a new appartment with my son being only six weeks old, and Munich is 600km from here... :cry:
Enjoy your time there - and don't forget that not all of us germs wear leather pants and drink beer until they pass out. :lol:

alex
0
User avatar
shura 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Fri Oct 01, 2010 10:21 pm

shura wrote:and don't forget that not all of us germs wear leather pants and drink beer until they pass out. :lol:

What?! I've been lied to!! :D
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Fri Oct 01, 2010 10:23 pm

Jeff Hammond wrote:yeah, it works in sketchup..
tt's script scales everything to a square so i made the mistake of adding more black for an overall 500x500 px (4times the recommended resolution of 250x250)..

it came in at a modest 1.25 million entities :D


I'll update it with a tool for placing the mesh in the model, with correction aspect ratio and let you define a height - basically let you draw a bounding box.
Maybe even with an option to sample less pixels.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Fri Oct 01, 2010 10:24 pm

thomthom wrote:Maybe even with an option to sample less pixels.

Or... Maybe interpolate pixels... Though - the same could be done by the user by just scaling down the image...
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Fri Oct 01, 2010 10:30 pm

Dedmin, thanks. Since I haven't been able to do it yet, I don't know but I fully expect I'd have to scale the mesh to the right size. Looks like Jeff managed it, though.

As to the excel tables into LO, yes. I did see that. You can't do anything about formatting once it is in, though. Oh well, maybe in LO4.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby shura » Fri Oct 01, 2010 10:37 pm

just used an alpha map and deleted the lower part of the mesh, then flattened it. not talking about quality, but at least it looks like some sort of image tracing...

zz.jpg
0
User avatar
shura 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby ken28875 » Fri Oct 01, 2010 11:20 pm

Wow! :shock: :shock:

You keep on amazing me with your plugins, Thomas! You're the man.

Thank you very much,

_KN
0
Follow Your Dreams.
User avatar
ken28875 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Chris Fullmer » Fri Oct 01, 2010 11:55 pm

thomthom wrote:Test with simple displacement map:

Displacement.png


MMMmmmm, a plugin that makes chocolate bars. I'm hungry now!
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Sat Oct 02, 2010 10:00 am

:D
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby MALAISE » Sat Oct 02, 2010 3:02 pm

ThomThom , for your own knowledge, you should get advantages by visiting ImageJ community (OpenSource)http://www.google.fr/url?sa=t&source=web&cd=1&ved=0CBUQFjAA&url=http%3A%2F%2Frsbweb.nih.gov%2Fij%2F&rct=j&q=ImageJ&ei=ujqnTJXjIZGp4AbwxvGjDQ&usg=AFQjCNGnkzWAmC5t2IbtD4C8ayw1R0v7tg&sig2=e2-bW7zDggSXIeVI7vPRbA&cad=rja. They work around scientific pictures, and all the ways to extract informations .

Thank you really very much for all the plugins you give us.

MALAISE
0
La Connaissance n'a de valeur que partagée
User avatar
MALAISE 
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Sun Oct 03, 2010 12:23 pm

Except with very small BMP files, I don't seem to have any luck. Even with a small BMP file it takes a long time to process but that could just be my computer.

Coen's comment though is intriguing. I was thinking this plugin could be a neat way to get line drawings into SketchUp. I made the attached line drawing as a quick test and got the second image as a result. I inverted the image and got the results in the third image. I wonder if it would be possible to have a control to somehow limit the range in the gray scale. Perhaps any RGB value less than, say, 250,250,250 gets read as 0,0,0? Or perhaps no height is assigned? Perhaps it isn't possible but I wonder.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Rich O Brien » Sun Oct 03, 2010 12:27 pm

Making Knuckle-Dusters Dave?
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Sun Oct 03, 2010 12:28 pm

Maybe I should. :D I was just doodling on the pad using AutoDesk Sketchbook.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Sun Oct 03, 2010 12:43 pm

Dave R wrote:I wonder if it would be possible to have a control to somehow limit the range in the gray scale. Perhaps any RGB value less than, say, 250,250,250 gets read as 0,0,0? Or perhaps no height is assigned? Perhaps it isn't possible but I wonder.

It's technical possible to read values lower than 250 as 0, but I don't quite get why?
Though you can do it in PS (or similar) by adjusting the Levels.)


I have an idea of how to make the mesh less spiky though, but it needs some experimenting.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Sun Oct 03, 2010 12:51 pm

I was just thinking that setting some limit so that everything is either black or white and not shades of gray would get rid of the spikes.

Would it be possible to work things so that a face is created only if the value is less than some set point (250,250,250?) and the face is always at Z=0? Delete coplanar edges between faces and you'd have a raster to SKP converter.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Rich O Brien » Sun Oct 03, 2010 1:02 pm

I like that idea :thumb:

Kind of Footprint or Ink Stamp tool, lots of uses for it too!
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby thomthom » Sun Oct 03, 2010 1:24 pm

Dave R wrote:I was just thinking that setting some limit so that everything is either black or white and not shades of gray would get rid of the spikes.

The spikes you see if much due to the extreme height of the mesh, and part due to the current triangulation. I'm not sure if making the contrast bigger will reduce then - in either case, Ruby isn't efficient for image manipulation - you'd be just as well off just preparing the image before in an proper image editor.


Dave R wrote:Would it be possible to work things so that a face is created only if the value is less than some set point (250,250,250?) and the face is always at Z=0? Delete coplanar edges between faces and you'd have a raster to SKP converter.

It'd be an interesting new tool, but I still think it's best if the image is prepared by the user in an editor and made into complete Black and White (not grey scale).

Then the tool could read all the white or black and generate a mesh - where it could then afterwards trace the outline and remove the interior lines. After running an curve simplification, like the Douglas-Peucker algorithm, and you could end up with a decent vectorized shape from your raster mask.

This would have been so much better if I could read the alpha channel of PNG files. I was a looking at this some time ago, but existing too many third party libraries for my comfort which makes redistribution more complex. The alternative, making a pure standalone ruby PNG interpreter wasn't so easy either, the decompression algorithm wasn't the easiest.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.1.0a) — 30 September 2010

Postby Dave R » Sun Oct 03, 2010 1:31 pm

Well, it's all voodoo to me so I am glad we have folks like you.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Bitmap To Mesh (0.2.0b) — 03 October 2010

Postby thomthom » Sun Oct 03, 2010 3:56 pm

Version 0.2.0b
  • Made into a tool so the user can easily position the mesh
  • Moved menu to Draw > Mesh From Bitmap
  • Keeps aspect ratio of image or Image element
  • Right click and Image element to generate a mesh. (Does not need to be BMP image - but Draw > Mesh From Bitmap still require BMP imput)
  • Colour BMP images will convert the RGB value to optical greyscale.
  • VCB support
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.2.0b) — 03 October 2010

Postby thomthom » Sun Oct 03, 2010 4:57 pm

TerrainTest.png


Test using sample maps from: http://www.mtgrafix.com/programs/terrain.html

Also tried this: http://www.twisteddirt.com/TutorialStuff/dem_02.php Nice terrain shape - but the diffuse texture wasn't so good.
1
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.2.0b) — 03 October 2010

Postby dedmin » Sun Oct 03, 2010 4:58 pm

or-a-24-0039.jpg


2010-10-03_185534.jpg

2010-10-03_185511.jpg
0

dedmin 
 

Re: [Plugin] Bitmap To Mesh (0.2.0b) — 03 October 2010

Postby thomthom » Sun Oct 03, 2010 5:07 pm

308px × 1 047px - that would make the mesh ~500-600K faces?

And the issue with that bitmap is that despite it being a greyscale, it's still not a height map - which is why the mesh doesn't come out looking as what the image illustrate.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Bitmap To Mesh (0.2.0b) — 03 October 2010

Postby dedmin » Sun Oct 03, 2010 5:11 pm

Yes, true. I just wanted to test it - the file is 105 MB :roflmao:
0

dedmin 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

PreviousNext


 

Return to Plugins

Who is online

Users browsing this forum: allen0901, baguni35, Btdghyj, budiono suparman, dburhan, sjlee_1119, sue06 and 12 guests

Visit our sponsors: