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!