sketchucation logo sketchucation
    • Login
    1. Home
    2. eczkchtl
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    E
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 1

    eczkchtl

    @eczkchtl

    10
    Reputation
    1
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    eczkchtl Unfollow Follow
    registered-users

    Latest posts made by eczkchtl

    • RE: Exporting UVs for Groups via PolygonMesh

      @unknownuser said:

      • default material -> will use the group material with simple planar UV if exists, otherwise default front/back color

      It is this case which is a little torublesome, with a default material for the group and no material for the faces in the group. So how do I get these "simple planar UV" coordinates? And do I need to do some conversion to get the UVs which in the end are used for rendering?

      What I do now:

      for each face in group;
        mesh = face.mesh(5) # Get points, normals and UVs for front faces
        for each vertex;
          uv = mesh.uv_at(index,1)
      

      EDIT:

      I think i've got it now. The UVs from PolygonMesh are in the case above not rendering UVs but instead need to be divided by the width and height of the material. Me getting uninitialized values was just an error in the importer-program which read the files I've exported. It's still peculiar that getting UVs with PolygonMesh for ungrouped faces gives actual rendering UVs while with a group material they need to be converted. We end up with some extra (unnecessary?) special cases.

      posted in Developers' Forum
      E
      eczkchtl
    • RE: Exporting UVs for Groups via PolygonMesh

      @unknownuser said:

      try and apply a 1m x 1m texture on :

      • a face 1m x 1m
      • a face 1m x 1m inside a group
      • on a group that contains a default 1m x 1m face
        ...

      Yes, if you group the face, set material, move the group and then explode it, the texture will be offset to the coordinates of the new position. I don't mind this behavior. Maybe there are other grouping "quirks" also.

      However, this has little to do with my problem ๐Ÿ™‚
      At least the groups have some UVs which are visible in sketchup and the artist may be fine with these if they look OK. Then when exporting they get mashed. When you get the UVs with PolygonMesh from a script they are just random large numbers (i.e. not initialized) in the group-before-material case.

      posted in Developers' Forum
      E
      eczkchtl
    • RE: Exporting UVs for Groups via PolygonMesh

      @plot-paris said:

      I think this is because a texture has to be applied directly to a face to contain any uv information.
      thats why you can't right click a group and choose the texture position options - SketchUp has no idea which of all the faces within the group you are refering to. neither is it possible to select several faces at once to position a texture.

      But still you can texture a whole group and sketchup generates some UVs for its internal use. And I suspect there's no way to get these coordinates from a ruby script?

      posted in Developers' Forum
      E
      eczkchtl
    • Exporting UVs for Groups via PolygonMesh

      Hi, I have trouble exporting UVs from groups in my Ruby plugin.

      When creating a group and then assigning a material to the whole group there seem to be a problem with generating UVs. Textures show up correctly in sketchup but when iterating through all faces in the group, and converting them to polygon meshes, UVs are incorrect.

      It's easily fixed by exploding the group and then group it again, but that shouldn't be necessary. Also the UVs are slightly changed when exploding. I haven't tried using the UVHelpers in the script though, might get correct UVs then. Nonetheless I think it ought to be fixed in future versions of sketchup.

      Have anyone noticed the this problem?

      posted in Developers' Forum
      E
      eczkchtl