Issues in plotting multiple transparent isosurfaces

조회 수: 11 (최근 30일)
mrhodes
mrhodes 2016년 6월 22일
댓글: mrhodes 2016년 6월 24일
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

채택된 답변

Slava Murzin
Slava Murzin 2016년 6월 24일
편집: Slava Murzin 2016년 6월 24일
I just had a similar issue. try setting:
ax=gca; ax.SortMethod='childorder';
  댓글 수: 1
mrhodes
mrhodes 2016년 6월 24일
That does seem to do the trick, thanks! It also introduces some unintended consequences when viewing the graph from other angles, but that's much easier to deal with.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by