Strange patch behaviour when hgtransform applied to object
5 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a patch surface consisting of triangular facets. I have a scalar field for with data for each node in the patch. This is used to generate a fringe plot. This has been working well.
p = patch(surf, ...
'cdata', field_values, ...
'facecolor','interp', ...
'facelighting', 'phong', ...
'edgecolor', 'none',...
'specularstrength', 0.1);
axis equal;
set(gca, 'visible', 'off');
caxis(color_scale)
colorbar('location', 'eastoutside');
light
I require orthogonal views of this patch surface. I tried to use hgtransform to re-orient the patch as follows:
% hg=hgtransform;
% set(p,'parent', hg);
% M = makehgtform('yrotate',-pi/2);
% set(hg, 'matrix', M);
The patch surface orients correctly, however the face shading is now distorted, which I guess is due to the vertex normals not updating to the new orientation.
Have I missed something, or is this an inappropriate use of this command, and I would be better off using the camera toolbar.
Thanks for any comments.
Regards Andrew Sims UNSW, Australia.
0 件のコメント
採用された回答
Patrick Kalita
2011 年 8 月 1 日
I think this is probably a bug in how the ZBuffer renderer does its lighting computations. If you change the figure's renderer to OpenGL, it should look fine:
set(gcf, 'Renderer', 'OpenGL')
One caveat: the OpenGL renderer does not support Phong lighting. So you will notice that even though the patch's FaceLighting property is set to 'phong' it will fall back to Gouraud-style shading when you change renderers.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!