MATLAB: Issues in plotting multiple transparent isosurfaces

isosurfacetransparency

Using R2015a
I made a script that plots several isosurfaces of different transparency. These surfaces are nested inside one another, such that the inner surfaces must be viewed through the outer surfaces. If I am plotting more than 5-6 surfaces, I find that the innermost surfaces cannot be seen, regardless of how low the alpha of the outer surfaces is. I suspect this issue is related to this blog post in some way: http://blogs.mathworks.com/graphics/2015/08/06/transparency-in-3d/.
Here are some images demonstrating the problem.
Here, I only plot 5 surfaces. These surfaces have increasing alpha depending on their isovalue. All the surfaces are visible.
If I add another surface between each of the 5 plotted above (again with the alpha depending on the isovalue), the inner surfaces are no longer visible. You can see 5 out of 9 surfaces plotted. Even though the innermost surface is completely opaque, it doesn't show up through the other surfaces. The transparency of the middle of each blob is much lower than when I only plot 5 isosurfaces.
Are there any workarounds for this problem? Is there anything I can do to get MATLAB to show all of the isosurfaces? I have tried drawing the surfaces in increasing and decreasing order with identical results.
Some relevant code:
for i = 1:length(opt.Isosurfaces)
fv = isosurface(x,y,t, abs(Exyt).^2, opt.Isosurfaces(i));
if size(fv.faces) > 0
patches = patch( shrinkfaces(fv,1.0) );
isocolors(x,y,t, R,G,B, patches );
patches.FaceColor = 'interp';
patches.EdgeColor = 'none';
patches.EdgeAlpha = 0.0;
transp = opt.Transparency+(opt.Isosurfaces(i)-min(opt.Isosurfaces))^2*...
(0.99-opt.Transparency)/(max(opt.Isosurfaces)-min(opt.Isosurfaces))^2;
patches.FaceAlpha = transp;
rotate( patches(1), [0 1 0], -90, [0 0 0] );
rotate( patches(1), [1 0 0], -90, [0 0 0] );
end
end

Best Answer

I just had a similar issue. try setting:
ax=gca; ax.SortMethod='childorder';