Does opengl have a limit to the number of transparent layers?

2 views (last 30 days)
I've been working with patches with many transparent faces, and I have found that opengl seems to limit the number of transparent layers than can be seen behind each other.
Here is an example in which I plot a patch with 10 faces but only 5 can be seen (you can rotate the plot to see the hidden faces):
fig = figure;
n = 10;
x = linspace(0,1,n+1);
% vertex naming:
% 4 -- 3
% | |
% 1 -- 2
x1 = x(1:n);
x2 = 1+0*x1;
x3 = x2;
x4 = x1;
y1 = 0*x1;
y2 = y1;
y3 = y1+1;
y4 = y3;
z = x;
verts = zeros(4*n,3);
faces = zeros(n,4);
for i = 1:n
verts(4*(i-1)+(1:4),1:3) = [
x1(i),y1(i),z(i)
x2(i),y2(i),z(i)
x3(i),y3(i),z(i)
x4(i),y4(i),z(i)];
faces(i,1:4) = 4*(i-1)+(1:4);
end
h = patch('Faces',faces,'Vertices',verts);
h.FaceAlpha = 0.1;
h.EdgeColor = 'none';
% fig.Renderer = 'painters';
fig.Renderer = 'opengl';
Painters does not exhibit this problem, but it is much slower (I'm using patches with ~100,000 triangles). My goal is to export to high resolution png's. I'm using MATLAB R2016a. Any suggestions?
Thanks, David

Accepted Answer

David Pate
David Pate on 29 Nov 2016
I was able to fix the problem by switching to the Windows software opengl renderer:
>> opengl software

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!