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

    [REQUEST] bitmap to mesh with materials

    Scheduled Pinned Locked Moved Plugins
    14 Posts 3 Posters 1.2k Views 3 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      You might be in luck... I have been developing a set of Image manipulation 'jar' files. It would be quite possible take a Selected Image and extract each pixel from in turn with its RGB value and then make a dat file of it that SUP can process into squares equivalent to the image and new materials for each color...
      I see the dat file being like this... assuming a 6x6 image with RRGGRR colors on each line
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      255,0,0 255,0,0 0,255,0 0,255,0 255,0,0 255,0,0
      Using lines=IO.readlines(datfile) it then works out how wide and high the pixel-image is and makes a grouped set of flat faces so its overall size matches the original Image. It then takes a line from the lines at a time and checks the color of that 'square' using cols=line.split(' '), col=cols[0] etc and col=col.split(',') etc etc.
      Assembling a [new] Material name using something like...

      r=col[0]; g=col[1]; b=col[2]
      name="Mat-"+r+'-'+g+'-'+b
      mats=model.materials
      if not mat=mats[name]
       mat=mats.add(name')
       mat.color.red=r.to_i
       mat.color.green=g.to_i
       mat.color.blue=b.to_i
      end
      face.material=mat
      face.back_material=mat
      
      

      Here the first pixel material.name is "Mat-255-0-0", as that exists later any squares with that color use the existing one not making anew one...
      I'll think it through over the weekend... πŸ€“

      TIG

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

        I can easily make Bitmap to Mesh do that. Just a minor change from what it does now.

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

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          @thomthom said:

          I can easily make Bitmap to Mesh do that. Just a minor change from what it does now.

          Over to you ThomThom... πŸ˜‰

          TIG

          1 Reply Last reply Reply Quote 0
          • B Offline
            baldaman
            last edited by

            Dear ruby masters, thank you for your response.
            So it seems possible right?
            😍 😍 😍

            I allready imagine what a funny contest we could organise with this tool!!!
            πŸ˜„ β˜€ β˜€ πŸ˜„

            Ok let's prepare some cookies...

            1 Reply Last reply Reply Quote 0
            • B Offline
              baldaman
              last edited by

              Here is an exemple of what I did for a custom sunscreens system somwhere near equator. The goal is to stop every sun rays while in the same time according visual porosity toward sky. The visual porosity changes according the position of the observer.

              I used 3ds max and polyboost plugin's "bitmap select" feature. After that, back to Sketchup and "components onto face collections".
              The components layout what painted in photoshop with brushes in order to obtain gradations.

              I am also thinking of using this method for faΓ§ade panels variations.
              My goal is to be able to do the whole process inside Sketchup.

              PS: My english lessons are so far away: sorry for my frenglish

              T041_idmesh.jpg

              T038_idmesh.jpg

              T038_idmesh.jpg

              VOILES4_modif.jpg


              God bless proxies

              1 Reply Last reply Reply Quote 0
              • B Offline
                baldaman
                last edited by

                View from below

                T027.1.jpg

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

                  This is the season to be busy. I didn't manage to finish that update this weekend. I'll come. πŸ˜‰

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

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    baldaman
                    last edited by

                    Ok thanks Thom, please take all the time you need.
                    No hurry πŸ˜„

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

                      http://forums.sketchucation.com/download/file.php?id=60572&mode=view

                      http://forums.sketchucation.com/viewtopic.php?f=323&t=31339#p275772

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

                      1 Reply Last reply Reply Quote 0
                      • B Offline
                        baldaman
                        last edited by

                        😍 😍 😍 β˜€ β˜€ β˜€
                        You are the don Thom, thank you so much!!!
                        I am at the office now, not time to check this out
                        πŸŽ‰ πŸŽ‰ πŸŽ‰

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

                          Post back some samples of what you use it for. I'm very curious.

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

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            baldaman
                            last edited by

                            Works perfectly. β˜€
                            We need to be carefull with the number of colours of the bitmap!

                            After a few tests,

                            best settings are:
                            . indexed colors in photoshop or another image editor (in Photoshop you can choose the number, in the exemple below we have 12 colors)
                            . save as bmp (8bit, no compression).

                            First exemple is specialy dedicated to Thomthom πŸ˜„

                            pixel_cookie.jpg

                            1 Reply Last reply Reply Quote 0
                            • B Offline
                              baldaman
                              last edited by

                              More serious use exemples to come asap. πŸ˜‰

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement