Image texture on face vertice 3D Model
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposte (1)
Walter Roberson
il 14 Gen 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.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!