Strange patch behaviour when hgtransform applied to object
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Patrick Kalita
on 1 Aug 2011
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.
More Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!