Problem with rendering patch object when FaceVertexAlphaData is given
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sandor Toth
el 19 de En. de 2017
Respondida: Sandor Toth
el 19 de En. de 2017
When I create a single patch object with different transparency and color per face, Matlab R2016b under OSX seems having a bug in rendering it. A simple example with two cubes gives the following plot, see Matlab code below.
The main problem with this image is, that the red cube should be in the front, and it is non-transparent (alpha=1), still I see the green cube behind. I tested the same code on R2015b and the rendering looks the same.
% vertices for a cube
Vcube = [0 0 0;1 0 0;1 1 0;0 1 0;0 0 1;1 0 1;1 1 1;0 1 1];
% faces for a cube
Fcube = [1:4;1 2 6 5;2 3 7 6;3 4 8 7;4 1 5 8;5:8];
% red color for the faces of the cube
Cred = repmat([1 0 0],[6 1]);
% green color for the faces of the second cube
Cgreen = repmat([0 1 0],[6 1]);
% non-transparent first cube (defined on all 6 faces)
A = ones(6,1);
% two cubes
V2 = [Vcube;bsxfun(@plus,Vcube,[2 2 -1])];
F2 = [Fcube;Fcube+8];
% color for the 2 cube
C2 = [Cred;Cgreen];
% different transparency for the two cubes, red one is non-transparent,
% green is semi transparent
A2 = [A;A/2];
clf
hPatch = patch('Vertices',V2,'Faces',F2,...
'FaceColor','flat','FaceVertexCData',C2,...
'FaceAlpha','flat','FaceVertexAlphaData',A2,...
'AlphaDataMapping','none');
axis off
axis equal
axis([-1 4 -1 4 -2 2])
view(3)
If this is a bug (I believe it is), is there any known workaround?
Thanks!
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!