[Plugin] Bitmap To Mesh

[Plugin] Bitmap To Mesh

Postby thomthom » Thu Sep 30, 2010 1:14 pm

Overview
Generates a mesh from a given BMP image.

Note! Generates two triangles per pixel!
250x250 pixel image generates a mesh of ~125K faces! ( 250 * 250 * 2 )

ImageToHeightmapMesh.gif


HeightmapToMesh.gif


BitmapToMesh.gif




Beware!
This is a quick experimental beta release!
Gremlings might lurk!

BMP2Mesh.png


Access
Draw > Mesh From Heightmap
Context Menu > Mesh From Heightmap
Context Menu > Mesh From Bitmap

Compatibility

SketchUp 2018 or newer

  • All features

SketchUp 2014 to SketchUp 2017

  • No down-sampling of heightmaps.
  • Limited image formats supported.

SketchUp 2014 to SketchUp 2016

  • Degraded text display.

Download



11
Last edited by thomthom on Tue Feb 27, 2018 10:06 pm, edited 2 times in total.
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 » Thu Sep 30, 2010 1:21 pm

Recognize it?
:D
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.1.0a) — 30 September 2010

Postby pilou » Thu Sep 30, 2010 1:22 pm

Yes, it's the beast who makes some crazzy copter and boat :mrgreen:

Have you a ratio x*y time elapsed?
0
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

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

Postby tald311 » Thu Sep 30, 2010 2:39 pm

wow - thats amazing!
Quick question - if you were to import a BPM image of contours and terrain, could you generate a DEM with this?
Really amazing work. Thank you!
Daniel
0

tald311 
Premium Member
Premium Member
 

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

Postby thomthom » Thu Sep 30, 2010 2:45 pm

tald311 wrote:Quick question - if you were to import a BPM image of contours and terrain, could you generate a DEM with this?

"DEM" ?
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 » Thu Sep 30, 2010 2:49 pm

tald311 wrote:Quick question - if you were to import a BPM image of contours [...]

It does not find contour edges - if that is what you mean. It simply uses the grey scale value of each pixel.
The type of image you feed it should be like those you feed to bump maps and displacement maps in render engines. White is high point and black is low point - then you have shades of grey in between.

Detecting contours in an image is not easy (beyond me) - and even if you managed to find the contours - I'd no idea how you'd determine the Z order of them.
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 tbd » Thu Sep 30, 2010 2:58 pm

did something like this some years ago (2005 i think) and used it for quick creation of landscape hills/mountains.
version 2 that was work in progress (and killed) had an openGL viewer to quickly see the output before importing in Sketchup.

nice work Thomas
0
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd 
 

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

Postby pilou » Thu Sep 30, 2010 3:03 pm

0
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

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

Postby thomthom » Thu Sep 30, 2010 3:10 pm

TBD wrote:did something like this some years ago (2005 i think) and used it for quick creation of landscape hills/mountains.
version 2 that was work in progress (and killed) had an openGL viewer to quickly see the output before importing in Sketchup.

None of these versions are available anywhere?
OpenGL viewer within SU? :shock:
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 » Thu Sep 30, 2010 3:12 pm

Pilou wrote:Yes, it's the beast who makes some crazzy copter and boat :mrgreen:

Have you a ratio x*y time elapsed?

No detailed progress indication, no. But I did this very quickly. I'll improve it - with a tool for visually indicating the size of the mesh. Maybe with option to map with the heightmap as a material.
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 » Thu Sep 30, 2010 3:15 pm

Pilou wrote:Format Dem ;)

tald311 wrote:could you generate a DEM with this?

I see now - no you can't. It would be the other way around, you could generate a SketchUp mesh from a DEM. (Though a very large DEM would most likely kill SU.)
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 tbd » Thu Sep 30, 2010 3:19 pm

thomthom wrote:None of these versions are available anywhere?


nope. it was on old @Last Sketchup forums and lost.

thomthom wrote:OpenGL viewer within SU? :shock:


yep. in a separate window and it worked pretty well.
0
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd 
 

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

Postby thomthom » Thu Sep 30, 2010 3:25 pm

TBD wrote:nope. it was on old @Last Sketchup forums and lost.
:(
And v2?

TBD wrote:yep. in a separate window and it worked pretty well.

C-Extension? How did you generate and interface with this window?
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 tbd » Thu Sep 30, 2010 3:43 pm

v2 lost on a hdd crash. yup, via a CExt using http://glew.sourceforge.net/basic.html to create and interact with the openGL window. used only a simple wireframe view for testing but it is possible to create a textured/shader scene as well.
0
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd 
 

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

Postby shura » Thu Sep 30, 2010 3:45 pm

Genius!
Thomas you have a great fan in me. Many times I thought "glad that I have insisted on paying for our lunch the day we met, dunno when I get the next chance to buy him cookies".
With this release my credit is definitely used up...
...playing for time I extruded a cookie for you, until I get a better ideas ;-)

Thanks for this plugin, I bet there are a thousand interesting ways to use it.

cheers
alex


ThomasCookie.jpg
0
User avatar
shura 
 

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

Postby thomthom » Thu Sep 30, 2010 4:24 pm

:lol: That's great Alex! :D

Btw - you wouldn't happen to be around München next week? The office is going for a trip - Wednesday 'til Sunday... I think.
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 » Thu Sep 30, 2010 4:30 pm

TBD wrote:v2 lost on a hdd crash. yup, via a CExt using http://glew.sourceforge.net/basic.html to create and interact with the openGL window. used only a simple wireframe view for testing but it is possible to create a textured/shader scene as well.

Sounds like you had all sorts of fun experimental things lost in this HDD crash... :(
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 EarthMover » Thu Sep 30, 2010 4:35 pm

This is great Thomas.

Do you think it's possible to use the bitmap data to do other things besides generate a point cloud terrain? Could you transfer black lines on a bit map to lines on a face? Could you offset and pushpull based on pixel color data? Just thinking of how to take Silver Shadow's original request to generate a brick wall with depth using a bitmap and make it more polygon friendly. It's great, but using a point cloud terrain to generate several wall textures will bring SU to it's knees.

Could you possibly glean the UVW coordinates of a texture applied to a face and tile the 3D geometry as components over those coordinates?
0
3D Artist at Clearstory 3D Imaging
Guide Tool at Winning With Sketchup
Content Creator at Skapeup
User avatar
EarthMover 
Premium Member
Premium Member
 

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

Postby thomthom » Thu Sep 30, 2010 4:48 pm

EarthMover wrote:Could you offset and pushpull based on pixel color data?

It's possible - but not easy - I don't know how.

EarthMover wrote:It's great, but using a point cloud terrain to generate several wall textures will bring SU to it's knees.

You could use CleanUp to reduce excess faces/edges for uniform textures.
But in any case - keep the texture files small.

EarthMover wrote:Could you possibly glean the UVW coordinates of a texture applied to a face and tile the 3D geometry as components over those coordinates?

The texture would have to be BMP - as there is no built in method to get access to the texture data in SU. But it is possible - however, this is also something that turns rather complicated. Though would be an interesting project I can't see myself taking it in this direction - I got at the moment UV Tools, Bezier Surface and Vertex Tools as my main focus (that is not including smaller updates/projects).

I will be updating it with some smaller improvements, but if anyone want to take it further then be my guest. I just threw this together today during a break as I realised that most the code would be reading the image files - which I already had the codes for from Vertex Tool's toolbar system.
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 » Thu Sep 30, 2010 10:42 pm

Test with simple displacement map:

Displacement.png
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 Whaat » Thu Sep 30, 2010 10:53 pm

cool stuff! I'm guessing that with some work, you could take a BMP texture applied to an existing mesh and use it to displace the mesh?

Great work Thom!
0

Whaat 
PluginStore Author
PluginStore Author
 

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

Postby jeff hammond » Thu Sep 30, 2010 11:03 pm

water.jpg
1
dotdotdot
User avatar
jeff hammond 
Global Moderator
 

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

Postby Krisidious » Thu Sep 30, 2010 11:10 pm

you ROCK!!! :ecstatic:

where are my old bump maps? time to go play...
0
By: Kristoff Rand
Home Designer
Unique House Plans
User avatar
Krisidious 
 

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

Postby EarthMover » Thu Sep 30, 2010 11:29 pm

Whaat wrote:cool stuff! I'm guessing that with some work, you could take a BMP texture applied to an existing mesh and use it to displace the mesh?

Great work Thom!



I'm looking forward to that...with perhaps a poly count adjustment. :thumb: :thumb:
0
3D Artist at Clearstory 3D Imaging
Guide Tool at Winning With Sketchup
Content Creator at Skapeup
User avatar
EarthMover 
Premium Member
Premium Member
 

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

Postby thomthom » Fri Oct 01, 2010 7:09 am

Whaat wrote:cool stuff! I'm guessing that with some work, you could take a BMP texture applied to an existing mesh and use it to displace the mesh?

Possible - but you'd risk an insanely heavy mesh...

EarthMover wrote:with perhaps a poly count adjustment.

Well, one could sample less of the image...

If I was better at math I could work out where the contrasts where and use more points from those areas...
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 david_h » Fri Oct 01, 2010 5:39 pm

I finally got it to work. I had to the LIB2 thing. It always takes me a little longer. At first i thought it was hanging on me and on some images it did, but I played around with my BMP in phoshop and got the mesh to work. Take a look: see if you can figure it out. Cool plugin. Don't know how I will use it yet but it's cool!
1
If I make it look easy...It is probably easy
User avatar
david_h 
Top SketchUcator
 

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

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

This does seem like a plugin with a lot of potential. I gave it a try with a BMP version of the following image but it didn't appear that anything was happening. It seemed to lock up my computer but it should probably be chalked up to the lousy computer I have at work.



This height map was actually created in SU to begin with.
-1
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 6:09 pm

Quick test in Rhino:
2010-10-01_200759.jpg
1

dedmin 
 

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

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

Dedmin, did you try to do it with ThomThom's script in SU?

By the way, I think it looks nicer in SketchUp. ;)
1
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:45 pm

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
0
Last edited by jeff hammond on Fri Oct 01, 2010 7:10 pm, edited 1 time in total.
dotdotdot
User avatar
jeff hammond 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: anna_m3v, NatoxD, PoZzHak, shake1, SkyChing and 10 guests