Unfortunately there seems to be no builtin support for two-sided surfaces in matlab. There's some rudimentary control over back-face lighting, but that's all. At least you can determine the back-facing triangles for a given camera position:
N = normals(V,F);
BC = barycenter(V,F);
back_facing = sum(N.*bsxfun(@minus,BC,campos),2)<=0;
Here's an example for an armadillo mesh:
t = tsurf(F,V,'EdgeColor','none','FaceLighting','phong');view(2);
axis equal;
camproj('persp')
t.FaceVertexCData = 1*(sum(N.*bsxfun(@minus,BC,campos),2)<=0)
apply_ambient_occlusion();
Of course, if you change the view, the coloring is no longer valid:
So you need to recompute the coloring:
You can also insert nan
s to achieve back-face culling:
t.FaceVertexCData(sum(N.*bsxfun(@minus,BC,campos),2)>0) = nan;