sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Bitmap To Mesh

    Scheduled Pinned Locked Moved Plugins
    264 Posts 75 Posters 420.7k Views 75 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dave RD Offline
      Dave R
      last edited by

      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.


      Image001cropped.jpg


      BMP2Mesh Results.jpg


      BMP2Mesh Inverted.jpg

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

      1 Reply Last reply Reply Quote 0
      • Rich O BrienR Offline
        Rich O Brien Moderator
        last edited by

        Making Knuckle-Dusters Dave?

        Download the free D'oh Book for SketchUp 📖

        1 Reply Last reply Reply Quote 0
        • Dave RD Offline
          Dave R
          last edited by

          Maybe I should. 😄 I was just doodling on the pad using AutoDesk Sketchbook.

          Etaoin Shrdlu

          %

          (THERE'S NO PLACE LIKE)

          G28 X0.0 Y0.0 Z0.0

          M30

          %

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @dave r said:

            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.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • Dave RD Offline
              Dave R
              last edited by

              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.

              Etaoin Shrdlu

              %

              (THERE'S NO PLACE LIKE)

              G28 X0.0 Y0.0 Z0.0

              M30

              %

              1 Reply Last reply Reply Quote 0
              • Rich O BrienR Offline
                Rich O Brien Moderator
                last edited by

                I like that idea 👍

                Kind of Footprint or Ink Stamp tool, lots of uses for it too!

                Download the free D'oh Book for SketchUp 📖

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @dave r said:

                  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 said:

                  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.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • Dave RD Offline
                    Dave R
                    last edited by

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

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      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

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        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.

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          dedmin
                          last edited by

                          or-a-24-0039.jpg

                          2010-10-03_185534.jpg
                          2010-10-03_185511.jpg

                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            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.

                            Thomas Thomassen — SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              dedmin
                              last edited by

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

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                Yea - the last texture I tested was 512x512 - heavy mesh. And I'd forgotten that Autosave was on - every 5 mins. x_X

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  dedmin
                                  last edited by

                                  2010-10-03_191933.jpg

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    dedmin
                                    last edited by

                                    2010-10-03_192956.jpg

                                    1 Reply Last reply Reply Quote 0
                                    • shuraS Offline
                                      shura
                                      last edited by

                                      Why don't I get the Curve Simplification to work?

                                      Test.jpg

                                      TestSorry.jpg

                                      1 Reply Last reply Reply Quote 0
                                      • thomthomT Offline
                                        thomthom
                                        last edited by

                                        hm... possibly you have a version where it failed on closed loops. I might not have uploaded a corrected version...

                                        Thomas Thomassen — SketchUp Monkey & Coding addict
                                        List of my plugins and link to the CookieWare fund

                                        1 Reply Last reply Reply Quote 0
                                        • david_hD Offline
                                          david_h
                                          last edited by

                                          So I notice these wonderful meshes created. How is one controlling the height of the extrusion?

                                          If I make it look easy...It is probably easy

                                          1 Reply Last reply Reply Quote 0
                                          • P Offline
                                            pichuneke
                                            last edited by

                                            The pieces on the roof (above the pediment) are made with your plugin 😄


                                            http://farm5.static.flickr.com/4103/5053994977_c27d104e30_z.jpg
                                            Reconstrucción del Templo de Artemis Agrotera 4 by Egocentrico, on Flickr

                                            relieve3.png

                                            Click here to see it in bigger size (1024 px):

                                            Link Preview Image
                                            All sizes | Reconstrucción del Templo de Artemis Agrotera 4 | Flickr - Photo Sharing!

                                            The safest and most inclusive global community of photography enthusiasts. The best place for inspiration, connection, and sharing!

                                            favicon

                                            (www.flickr.com)

                                            Forgive my spanglish...

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 5
                                            • 6
                                            • 7
                                            • 8
                                            • 9
                                            • 13
                                            • 14
                                            • 7 / 14
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement