Code covered by the BSD License  

Highlights from
Texture Patch


5.0 | 5 ratings Rate this file 39 Downloads (last 30 days) File Size: 183 KB File ID: #28106
image thumbnail

Texture Patch



Show a 3D triangulated mesh ( patch ) with a texture

| Watch this File

File Information

This function PATCHT, will show a triangulated mesh like Matlab function Patch but then with a texture.
    FF : Face list 3 x N with vertex indices
    VV : Vertices 3 x M
    TF : Texture list 3 x N with texture vertex indices
    VT : Texture Coordinates s 2 x K, range must be [0..1] or real pixel postions
    I : The texture-image RGB [O x P x 3] or Grayscale [O x P]
    Options : Structure with options for the textured patch such as
            EdgeColor, EdgeAlpha see help "Surface Properties :: Functions"
    Options.PSize : Special option, defines the image texturesize for each
            individual polygon, a low number gives a more block
            like texture, defaults to 64;
    On a normal PC displaying 10,000 faces will take about 6 sec.
   % Load Data;
    load testdata;
   % Show the textured patch
    figure, patcht(FF,VV,TF,VT,I);
   % Allow Camera Control (with left, right and center mouse button)

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
16 Feb 2014 Amir

I would like to know how you calculated VT and why the number of VT is different from VV.


15 Feb 2014 Amir

I did not understand something else in your example is VT why the number of vertices is larger than vv.

15 Feb 2014 Amir

is that this function is limited by a number faces or not

12 Jun 2013 Vinayak

Hi, I cannot understand the following:

1) What is the "TF" variable and how do I create it if I have vertices (VV), trinagles (FF) and texture coordinates (VT)?

2) In your "testdata", I see that the number of texture coordinates in VT are not saem is the number of vertices. However, should that not be the same or am I missing something here?

Your guidance is highly appreciated.


21 Mar 2012 Gabriel Peyre

This is awesome, I have been looking for such a code for a such a long time. Congrats.

23 Jan 2011 Luca Baglivo

It would be appreciated to change the help with the correct matrix sizes.
A strange thing I found is that it works correctly only if I flip the x and y image coordinate in the matrix, could you check?
Finally, with gray images it show color-mapped texture. The work-around I found is to use three equal layer of gray levels like a color image.

20 Jan 2011 Nikolay Chumerin

Perfect job! Thank you! You saved a lot of my time. Just one remark: in the comments/help you wrongly specified the size of the input matrices FF, VV, TF and VT. They should be transposed.

05 Jan 2011 Paulo  
27 Oct 2010 Dirk-Jan Kroon

You can try to change the figure “Renderer” (painters, z-buffer or OpenGL), after you displayed your textured-object.

But it can also be a problem with your video-card driver.

26 Oct 2010 Peter Bone

I'm using 2008b. The example did not texture map correctly. I did not get the image shown. Something is wrong.

Contact us