I need to render a translucid sphere so I can render and visualize solid lines inside it and generate images for a publication. But when rendering a sphere with FaceAlpha lesser than 1, a weird artifact appears. Sure, the sphere is still translucid, but that's not a good quality. Light source position doesn't change anything. The problem only appears when transparency is on. 1.Why this is happening? 2.How can I get rid of this artifact?
This is the code, used in Octave 8.1.0:
% Define the sphere parameters
radius = 1;
resolution = 50;
% Generate the coordinates for the sphere surface
theta = linspace(0, 2*pi, resolution);
phi = linspace(0, pi, resolution);
[theta, phi] = meshgrid(theta, phi);
x = radius * sin(phi) .* cos(theta);
y = radius * sin(phi) .* sin(theta);
z = radius * cos(phi);
% Plot the sphere with adjusted shading
figure;
surf(x, y, z, 'FaceAlpha', 0.5);
shading interp; % Adjust the shading mode
% Set the axis aspect ratio to 1:1:1
axis equal;
% Add labels and title
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Sphere');
% Adjust the viewpoint if needed
view(45, 30);