Clear Filters
Clear Filters

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

3 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) = [
faces(i,1:4) = 4*(i-1)+(1:4);
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)


Find more on Graphics Performance in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!