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

    Selecting All Visible Faces

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 5 Posters 5.5k Views 5 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.
    • thomthomT Offline
      thomthom
      last edited by

      And another problem with raytest is what points to test? testing just vertices isn't enough, they could all be hidden from the camera, but a part of the surface might be visible.

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

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        I just wrote a test code that run pickhelper on every x,y of the screen and adds everything it hits to the selection.

        It worked ok. Biggest problems are that it can miss tiny faces (though it was a LOT better than I thought it would be) and even worse - it was over-zealous. It added things that were definitely not visible.

        But I'd say it was about 80% good. You can play with it here:

        WARNING: This is EXTREMELY slow. Minimize your window to a large thumbnail size view if you just want to quickly test this. Full size window takes easily over an hour to process I think.

        view = Sketchup.active_model.active_view
        Sketchup.active_model.selection.clear
        w = view.vpwidth
        h = view.vpheight
        w.times do |x|
          h.times do |y|
            ph = view.pick_helper
            ph.do_pick x,y
            t = ph.all_picked
            t.each do |ent|
              if (ent.is_a? Sketchup;;Face) or (ent.is_a? Sketchup;;Edge)
                Sketchup.active_model.selection.add ent
              end
            end
          end
        end
        

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

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

          The pick_helper has an aperture, have you tried adjusting that and see if you get different results?

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

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            No, I did not play with it at all....might be intersting.

            I think the reason it over actively picks things is at least 2 fold. 1 - I am adding all picked ents (as opposed to best_picked, which I think you hit an edge of a face that is not visible, it returns the face anyhow. 2 - it seems to pick right through close faces. So if a hidden face is clse to the front face, I think it wll pick right through the front face, much like z-fighting.

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Hi Chris, That's a neat snippet.

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                Thanks, it would be a lot cooler if it was fast and accurate πŸ˜„ I would like to play with the aperture size. Maybe that would help speed things up? What if the aperture could be sut to the height and width of the monitor, and then just run a single "pick" and choose all selected. I'll try to play with it when I get a chance, unless someone beats me to it.

                Chris

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

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

                  I was thinking that the aperture was why you got entities not really visible,,, πŸ˜•

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

                  1 Reply Last reply Reply Quote 0
                  • honoluludesktopH Offline
                    honoluludesktop
                    last edited by

                    Chris, I used your scanning engine in this plugin. It adjust the fov to decrease the scanning time, but it is still slow. However it will help me port, and correctly face my Cad models for visualization in Sketchup. Thanks.

                    The attached images are of a model that contains a total of 2,000 edges and 650 faces. It took about 45 seconds to check the view and reverse the back faces.

                    Test model with front and back faces.
                    Test model with back faces reversed in model view.

                    1 Reply Last reply Reply Quote 0
                    • G Offline
                      gude
                      last edited by

                      Chris's method along with 'deselect faces that have normals away from camera'
                      will do the task,
                      What if,
                      Just to filter the occluded faces.
                      but might be elementary
                      Is it feasible to project random points from planes in the camera.direction to test if the points do project on other planes?

                      Would it be taking too much to calculate?
                      this filter might include the partially visible ones any ways.

                      1 Reply Last reply Reply Quote 0
                      • G Offline
                        gude
                        last edited by

                        I couldnt understand the way they did it here
                        http://forums.cgsociety.org/archive/index.php/t-197347.html

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

                          @gude said:

                          I couldnt understand the way they did it here
                          http://forums.cgsociety.org/archive/index.php/t-197347.html

                          That is the method I mentioned earlier - it selects the faces which normal is pointing towards the camera - but it doesn't take into account other faces blocking the view.

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

                          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