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

    Face pointing towards the camera?

    Scheduled Pinned Locked Moved Developers' Forum
    25 Posts 7 Posters 1.0k Views 7 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.
    • M Offline
      MartinRinehart
      last edited by

      @adamb said:

      But thats much more work than a dot product. Your turning an orientation problem into something its not.

      I'm not seeing how a dot product solves the problem. Could you articulate or maybe Sketch something Up?

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

        The result of the dot product can be used to determine if its the front or back side pointing towards the camera.

        t = ph.transformation_at(index) n = picked.normal.transform(t).normalize # global vector orientation c = Sketchup.active_model.active_view.camera.direction m = (c % n > 0) ? e.back_material : e.material

        If the dot product is positive then the backface is facing the camera, otherwise it's the front side.

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

        1 Reply Last reply Reply Quote 0
        • M Offline
          MartinRinehart
          last edited by

          @thomthom said:

          The result of the dot product can be used to determine if its the front or back side pointing towards the camera.

          t = ph.transformation_at(index) n = picked.normal.transform(t).normalize # global vector orientation c = Sketchup.active_model.active_view.camera.direction m = (c % n > 0) ? e.back_material : e.material

          If the dot product is positive then the backface is facing the camera, otherwise it's the front side.

          Who is ph? Who is picked?

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

            ph is the PickHelper I used and picked is the face picked.

            It was taken from my test code.

            this is a more condensed sample:
            back_side = camera.direction % global_face_normal > 0

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

            1 Reply Last reply Reply Quote 0
            • T Offline
              tomasz
              last edited by

              @thomthom said:

              Any clues to how to determine that?

              Check my FrontFace.
              I just compare normals. The global transformation problem is solved by shooting a ray. That allows you to get an array of all parents of a face.

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

              Advertisement