Transparency Ghosting Effect in Rendering of Ellipsoid Surfaces
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:
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:
What is the root cause of this issue?
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);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:
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:
What is the root cause of this issue?
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); 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:
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:
What is the root cause of this issue?
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); transparency, graphics, rendering, surfaces MATLAB Answers — New Questions