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

    [Req] Texture Corrector.... PLEASE

    Scheduled Pinned Locked Moved Plugins
    40 Posts 10 Posters 10.1k Views 10 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

      I'm interested in this ruby as well. And there's an army of people over at the AsgVIS forum that need this utility.

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

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

        I'd even be willing to pay for this ruby.

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

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

          SketchUp does some weird stuff when it comes to backfaces. If you have a face where you apply a transparent texture on the front it automatically mirrors on the back if the backface has the default material. If you stretch and distort the texture on the front it updates the back. But if you apply a backface material, and you break that link. After removing the backface material to default, SU doesn't reset the mapping co-ordinates. Not until you make a change to the front side again, then it synchronizes again.

          So maybe an alternate method would be for the script to reset the backface material to default and "touch" the front material forcing SU to update the backface.

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

          1 Reply Last reply Reply Quote 0
          • S Offline
            silver_shadow
            last edited by

            I would also see this rubie happen. A lot of times i get a tree fro mxfrog and the textures of the face is correct on the one side but all messed up on the other side. It makes it difficult to present to clients if you dont want to render it (because rendering fix the problem) and present it in raw sketchup.

            1 Reply Last reply Reply Quote 0
            • free agentF Offline
              free agent
              last edited by

              is this a difficult script to write???

              http:i167.photobucket.comalbumsu143FreeAgent84bug.gif

              1 Reply Last reply Reply Quote 0
              • free agentF Offline
                free agent
                last edited by

                seriously NOTHING????!!!!!

                http:i167.photobucket.comalbumsu143FreeAgent84bug.gif

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

                  Hi,
                  It can be done for a flat object as a leave. I will have to do this exercise for FrontFace ruby, so will try to cook something simultaneously. 😄
                  Tomasz

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

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

                    Excellent!

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

                    1 Reply Last reply Reply Quote 0
                    • 4 Offline
                      40Th
                      last edited by

                      @rickw said:

                      With one or more faces selected, try this in the ruby console:

                      Sketchup.active_model.selection.each{|e| e.back_material=e.material if e.typename=="Face"}
                      

                      I suggest you start with 1 or 2 faces to see if it works as expected, since I don't have one of your models to test. If that works for you, let me know and I'll "put some skin on the bones". 😄

                      How do i use this script? And does this script solves this issue? 😒

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        RickW
                        last edited by

                        Unfortunately, it doesn't solve the problem. There's a lot more complexity to it than I first thought. That's why there isn't a solution posted yet...

                        RickW
                        [www.smustard.com](http://www.smustard.com)

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          davide.skp
                          last edited by

                          Rick, this is essential plugin!!!
                          because every 3d trees sw produce geometry like free agent say...

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

                            Any news on this?

                            Will pay money for it.

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

                            1 Reply Last reply Reply Quote 0
                            • free agentF Offline
                              free agent
                              last edited by

                              bump... 😛

                              http:i167.photobucket.comalbumsu143FreeAgent84bug.gif

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

                                I tried having a go at this myself. But I can't work out how the API's related to textures work. I'm thinking this isn't the best challenge for a first ruby...

                                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
                                  BillW
                                  last edited by

                                  I dont know if this is of any use - a ruby I call via the ruby console with load "<filename>"
                                  after selecting the faces I want to work on.

                                  What it does is set the front face (of selected faces) to have the same material and texture mapping as the back face. It worked for me with a particular problem I had in which an imported image I exploded and did a pushpull - the top face didnt show the texture map - it was on the other side ie back face.
                                  Reapplying the material didn't do the trick as the image had been scaled on import. For your situation
                                  the code will need to changed ie

                                  get_back_UVQ to get_front_UVQ
                                  ent.material = ent.back_material to ent.back_material = ent.material

                                  
                                  model = Sketchup.active_model
                                  tw = Sketchup.create_texture_writer
                                      
                                  model.selection.each { | ent | 
                                    case ent.typename
                                      when "Face" then
                                  
                                  # sets front material and mapping as back material
                                  
                                       ent.material = ent.back_material
                                        uvHelp = ent.get_UVHelper(true, true, tw)
                                  
                                        pt_array = []
                                        
                                        numint = (ent.outer_loop.vertices.length / 4).floor
                                  
                                        vert = ent.outer_loop.vertices[numint-1]
                                        uvq = uvHelp.get_back_UVQ(vert.position)
                                        pt_array.push(vert.position,uvq)
                                  
                                        vert = ent.outer_loop.vertices[(numint*2) - 1]
                                        uvq = uvHelp.get_back_UVQ(vert.position)
                                        pt_array.push(vert.position,uvq)
                                  
                                        vert = ent.outer_loop.vertices[(numint*3) - 1]
                                        uvq = uvHelp.get_back_UVQ(vert.position)
                                        pt_array.push(vert.position,uvq)
                                  
                                        vert = ent.outer_loop.vertices[(numint*4) - 1]
                                        uvq = uvHelp.get_back_UVQ(vert.position)
                                        pt_array.push(vert.position,uvq)
                                  		  
                                       ent.position_material ent.material,  pt_array , true # Set front coords
                                  
                                    end
                                  }
                                  
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    !!! Bill!
                                    That's excellent! 😍

                                    That's just what I needed. Do you mind if I publish a ruby with your code in it? There's a bunch of V-Ray users that sorely need this in order to be able to use X-Frog trees for rendering vegetation in models.

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

                                    1 Reply Last reply Reply Quote 0
                                    • EarthMoverE Offline
                                      EarthMover
                                      last edited by

                                      Thomas,

                                      Have you tested this code out? Does it work? (fingers crossed.....)

                                      3D Artist at Clearstory 3D Imaging
                                      Guide Tool at Winning With Sketchup
                                      Content Creator at Skapeup

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

                                        Yes! I've tested it out after tweaking it to copy from front face to back face. Just got to make it work on nested groups/components and add menu item and we're gold. 😄

                                        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
                                          BillW
                                          last edited by

                                          Thomthom

                                          Feel free to parcel up the code.

                                          Regards

                                          Bill Wood

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

                                            Complete Ruby here: http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=14684 😄

                                            So, from what I understand of the plugin, it takes the real world co-ordinates of four point and their UV mapping, which then is transferred directly to the other side? And it doesn't require the face to have four vertices because you sample four points out of the total points and that's enough to place the texture correct?

                                            It looks much more simple now that I see the working code. But I couldn't make any sense out of the data I got from the UVHelper object.

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

                                            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