how to make color and lighting continuouse using patch
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, im trying to visualize 3d objects in MATLAB. when i used the following script i wrote
clear all;
close all
clc
vertices=[0 0 0; 1 0 0; 1 1 0 ;0 1 0; 0 0 1; 1 0 1; 1 1 1; 0 1 1];
faces=[1 2 6 5; 2 3 7 6; 3 4 8 7;4 1 5 8; 1 2 3 4;5 6 7 8];
FV.vertices = [vertices;vertices+[ones(8,1) zeros(8,2)]];
FV.faces = [ faces ; faces+8*ones(6,4)];
FV.FaceVertexCData=0.5*ones(size(FV.vertices,1),3);
figure;
patch_handle=patch('Vertices',FV.vertices,'faces',FV.faces,'FaceVertexCData',FV.FaceVertexCData,'facecolor','interp','facelighting','phong',...
'edgecolor','none','edgelighting','phong');
set(patch_handle,'AmbientStrength',0.8,'DiffuseStrength',0.5,'SpecularStrength',0.5);%,'FaceAlpha',0.5);
light('Position',[1 1 1]);
view(45 ,45);
axis equal
i get that the lighting is not continuous (instead of one continuouse cuboidi can see 2 separate cubs. how do i avoid this ? In the writing of this code i used the following help docs Multiple Patches Specifyingpatch clor thank you
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!