Borrar filtros
Borrar filtros

Surf plot mesh looks jagged when I set FaceAlpha

2 visualizaciones (últimos 30 días)
Hongbo Zhao
Hongbo Zhao el 11 de Mayo de 2018
Editada: Walter Roberson el 11 de Ag. de 2021
Below is the example given in the "surf" documentation. The mesh looks smooth when `FaceAlpha` is not included but it looks jagged when it's transparent. Is this a graphics card issue or can it somehow be fixed?
[X,Y] = meshgrid(-5:.5:5);
Z = Y.*sin(X) - X.*cos(Y);
s = surf(X,Y,Z,'FaceAlpha',0.5)
  2 comentarios
Walter Roberson
Walter Roberson el 12 de Mayo de 2018
Let me think... You are using r2013b or r2014a or so? If so then there was bug having to do with opengl use, which gets enabled automatically when alpha is used.
Hongbo Zhao
Hongbo Zhao el 12 de Mayo de 2018
Editada: Walter Roberson el 11 de Ag. de 2021
I'm actually running it on R2018a. In fact when I try the example in the browser it also looks jagged https://www.mathworks.com/help/matlab/ref/surf.html?s_tid=doc_ta

Iniciar sesión para comentar.

Respuesta aceptada

Leone Campos
Leone Campos el 10 de Ag. de 2021
Based on Jan's answer I was able to solve the problem on my PC (Windows 10) using
opengl hardwarebasic
Code
opengl hardwarebasic
% opengl hardware
% opengl software
[X,Y] = meshgrid(-5:.5:5);
Z = Y.*sin(X) - X.*cos(Y);
s = surf(X,Y,Z,'FaceAlpha','0.5')
With software
software
With hardware
hardware
With hardwarebasic
hardwarebasic
  1 comentario
Hongbo Zhao
Hongbo Zhao el 11 de Ag. de 2021
Thank you @Leone Campos This works perfectly for me (windows 10 + R2021a)! We finally have a solution after 3 years. This is in fact very important since you will often want to show the entire surface with the lines still looking good.

Iniciar sesión para comentar.

Más respuestas (1)

Jan
Jan el 12 de Mayo de 2018
It looks nice in my Matlab 2016b/Win10. Setting the Alpha blending enables the OpenGL renderer. If this causes troubles, try:
opengl software
Does this help? Do you have the current versions of the drivers installed? Which OS are you using? Can you post a screenshot such that "looks jagged" gets more clear?
  3 comentarios
Walter Roberson
Walter Roberson el 12 de Mayo de 2018
Setting Alpha at all forces OpenGL to be used.
Jan
Jan el 12 de Mayo de 2018
Editada: Jan el 12 de Mayo de 2018
@Hongbo Zhao: Thanks for posting the screen shot. This clarifies immediately that this is the expected behavior. Alpha blending works in the OpenGL renderer only, but then the line smoothing is not enabled (for reasons unknown to me).

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by