Clear Filters
Clear Filters

Transparency Ghosting Effect in Rendering of Ellipsoid Surfaces

26 views (last 30 days)
I have been attempting to render ellipsoids of various scales and rotations in MATLAB using the built-in ellipsoid() function; however, I have run into repeated graphical errors when rendering these for which I have been unable to pin down a cause.
Specifically, some ellipsoids will display a sort of "ghosting" effect, in which the opacity of the ellipsoid will change suddenly despite a constant FaceAlpha value. Attached are several screenshots of the issue:
An ellipsoid showing ghosting effects.
An ellipsoid showing ghosting effects.
An ellipsoid showing ghosting effects.
I have noticed the following patterns with the ghosting:
  • The ghosting effect appears to depend on window size
  • Ellipsoids can be fully ghosted (i.e., much more transparent than expected)
  • The ghosting appears to happen when one axis of the ellipsoid is much shorter than the other two
  • The ghosting is very dependent on the camera angle
  • The ghosting appears to be dependent on the rotation of the ellipsoid (I have yet to generate a single axis-aligned ellipsoid that suffers from ghosting)
  • The ghosting happens for a wide range of FaceAlpha values
I have tested ellipsoid generation on both Windows and Linux, as well as using both R2019b and R2024a, and all display this ghosting effect for some cases (it is not predictable when or for which view angles as far as I can tell). I am using OpenGL hardware rendering on Windows.
My questions are as follows:
  1. What is the root cause of this issue?
  2. Is there a workaround that will work for any orientation and size of ellipsoid?
Thank you for your time.
The following script was used to generate the ellipsoids in the images above (on a Windows machine running R2019b with OpenGL hardware rendering and Intel UHD Graphics 620 graphics unit):
% Generate a random rotation matrix
L = randn(3);
C = L * L';
[V, ~] = eig(C);
if det(V) == -1
V(:, 2) = -V(:, 2);
end
% Ellipsoid axis sizes
D = [20, 5, 0.01];
% Generate 101 x 101 meshgrids for ellipsoid coordinates
[X, Y, Z] = ellipsoid(0, 0, 0, D(1), D(2), D(3), 100);
% Rotate ellipsoid into frame defined by rotation matrix
coords = (V * [X(:)'; Y(:)'; Z(:)'])';
% Convert points back into meshgrids
X = reshape(coords(:, 1), size(X));
Y = reshape(coords(:, 2), size(Y));
Z = reshape(coords(:, 3), size(Z));
figure();
hold on;
surf(X, Y, Z, 'EdgeColor', 'none', 'FaceColor', 'b', 'FaceAlpha', 0.5);
  1 Comment
DGM
DGM about 23 hours ago
FWIW, I see the same effect in R2019b/linux/softwaregl. I don't know that it's an issue with ellipsoid(), but more of a rendering problem.
I am really unsure what's going on, but I wonder if it has something to do with the extreme aspect ratio of the ellipsoid and accuracy of the projection calculations during rendering. Considering the edge regions (where the ellipsoid is thinnest), it's almost like the front/back faces are swapped, discarded or something else. That doesn't really make sense, but I'm trying to figure out why there would be a sudden decrease in the total opacity along that path.
I havent done any work to test that, but if I "fatten" the aspect ratio a bit (or keep it grid-aligned as you say), the issue seems to be subdued.

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!