Clear Filters
Clear Filters

Facealpha bug in combination with 3D plots

2 views (last 30 days)
when this three elements are combined, the smotthing of lines is lost.
- patch or fill3
- lines in the z axis (either with line or plot3)
- alpha (like FaceAlpha)
Examples:
figure() %line smoothing is OK
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b')
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure() %no line smoothing
patch([0 1 1 0],[0 0 1 1],'b','Facealpha',.5)
view([30 30])
line([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
as well:
figure() %no smoothing
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b','Facealpha',.5)
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
Do you have the same behaviour?

Answers (1)

Voss
Voss on 9 Feb 2023
You might try using the painters Renderer. See below for a comparison of those three cases with painters vs the default OpenGL Renderer.
figure('Renderer','OpenGL')
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b')
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure('Renderer','Painters')
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b')
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure('Renderer','OpenGL')
patch([0 1 1 0],[0 0 1 1],'b','Facealpha',.5)
view([-37.5 30])
line([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure('Renderer','painters')
patch([0 1 1 0],[0 0 1 1],'b','Facealpha',.5)
view([-37.5 30])
line([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure('Renderer','OpenGL')
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b','Facealpha',.5)
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)
figure('Renderer','painters')
fill3([0 1 1 0],[0 0 1 1],[0 0 0 0],'b','Facealpha',.5)
hold on
plot3([0; 0],[0; 0],[0; 1],'color','#D95319','LineWidth',1.5)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!