Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon depth occlusion not working as expected #4057

Open
stackjohn opened this issue Dec 13, 2024 · 0 comments
Open

Polygon depth occlusion not working as expected #4057

stackjohn opened this issue Dec 13, 2024 · 0 comments

Comments

@stackjohn
Copy link

Description of bug / unexpected behavior

Object depth occlusion not working as expected.

Below is a code example which I believe includes the paths to draw polygons on the surface of a sphere.

The paths have been generated by another piece of code, so perhaps there are some issues there.

The code will draw regions on one side of a 3d sphere. When the camera rotates around the sphere, the polygons become hidden/visible depending on the camera location.

The code below also adds a smaller sphere within the area of the larger half sphere, however that too becomes completely invisible towards the end of the clip, when it should be fully visible as it is in front of the polygons to the rear of the scene.

Is this expected or am I missing something in my code so that objects are rendered correctly?

Apologies for the terrible colors.

Expected behavior

The objects should be rendered correctly when visible and hidden when obscured by other objects.

How to reproduce the issue

from manim import *
import numpy as np

all_regions = [[np.array([[-6.74157834e-17,  3.61155773e-16, -3.00000000e+00],
       [-1.32542158e-16,  3.42652823e-16, -3.00000000e+00],
       [-1.93167461e-16,  3.12513539e-16, -3.00000000e+00],
       [-2.47232887e-16,  2.71761440e-16, -3.00000000e+00],
       [-2.92902397e-16,  2.21780447e-16, -3.00000000e+00],
       [-3.28625076e-16,  1.64267891e-16, -3.00000000e+00],
       [-3.53187798e-16,  1.01176874e-16, -3.00000000e+00],
       [-3.65756425e-16,  3.46499359e-17, -3.00000000e+00],
       [-3.65904132e-16, -3.30536977e-17, -3.00000000e+00],
       [-3.53625902e-16, -9.96348429e-17, -3.00000000e+00],
       [-3.29338699e-16, -1.62832435e-16, -3.00000000e+00],
       [-2.93867305e-16, -2.20500312e-16, -3.00000000e+00],
       [-2.48416312e-16, -2.70680099e-16, -3.00000000e+00],
       [-1.94529216e-16, -3.11667715e-16, -3.00000000e+00],
       [-1.34035996e-16, -3.42071238e-16, -3.00000000e+00],
       [-6.89909760e-17, -3.60858179e-16, -3.00000000e+00],
       [-1.60305382e-18, -3.67390542e-16, -3.00000000e+00],
       [-2.55371824e-03, -5.85265395e-01, -2.94235584e+00],
       [-1.09904927e-01, -5.74859122e-01, -2.94235584e+00],
       [-2.13523815e-01, -5.44930898e-01, -2.94235584e+00],
       [-3.09891533e-01, -4.96497071e-01, -2.94235584e+00],
       [-3.95735476e-01, -4.31202431e-01, -2.94235584e+00],
       [-4.68140424e-01, -3.51264355e-01, -2.94235584e+00],
       [-5.24647538e-01, -2.59397502e-01, -2.94235584e+00],
       [-5.63337863e-01, -1.58721630e-01, -2.94235584e+00],
       [-5.82897493e-01, -5.26556435e-02, -2.94235584e+00],
       [-5.82662191e-01,  5.51985043e-02, -2.94235584e+00],
       [-5.62639949e-01,  1.61178136e-01, -2.94235584e+00],
       [-5.23510712e-01,  2.61684233e-01, -2.94235584e+00],
       [-9.15275282e-01,  6.93030044e-01, -2.77163860e+00],
       [-9.15275282e-01,  6.93030044e-01, -2.77163860e+00],
       [-7.72565034e-01,  8.49213019e-01, -2.77163860e+00],
       [-6.03618833e-01,  9.76557110e-01, -2.77163860e+00],
       [-4.14174013e-01,  1.07073777e+00, -2.77163860e+00],
       [-2.10664033e-01,  1.12855667e+00, -2.77163860e+00],
       [ 7.02978061e-17,  1.14805030e+00, -2.77163860e+00],
       [ 7.02978061e-17,  1.14805030e+00, -2.77163860e+00],
       [ 2.24963967e-32,  3.67394040e-16, -3.00000000e+00],
       [-6.74157834e-17,  3.61155773e-16, -3.00000000e+00]]), np.array([[-3.89256377e-01,  2.08530081e+00,  2.12132034e+00],
       [-7.65293786e-01,  1.97846542e+00,  2.12132034e+00],
       [-1.11534217e+00,  1.80444225e+00,  2.12132034e+00],
       [-1.42751405e+00,  1.56914105e+00,  2.12132034e+00],
       [-1.42751405e+00,  1.56914105e+00,  2.12132034e+00],
       [-1.32877376e+00,  1.00612368e+00,  2.49440884e+00],
       [-1.49083238e+00,  7.45213646e-01,  2.49440884e+00],
       [-1.60226301e+00,  4.58996499e-01,  2.49440884e+00],
       [-1.65928154e+00,  1.57192041e-01,  2.49440884e+00],
       [-1.14339456e+00, -1.03287760e-01,  2.77163860e+00],
       [-1.10502697e+00, -3.11343676e-01,  2.77163860e+00],
       [-1.02913317e+00, -5.08826504e-01,  2.77163860e+00],
       [-9.18290474e-01, -6.89029818e-01,  2.77163860e+00],
       [-7.76263059e-01, -8.45833995e-01,  2.77163860e+00],
       [-8.82496421e-01, -1.41390404e+00,  2.49440884e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-3.12982753e-01, -1.63706028e+00,  2.49440884e+00],
       [-7.27237427e-03, -1.66669483e+00,  2.49440884e+00],
       [-5.00929852e-03, -1.14803937e+00,  2.77163860e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00, -0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [-0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [ 0.00000000e+00,  0.00000000e+00,  3.00000000e+00],
       [ 7.02978061e-17,  1.14805030e+00,  2.77163860e+00],
       [ 1.29893408e-16,  2.12132034e+00,  2.12132034e+00],
       [ 1.29893408e-16,  2.12132034e+00,  2.12132034e+00],
       [-3.89256377e-01,  2.08530081e+00,  2.12132034e+00]])], [np.array([[-5.23510712e-01,  2.61684233e-01, -2.94235584e+00],
       [-5.62639949e-01,  1.61178136e-01, -2.94235584e+00],
       [-5.82662191e-01,  5.51985043e-02, -2.94235584e+00],
       [-5.82897493e-01, -5.26556435e-02, -2.94235584e+00],
       [-5.63337863e-01, -1.58721630e-01, -2.94235584e+00],
       [-5.24647538e-01, -2.59397502e-01, -2.94235584e+00],
       [-4.68140424e-01, -3.51264355e-01, -2.94235584e+00],
       [-3.95735476e-01, -4.31202431e-01, -2.94235584e+00],
       [-3.09891533e-01, -4.96497071e-01, -2.94235584e+00],
       [-2.13523815e-01, -5.44930898e-01, -2.94235584e+00],
       [-1.09904927e-01, -5.74859122e-01, -2.94235584e+00],
       [-2.55371824e-03, -5.85265395e-01, -2.94235584e+00],
       [-5.00929852e-03, -1.14803937e+00, -2.77163860e+00],
       [-5.00929852e-03, -1.14803937e+00, -2.77163860e+00],
       [-2.15586270e-01, -1.12762673e+00, -2.77163860e+00],
       [-4.18842030e-01, -1.06892041e+00, -2.77163860e+00],
       [-6.07874107e-01, -9.73914038e-01, -2.77163860e+00],
       [-7.76263059e-01, -8.45833995e-01, -2.77163860e+00],
       [-9.18290474e-01, -6.89029818e-01, -2.77163860e+00],
       [-1.02913317e+00, -5.08826504e-01, -2.77163860e+00],
       [-1.10502697e+00, -3.11343676e-01, -2.77163860e+00],
       [-1.14339456e+00, -1.03287760e-01, -2.77163860e+00],
       [-1.14293300e+00,  1.08275761e-01, -2.77163860e+00],
       [-1.10365796e+00,  3.16162287e-01, -2.77163860e+00],
       [-1.02690320e+00,  5.13312087e-01, -2.77163860e+00],
       [-1.32877376e+00,  1.00612368e+00, -2.49440884e+00],
       [-1.12159059e+00,  1.23286622e+00, -2.49440884e+00],
       [-8.76318720e-01,  1.41774118e+00, -2.49440884e+00],
       [-6.01287470e-01,  1.55447031e+00, -2.49440884e+00],
       [-3.05836773e-01,  1.63841033e+00, -2.49440884e+00],
       [ 1.02056596e-16,  1.66671070e+00, -2.49440884e+00],
       [ 7.02978061e-17,  1.14805030e+00, -2.77163860e+00],
       [-2.10664033e-01,  1.12855667e+00, -2.77163860e+00],
       [-4.14174013e-01,  1.07073777e+00, -2.77163860e+00],
       [-6.03618833e-01,  9.76557110e-01, -2.77163860e+00],
       [-7.72565034e-01,  8.49213019e-01, -2.77163860e+00],
       [-9.15275282e-01,  6.93030044e-01, -2.77163860e+00],
       [-9.15275282e-01,  6.93030044e-01, -2.77163860e+00],
       [-5.23510712e-01,  2.61684233e-01, -2.94235584e+00]]), np.array([[-4.57717077e-01,  2.45205435e+00,  1.66671070e+00],
       [-8.99890292e-01,  2.32642922e+00,  1.66671070e+00],
       [-1.25138163e+00,  2.02453198e+00,  1.82628429e+00],
       [-1.60162944e+00,  1.76053084e+00,  1.82628429e+00],
       [-1.69120820e+00,  1.28055255e+00,  2.12132034e+00],
       [-1.89746970e+00,  9.48477062e-01,  2.12132034e+00],
       [-2.03929400e+00,  5.84191732e-01,  2.12132034e+00],
       [-2.11186481e+00,  2.00067519e-01,  2.12132034e+00],
       [-2.11271767e+00, -1.90850895e-01,  2.12132034e+00],
       [-2.04182360e+00, -5.75288100e-01,  2.12132034e+00],
       [-2.04182360e+00, -5.75288100e-01,  2.12132034e+00],
       [-1.49406978e+00, -7.38701589e-01,  2.49440884e+00],
       [-1.33315114e+00, -1.00031625e+00,  2.49440884e+00],
       [-1.12695929e+00, -1.22796063e+00,  2.49440884e+00],
       [-1.12320489e+00, -1.79955849e+00,  2.12132034e+00],
       [-1.12320489e+00, -1.79955849e+00,  2.12132034e+00],
       [-8.68314893e-01, -2.21601330e+00,  1.82628429e+00],
       [-3.98351484e-01, -2.08358251e+00,  2.12132034e+00],
       [-9.25597675e-03, -2.12130015e+00,  2.12132034e+00],
       [-9.25597675e-03, -2.12130015e+00,  2.12132034e+00],
       [-7.27237427e-03, -1.66669483e+00,  2.49440884e+00],
       [-3.12982753e-01, -1.63706028e+00,  2.49440884e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-7.73919158e-01, -1.97510737e+00,  2.12132034e+00],
       [-8.82496421e-01, -1.41390404e+00,  2.49440884e+00],
       [-7.76263059e-01, -8.45833995e-01,  2.77163860e+00],
       [-9.18290474e-01, -6.89029818e-01,  2.77163860e+00],
       [-1.02913317e+00, -5.08826504e-01,  2.77163860e+00],
       [-1.10502697e+00, -3.11343676e-01,  2.77163860e+00],
       [-1.14339456e+00, -1.03287760e-01,  2.77163860e+00],
       [-1.65928154e+00,  1.57192041e-01,  2.49440884e+00],
       [-1.60226301e+00,  4.58996499e-01,  2.49440884e+00],
       [-1.49083238e+00,  7.45213646e-01,  2.49440884e+00],
       [-1.32877376e+00,  1.00612368e+00,  2.49440884e+00],
       [-1.42751405e+00,  1.56914105e+00,  2.12132034e+00],
       [-1.42751405e+00,  1.56914105e+00,  2.12132034e+00],
       [-1.11534217e+00,  1.80444225e+00,  2.12132034e+00],
       [-7.65293786e-01,  1.97846542e+00,  2.12132034e+00],
       [-3.89256377e-01,  2.08530081e+00,  2.12132034e+00],
       [ 1.29893408e-16,  2.12132034e+00,  2.12132034e+00],
       [ 1.52738490e-16,  2.49440884e+00,  1.66671070e+00],
       [-4.57717077e-01,  2.45205435e+00,  1.66671070e+00]])], [np.array([[-3.05836773e-01,  1.63841033e+00, -2.49440884e+00],
       [-6.01287470e-01,  1.55447031e+00, -2.49440884e+00],
       [-8.76318720e-01,  1.41774118e+00, -2.49440884e+00],
       [-1.12159059e+00,  1.23286622e+00, -2.49440884e+00],
       [-1.32877376e+00,  1.00612368e+00, -2.49440884e+00],
       [-1.02690320e+00,  5.13312087e-01, -2.77163860e+00],
       [-1.10365796e+00,  3.16162287e-01, -2.77163860e+00],
       [-1.14293300e+00,  1.08275761e-01, -2.77163860e+00],
       [-1.14339456e+00, -1.03287760e-01, -2.77163860e+00],
       [-1.10502697e+00, -3.11343676e-01, -2.77163860e+00],
       [-1.02913317e+00, -5.08826504e-01, -2.77163860e+00],
       [-9.18290474e-01, -6.89029818e-01, -2.77163860e+00],
       [-7.76263059e-01, -8.45833995e-01, -2.77163860e+00],
       [-6.07874107e-01, -9.73914038e-01, -2.77163860e+00],
       [-4.18842030e-01, -1.06892041e+00, -2.77163860e+00],
       [-2.15586270e-01, -1.12762673e+00, -2.77163860e+00],
       [-5.00929852e-03, -1.14803937e+00, -2.77163860e+00],
       [-9.25597675e-03, -2.12130015e+00, -2.12132034e+00],
       [-1.20935164e-02, -2.77161221e+00, -1.14805030e+00],
       [-1.20935164e-02, -2.77161221e+00, -1.14805030e+00],
       [-5.63354071e-01, -2.94663065e+00,  1.83697020e-16],
       [-5.20471296e-01, -2.72233175e+00,  1.14805030e+00],
       [-1.08838772e-02, -2.49438509e+00,  1.66671070e+00],
       [-9.25597675e-03, -2.12130015e+00,  2.12132034e+00],
       [-3.98351484e-01, -2.08358251e+00,  2.12132034e+00],
       [-8.68314893e-01, -2.21601330e+00,  1.82628429e+00],
       [-1.12320489e+00, -1.79955849e+00,  2.12132034e+00],
       [-1.12320489e+00, -1.79955849e+00,  2.12132034e+00],
       [-1.12695929e+00, -1.22796063e+00,  2.49440884e+00],
       [-1.33315114e+00, -1.00031625e+00,  2.49440884e+00],
       [-1.49406978e+00, -7.38701589e-01,  2.49440884e+00],
       [-2.04182360e+00, -5.75288100e-01,  2.12132034e+00],
       [-2.04182360e+00, -5.75288100e-01,  2.12132034e+00],
       [-2.11271767e+00, -1.90850895e-01,  2.12132034e+00],
       [-2.11186481e+00,  2.00067519e-01,  2.12132034e+00],
       [-2.03929400e+00,  5.84191732e-01,  2.12132034e+00],
       [-1.89746970e+00,  9.48477062e-01,  2.12132034e+00],
       [-1.69120820e+00,  1.28055255e+00,  2.12132034e+00],
       [-1.60162944e+00,  1.76053084e+00,  1.82628429e+00],
       [-1.25138163e+00,  2.02453198e+00,  1.82628429e+00],
       [-8.99890292e-01,  2.32642922e+00,  1.66671070e+00],
       [-4.57717077e-01,  2.45205435e+00,  1.66671070e+00],
       [ 1.52738490e-16,  2.49440884e+00,  1.66671070e+00],
       [ 1.69713917e-16,  2.77163860e+00,  1.14805030e+00],
       [ 1.69713917e-16,  2.77163860e+00,  1.14805030e+00],
       [-5.08587966e-01,  2.72457681e+00,  1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00,  1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00,  1.14805030e+00],
       [-1.36600960e+00,  2.20998139e+00,  1.50000000e+00],
       [-1.74834051e+00,  1.92179746e+00,  1.50000000e+00],
       [-1.98865046e+00,  1.50577050e+00,  1.66671070e+00],
       [-2.23118833e+00,  1.11529104e+00,  1.66671070e+00],
       [-2.39795606e+00,  6.86936805e-01,  1.66671070e+00],
       [-2.48329031e+00,  2.35254514e-01,  1.66671070e+00],
       [-2.48429316e+00, -2.24416911e-01,  1.66671070e+00],
       [-2.40093055e+00, -6.76467242e-01,  1.66671070e+00],
       [-1.90159014e+00, -9.40188786e-01,  2.12132034e+00],
       [-1.69677955e+00, -1.27316109e+00,  2.12132034e+00],
       [-1.87406481e+00, -2.04202390e+00,  1.14805030e+00],
       [-1.87406481e+00, -2.04202390e+00,  1.14805030e+00],
       [-1.46753791e+00, -2.35123648e+00,  1.14805030e+00],
       [-1.46753791e+00, -2.35123648e+00,  1.14805030e+00],
       [-9.47853520e-01, -2.41900263e+00,  1.50000000e+00],
       [-5.20471296e-01, -2.72233175e+00,  1.14805030e+00],
       [-1.09448697e+00, -2.79322363e+00,  1.83697020e-16],
       [-1.09448697e+00, -2.79322363e+00,  1.83697020e-16],
       [-1.01117411e+00, -2.58060215e+00, -1.14805030e+00],
       [-1.12320489e+00, -1.79955849e+00, -2.12132034e+00],
       [-1.43434710e+00, -1.56289743e+00, -2.12132034e+00],
       [-1.69677955e+00, -1.27316109e+00, -2.12132034e+00],
       [-1.90159014e+00, -9.40188786e-01, -2.12132034e+00],
       [-2.04182360e+00, -5.75288100e-01, -2.12132034e+00],
       [-2.11271767e+00, -1.90850895e-01, -2.12132034e+00],
       [-2.11186481e+00,  2.00067519e-01, -2.12132034e+00],
       [-2.03929400e+00,  5.84191732e-01, -2.12132034e+00],
       [-1.89746970e+00,  9.48477062e-01, -2.12132034e+00],
       [-1.69120820e+00,  1.28055255e+00, -2.12132034e+00],
       [-1.42751405e+00,  1.56914105e+00, -2.12132034e+00],
       [-1.11534217e+00,  1.80444225e+00, -2.12132034e+00],
       [-9.99904519e-01,  2.58498965e+00, -1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00, -1.14805030e+00],
       [-5.08587966e-01,  2.72457681e+00, -1.14805030e+00],
       [ 1.69713917e-16,  2.77163860e+00, -1.14805030e+00],
       [ 1.69713917e-16,  2.77163860e+00, -1.14805030e+00],
       [ 1.29893408e-16,  2.12132034e+00, -2.12132034e+00],
       [ 1.02056596e-16,  1.66671070e+00, -2.49440884e+00],
       [-3.05836773e-01,  1.63841033e+00, -2.49440884e+00]])], [np.array([[-1.11534217e+00,  1.80444225e+00, -2.12132034e+00],
       [-1.42751405e+00,  1.56914105e+00, -2.12132034e+00],
       [-1.69120820e+00,  1.28055255e+00, -2.12132034e+00],
       [-1.89746970e+00,  9.48477062e-01, -2.12132034e+00],
       [-2.03929400e+00,  5.84191732e-01, -2.12132034e+00],
       [-2.11186481e+00,  2.00067519e-01, -2.12132034e+00],
       [-2.11271767e+00, -1.90850895e-01, -2.12132034e+00],
       [-2.04182360e+00, -5.75288100e-01, -2.12132034e+00],
       [-1.90159014e+00, -9.40188786e-01, -2.12132034e+00],
       [-1.69677955e+00, -1.27316109e+00, -2.12132034e+00],
       [-1.43434710e+00, -1.56289743e+00, -2.12132034e+00],
       [-1.12320489e+00, -1.79955849e+00, -2.12132034e+00],
       [-1.01117411e+00, -2.58060215e+00, -1.14805030e+00],
       [-1.09448697e+00, -2.79322363e+00,  1.83697020e-16],
       [-1.09448697e+00, -2.79322363e+00,  1.83697020e-16],
       [-5.20471296e-01, -2.72233175e+00,  1.14805030e+00],
       [-9.47853520e-01, -2.41900263e+00,  1.50000000e+00],
       [-1.46753791e+00, -2.35123648e+00,  1.14805030e+00],
       [-1.46753791e+00, -2.35123648e+00,  1.14805030e+00],
       [-1.87406481e+00, -2.04202390e+00,  1.14805030e+00],
       [-1.87406481e+00, -2.04202390e+00,  1.14805030e+00],
       [-1.69677955e+00, -1.27316109e+00,  2.12132034e+00],
       [-1.90159014e+00, -9.40188786e-01,  2.12132034e+00],
       [-2.40093055e+00, -6.76467242e-01,  1.66671070e+00],
       [-2.48429316e+00, -2.24416911e-01,  1.66671070e+00],
       [-2.48329031e+00,  2.35254514e-01,  1.66671070e+00],
       [-2.39795606e+00,  6.86936805e-01,  1.66671070e+00],
       [-2.23118833e+00,  1.11529104e+00,  1.66671070e+00],
       [-1.98865046e+00,  1.50577050e+00,  1.66671070e+00],
       [-1.74834051e+00,  1.92179746e+00,  1.50000000e+00],
       [-1.36600960e+00,  2.20998139e+00,  1.50000000e+00],
       [-9.99904519e-01,  2.58498965e+00,  1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00,  1.14805030e+00],
       [-5.08587966e-01,  2.72457681e+00,  1.14805030e+00],
       [ 1.69713917e-16,  2.77163860e+00,  1.14805030e+00],
       [ 1.83697020e-16,  3.00000000e+00,  1.83697020e-16],
       [ 1.69713917e-16,  2.77163860e+00, -1.14805030e+00],
       [-5.08587966e-01,  2.72457681e+00, -1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00, -1.14805030e+00],
       [-9.99904519e-01,  2.58498965e+00, -1.14805030e+00],
       [-1.11534217e+00,  1.80444225e+00, -2.12132034e+00],
       [-1.86513698e+00,  2.05018159e+00, -1.14805030e+00],
       [-2.39172957e+00,  1.81097478e+00,  1.83697020e-16],
       [-2.47916364e+00,  1.23924500e+00, -1.14805030e+00],
       [-1.98865046e+00,  1.50577050e+00, -1.66671070e+00],
       [-1.86513698e+00,  2.05018159e+00, -1.14805030e+00]]), np.array([[-1.20935164e-02, -2.77161221e+00, -1.14805030e+00],
       [-1.30899279e-02, -2.99997144e+00,  1.83697020e-16],
       [-1.20935164e-02, -2.77161221e+00,  1.14805030e+00],
       [-1.08838772e-02, -2.49438509e+00,  1.66671070e+00],
       [-5.20471296e-01, -2.72233175e+00,  1.14805030e+00],
       [-5.63354071e-01, -2.94663065e+00,  1.83697020e-16],
       [-1.20935164e-02, -2.77161221e+00, -1.14805030e+00]])], [np.array([[-1.98865046e+00,  1.50577050e+00, -1.66671070e+00],
       [-2.47916364e+00,  1.23924500e+00, -1.14805030e+00],
       [-2.39172957e+00,  1.81097478e+00,  1.83697020e-16],
       [-1.86513698e+00,  2.05018159e+00, -1.14805030e+00],
       [-1.98865046e+00,  1.50577050e+00, -1.66671070e+00]])]]


class SphereScene(ThreeDScene):
    def construct(self):
        self.camera.background_color = BLACK
        self.set_camera_orientation(phi=60 * DEGREES, theta=-102 * DEGREES)

        self.begin_ambient_camera_rotation(rate=0.5)

        color_idx = 0
        colors = [RED, BLUE, GREEN, YELLOW, PURPLE, WHITE, PINK]
        for regions in all_regions:
            for region in regions:

                polygon = Polygon(
                    *[np.array([x, y, z]) for x, y, z in region],
                    fill_color=colors[color_idx],
                    fill_opacity=1,
                    stroke_opacity=1,
                    stroke_width=1,
                    stroke_color=colors[color_idx],
                )

                self.add(polygon)
                self.wait(1)
            color_idx += 1


        sphere = Sphere(radius=2, resolution=12)
        sphere.set_color(RED)
        sphere.set_fill(RED,opacity=1)
        self.add(sphere)

        self.wait(10)


if __name__ == '__main__':
    with tempconfig({'quality': 'low_quality', 'preview': True}):
        scene = SphereScene()
        scene.render()


Additional media files

Images/GIFs

System specifications

System Details
  • OS Mac 15.1.1
  • RAM: 8GB
  • Python version (python/py/python3 --version): 3.11.10
  • Installed modules (provide output from pip list):
Package                Version
---------------------- -----------
click                  8.1.7
cloup                  3.0.5
Cython                 3.0.11
decorator              5.1.1
glcontext              3.0.0
isosurfaces            0.1.2
manim                  0.18.1
ManimPango             0.6.0
mapbox_earcut          1.0.2
markdown-it-py         3.0.0
mdurl                  0.1.2
moderngl               5.12.0
moderngl-window        3.0.3
networkx               3.4.2
numpy                  2.2.0
pillow                 11.0.0
pip                    24.3.1
pycairo                1.27.0
pydub                  0.25.1
pyglet                 2.0.20
PyGLM                  2.7.3
Pygments               2.18.0
pyobjc-core            10.3.2
pyobjc-framework-Cocoa 10.3.2
rich                   13.9.4
scipy                  1.14.1
screeninfo             0.8.1
setuptools             75.5.0
skia-pathops           0.8.0.post2
srt                    3.5.3
svgelements            1.9.6
tqdm                   4.67.1
typing_extensions      4.12.2
watchdog               6.0.0
wheel                  0.45.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant