SketchUcation Plugin Store

 

 

[Plugin] Bitmap To Mesh (0.4.0b) — 08 February 2011

[Plugin] Bitmap To Mesh (0.4.0b) — 08 February 2011

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 )



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

Version 0.2.0b
  • Made into a tool so the user can easily position the mesh
  • Moved menu to Draw > Mesh From Heightmap
  • 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 Heightmap still require BMP imput)
  • Colour BMP images will convert the RGB value to optical greyscale.
  • VCB support


Version 0.3.0b
  • Renamed Mesh From Bitmap to Mesh From Heightmap
  • Added new Mesh From Bitmap
MeshFromBitmap.jpg



Requirements
  • SketchUp 7 or newer - ( Other versions untested )
  • TT_Lib2

Download


tt_bitmap2mesh.rb


Footprint
<Sketchup>/Plugins/
+-
tt_bitmap2mesh.rb

Please, register (free) to access all the attachments on the forums.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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

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

Recognize it?
:D
Please, register (free) to access all the attachments on the forums.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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?
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
Pilou
Top SketchUcator
 
Posts: 10027
Joined: Wed Jan 23, 2008 10:33 pm
Operating system: Windows
SketchUp version: 6
License type: Free
SketchUp use: hobby
Level of SketchUp: Advanced

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
tald311
Premium Member
Premium Member
 
Posts: 54
Joined: Fri Jun 13, 2008 5:47 pm
Location: Denver, Colorado
Name: tald311
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: landscape architecture
Level of SketchUp: Advanced

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" ?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd
 
Posts: 1018
Joined: Wed Nov 14, 2007 10:47 am
Location: Romania
Name: TBD

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

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

Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
Pilou
Top SketchUcator
 
Posts: 10027
Joined: Wed Jan 23, 2008 10:33 pm
Operating system: Windows
SketchUp version: 6
License type: Free
SketchUp use: hobby
Level of SketchUp: Advanced

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:
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.)
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd
 
Posts: 1018
Joined: Wed Nov 14, 2007 10:47 am
Location: Romania
Name: 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?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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.
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd
 
Posts: 1018
Joined: Wed Nov 14, 2007 10:47 am
Location: Romania
Name: 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
Please, register (free) to access all the attachments on the forums.
User avatar
shura
 
Posts: 376
Joined: Wed Jan 21, 2009 12:43 am
Name: Alexander
Operating system: Windows
SketchUp version: 7
License type: Pro
SketchUp use: interior design
Level of SketchUp: Intermediate

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.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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... :(
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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?
A designer is an emerging synthesis of artist, inventor, mechanic, objective economist and evolutionary strategist. - R. Buckminster Fuller
Some of my 3D crap
User avatar
EarthMover
Top SketchUcator
 
Posts: 1792
Joined: Fri Sep 12, 2008 9:06 pm
Location: Eastern Pennsylvania
Name: Adam Hails

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.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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
Please, register (free) to access all the attachments on the forums.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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!
Whaat
 
Posts: 966
Joined: Wed Nov 14, 2007 9:51 pm
Location: Saskatchewan, Canada
Name: Dale Martens
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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

Postby Jeff Hammond » Thu Sep 30, 2010 11:03 pm

water.jpg
Please, register (free) to access all the attachments on the forums.
dotdotdot
User avatar
Jeff Hammond
Global Moderator
 
Posts: 4308
Joined: Thu Jan 24, 2008 11:16 pm
Location: newyorkcity
Operating system: Mac
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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...
Kristoff Rand
Home Designer
Custom House Plans with a Point of View
User avatar
Krisidious
 
Posts: 3151
Joined: Mon Oct 22, 2007 1:52 pm
Location: Springfield, Missouri. USA
Name: Krisidious
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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:
A designer is an emerging synthesis of artist, inventor, mechanic, objective economist and evolutionary strategist. - R. Buckminster Fuller
Some of my 3D crap
User avatar
EarthMover
Top SketchUcator
 
Posts: 1792
Joined: Fri Sep 12, 2008 9:06 pm
Location: Eastern Pennsylvania
Name: Adam Hails

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...
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17545
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

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!
Please, register (free) to access all the attachments on the forums.
If I make it look easy. . .rest assured--it probably is.
User avatar
David_H
Top SketchUcator
 
Posts: 2279
Joined: Wed Nov 28, 2007 9:31 pm
Location: Salt Lake City, UT
Name: David Hunter

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.
Inspecting mirrors is a job I could easily see myself doing.
User avatar
Dave R
Global Moderator
 
Posts: 8972
Joined: Tue Nov 13, 2007 11:52 pm
Location: SE Minnesota
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: woodworking
Level of SketchUp: Advanced

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
Please, register (free) to access all the attachments on the forums.
dedmin
 
Posts: 823
Joined: Thu Oct 02, 2008 10:40 pm

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. ;)
Inspecting mirrors is a job I could easily see myself doing.
User avatar
Dave R
Global Moderator
 
Posts: 8972
Joined: Tue Nov 13, 2007 11:52 pm
Location: SE Minnesota
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: woodworking
Level of SketchUp: Advanced

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
Please, register (free) to access all the attachments on the forums.
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
 
Posts: 4308
Joined: Thu Jan 24, 2008 11:16 pm
Location: newyorkcity
Operating system: Mac
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Need SketchUp Books, Models, Styles or Textures? Check out our One Stop Shop for SketchUp.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012

Next

Return to Plugins

Who is online

Users browsing this forum: bartosz, intelthunder and 7 guests