Textured Models with SketchUp and MeshLab

Discussion in 'Software and Applications' started by aeron203, Jan 8, 2010.

  1. aeron203
    aeron203 Member
    This step-by-step tutorial shows how to use Google Sketchup, MeshLab and VRML to add image textures to your 3d models.

    Part 1: Create a textured 3D model.
    In this example, you will use Sketchup to create a simple 3D picture frame with an image.


    1.1 - In SketchUp, click on rectangle and draw a rectangle with a proportion of 4 x 3 units. Make the rectangle about 200mmx150mm or less. This will be small on the screen, so click Zoom-extents to focus in on the shape.
    [​IMG]

    1.2 - Click on the Push/Pull tool. Click and drag the rectangle to extrude it upward to 3mm thickness.
    [​IMG]

    1.3 - Click on the Offset tool. Click and drag near the edge of the rectangle to bring a line about 10mm from the sides.
    [​IMG]

    1.4 - Click on the Push/Pull tool. Click and drag the frame upward to 4-6mm thickness.
    [​IMG]

    1.5 - Click the Paint Bucket tool to bring up the Materials window, then click the Create Material button on the upper right, second from the top.
    [​IMG]

    1.6 - In the Texture section, click the icon to "Browse for Material Image File". Navigate to your image and click Open. You must click OK to close the Create Material window before applying the material to the model.
    [​IMG]

    1.7 - You can now apply your texture to parts of the model by clicking on them. Click the center of the picture frame to fill it with your image. The image is applied to the model, but it isn't the right size.
    [​IMG]

    1.8 - Click the Edit tab of the Materials window. In the Texture section you will see the dimensions listed. change one dimension to match that of the rectangle you created, and the picture will line up with the frame.
    [​IMG]

    1.9 - Click on File/Export/3D Model, and export a Collada file of your model. You will import this into MeshLab and export to VRML for uploading to Shapeways.




    Part 2: Exporting your models to VRML for color printing.
    This is already covered in another Shapeways tutorial, but I'd like to quickly summarize the process and additional detail.

    Any model you can get cleanly into MeshLab with it's UV coordinates intact can be converted in a VRML97 file by MeshLab. The resulting file needs a quick modification in a text editor in order to work. Here are the details of how to do that.

    2.1 - Open the already-textured model in MeshLab. You may not see the texture in some cases, but that will be fixed later.

    2.2 - If your units are not in meters, your object must be re-scaled. Click on Filters/Normals, Curvature and Orientation/Apply Transform.

    2.3 - In the Apply Transform window, click the Scale radio-button, then click the Uniform check-box. In this case a value of 0.015 typed next to the X value would scale the object to the size I wanted. You can get an idea of the size of your object from the bounding box information in this window.
    [​IMG]

    2.4 Go to File/Save-As, and save your model as a VRML file with a WRL extension (e.g. test.wrl). MeshLab might display an incorrect name or path for the texture while saving. It offers you an opportunity to rename the file path, but this crashes the program in the version 1.2.3b that I have. Next we will fix the image path by manually entering the correct one in the .wrl file.

    2.5 Open the .wrl file in a text editor like Notepad. Scroll to the end of the file and you will see a line like this:

    texture ImageTexture { url " folder/texture0.jpg " }

    You have to edit the line to remove the spaces between the quotes and rename the file to whatever image you want to use. Now the line looks like this:

    texture ImageTexture { url "yourimage.jpg" }

    Save the .wrl file. Make sure the image is in the same folder.
    [​IMG]

    You should now be able to check your work by opening the .wrl file in MeshLab and seeing the texture. The VRML files exported by MeshLab contain only one texture per file, so if you must combine objects with different textures you are going to have to do it manually in VRML.

    Add the VRML file (.wrl) and image file (.jpg or .png) to a Zip archive and upload it to Shapeways. The frame should cost about $20-30 to print in Full Color Sandstone.
     

    Attached Files:

  2. Youknowwho4eva
    Youknowwho4eva Well-Known Member
    Wonderful tutorial. Thank you.
     
  3. pete
    pete Shapeways Employee CEO
    Hi aeron203,

    we blogged about your tutorial!
    Can we add it to our tutorial section?

    Thanks alot!

    Peter
     
  4. aeron203
    aeron203 Member
    Of course you can add it to the tutorials.

    I'll add more later.
     
  5. 28117_deleted
    28117_deleted Member
  6. 35948_deleted
    35948_deleted Member
     
    Last edited: Mar 6, 2010