Image texture on face vertice 3D Model

6 visualizaciones (últimos 30 días)
Daniel Hurtiger
Daniel Hurtiger el 10 de En. de 2021
Respondida: Walter Roberson el 14 de En. de 2021
I'd like to texture a 3D model described by faces and vertices with an image.
Therefore I tried with the MATLAB method surface like this:
% definition of faces and vertices above
n = length(vertices)/3;
X = reshape(vertices(:,1),3,n);
Y = reshape(vertices(:,2),3,n);
Z = reshape(vertices(:,3),3,n);
img = imread('image.png'); % mandrill image
surface(X,Y,Z,...
'Cdata', img,...
'FaceColor','texturemap',...
'EdgeColor','none',...
'FaceLighting','gouraud')
But this doesn't really work as my 3D Model has lots of 'empty' faces:
Same happens using the method warp like this:
warp (X,Y,Z,img)
Is this a MATLAB bug or am I doing something wrong?

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de En. de 2021
If you have empty faces, then nothing can be drawn there.
Perhaps you should use boundary() https://www.mathworks.com/help/matlab/ref/boundary.html with a shrink factor, in order to get the outside layer connections (like a tight-fitting bounding box) and texture on top of that.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by