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

Fix renderer scaling #3990

Merged
merged 6 commits into from
Feb 9, 2023
Merged

Fix renderer scaling #3990

merged 6 commits into from
Feb 9, 2023

Conversation

banesullivan
Copy link
Member

@banesullivan banesullivan commented Feb 9, 2023

set_scale() has been effectively broken for a long time, with at least me advising strongly against using it.

These changes resolve #3695 and resolve #2993 implementing a different scaling strategy that should improve it to a more useable state.

For scaling, we currently set a model transform matrix on the camera and this is riddled with issues resulting in incorrect camera positions, incorrect lighting, messed up camera clipping planes, messed up text display, and more.

This new implementation is better but still not excellent.

Now when setting a scale on the Renderer via set_scale(), each actor in that renderer is scaled the same. This could have unexpected consequences if scaling an actor individually and then scaling the whole Renderer as the actor's scale will be overridden. However, I think the improvements from this interface outweigh the costs of the new implementation. Afterall, scaling seems to be a rarely used feature (likely due to all it's issues) and I added a note to set_scale()'s docs to indicate this issue.

@akaszynski, I also changed up the logic on if 3D text is used with the bounds so as to not warn users with default arguments.

I would like to review this an backport to release/0.38 for the 0.38.2 release

@github-actions github-actions bot added the bug Uh-oh! Something isn't working as expected. label Feb 9, 2023
@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #3990 (c18c87b) into main (92665b8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #3990   +/-   ##
=======================================
  Coverage   94.29%   94.30%           
=======================================
  Files          94       94           
  Lines       20330    20335    +5     
=======================================
+ Hits        19171    19177    +6     
+ Misses       1159     1158    -1     

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

LGTM

@banesullivan banesullivan merged commit 3bd7b94 into main Feb 9, 2023
@banesullivan banesullivan deleted the fix/scaling branch February 9, 2023 18:27
banesullivan added a commit that referenced this pull request Feb 9, 2023
* Fix renderer scaling

* Add safety check

* Fix font issue

* add test

* Update pyvista/plotting/renderer.py

---------

Co-authored-by: Alex Kaszynski <akascap@gmail.com>
@akaszynski akaszynski mentioned this pull request Apr 30, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
2 participants