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

    Sketchup front back face

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 780 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.
    • G Offline
      giuseppe500
      last edited by

      hello.
      I have created a sketchup importer for opengl 2 in c++.
      My problem is that i wish recognize if a face is front face or backface.
      I'm ispired from the skpToXml demo , and i read about outer loop and inner loop.
      When I'm import simple models all work , but for certain models i don't see part of the scene or textures are flipped.
      then:

      1)is possible recognize a front/back face from the importer(not in the shader)?How?
      2)is possible that a complex face ( nLoops>1 like the example skpToXml)is a back face? because i read that outer loop are always in ccg order or always cw i dont remember.

      I'm trying to flip all the backface or flip all the front face for reach an uniformity(all front face or all back face), this clearly is all to do only in importation phase , then i create a custom xml or serialize all in binary for speed up the loading.

      In the shader i see if a face is a front face or back face with the FACE semantic (is automatic and already done), in cg for example FACE return < 0 if the face is a backface and > 0 if the face is a front face.

      Thanks.

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

        A face has several properties that might help.
        face.normal returns the faces direction
        face.outer_loop.vertices are returned counter-clockwise to the face.normal.
        So if you know the order of the vertices and the normal you can work out which is the front and back of the face...
        If you export a face by getting its loops and their vertices the outer_loop's clock-ness gives you its normal/front...
        IF parts of your model ARE made wrongly - so the back-face is the wrong way it WILL export 'perfectly' - i.e. 'wrong'!!!

        TIG

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

          thanks tig.
          I understand, you were very kind, but I just can not find property Normal.
          I'm Using sketchup 8 and C + +, perhaps in the 'SDK for C + + is called in another way.
          can 'be?
          else:
          I have seen examples in the SDK that tests if the loops are == 1, and the commentary says it is a simple face, if not then use the "== 1" it use the
          "CreateMesh (PolygonMeshPoints | PolygonMeshNormals, m_pPerspective, & m_pMesh);"
          in this case the faces are always counter-clockwise or do I need to know the normal property ?
          I see that there is a property get_Plane, i can use this?
          but how?
          thanks.

          ps sorry for my english

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

            If you get the face's plane you should be able to work out it's normal ?
            A plane is effectively an array of a point and a vector ?? The vector is the 'normal'...

            TIG

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Try posting to the C++ SDK forum:
              http://groups.google.com/group/su-sdk-fileshare/topics

              I'm not here much anymore.

              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