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

Add static mesh, new shapes, dynamic color and variable render resolution #47

Merged
merged 28 commits into from
Aug 7, 2024

Conversation

phohenberger
Copy link
Contributor

  • Add option for meshes to be static, meaning they will only be loaded in once and not changed during the following frames. This significantly improves rendering time for a larger non-moving mesh.
    Can be added to vis.Particle and vis.VectorField by simply giving them the static = True parameter.
    Note that static objects only take in position in the shape of (n_part, n_dim)
  • Add 7 more mesh shapes. Box, Cone, Icosahedron, Octahedron, Tetrahedron, Torus and MobiusLoop
  • Allow to choose the render resolution and samples per pixel for screenshots or exported videos. Default is resolution = [4096, 2160] and spp = 64

Copy link
Member

@SamTov SamTov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! I have a few comments on the mesh objects I would like to discuss briefly. But overall it looks great.

On a second point, I think we can clean up the data flow in the visualiser and the renderer, however, I think this calls for a different PR so we can shelve that for now. Just check out my mesh comments and we can merge the PR.

znvis/mesh/box.py Outdated Show resolved Hide resolved
znvis/mesh/cone.py Outdated Show resolved Hide resolved
znvis/mesh/icosahedron.py Show resolved Hide resolved
@phohenberger
Copy link
Contributor Author

I moved the mesh instantiation to the parent mesh-class. The child-classes now only need a create_mesh function which relies on the specific shape parameters. This reduces the repeated code significantly. What do you think @SamTov

@phohenberger
Copy link
Contributor Author

phohenberger commented Jul 2, 2024

Shapes like Arrow or CustomMesh are special cases and need to overwrite a function in the mesh parent-class. But i think this is still a good solution as they need to instantiate differently and that cannot be generalized.

@phohenberger
Copy link
Contributor Author

The changes passed the tests locally.

================================== test session starts ==================================
platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0
rootdir: -
plugins: anyio-4.3.0, typeguard-4.2.1, dash-2.16.1
collected 13 items                                                                      

CI/integration_tests/test_simple_spheres.py .                                     [  7%]
CI/unit_tests/bounding_box/test_bounding_box.py ..                                [ 23%]
CI/unit_tests/mesh/test_cylinder.py ..                                            [ 38%]
CI/unit_tests/mesh/test_mesh.py .                                                 [ 46%]
CI/unit_tests/mesh/test_sphere.py ..                                              [ 61%]
CI/unit_tests/particle/test_particle.py ..                                        [ 76%]
CI/unit_tests/transformations/test_rotation_matrices.py .                         [ 84%]
CI/unit_tests/visualizer/test_visualizer.py ..                                    [100%]

================================== 13 passed in 14.73s ==================================

@phohenberger phohenberger changed the title Add static mesh, new shapes and variable render resolution Add static mesh, new shapes, dynamic color and variable render resolution Jul 10, 2024
@phohenberger phohenberger requested a review from SamTov July 10, 2024 10:09
Copy link
Member

@SamTov SamTov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes, I just have two comments which could be addressed quickly. And I like the new parent class updates.

examples/all_shapes.py Outdated Show resolved Hide resolved
znvis/mesh/mesh.py Outdated Show resolved Hide resolved
@phohenberger
Copy link
Contributor Author

phohenberger commented Jul 11, 2024

Alright, i think now all the changes are adressed.

@phohenberger phohenberger requested a review from SamTov July 11, 2024 15:19
Copy link
Member

@SamTov SamTov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@SamTov SamTov merged commit 3f3ddfa into zincware:main Aug 7, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants