Skip to content

Conversation

gaborkb
Copy link
Contributor

@gaborkb gaborkb commented Aug 10, 2022

Purpose of this PR

https://jira.unity3d.com/browse/CMCL-866 (has repro project)
(This fix will need to be added to 3 and 2.8).

  • The initial fix for this issue was not precise enough. So now we allow equality for the special case.
    Change at line 264 in com.unity.cinemachine/Runtime/Core/ConfinerOven.cs.

  • Added new m_Quality field.
    I played around with the min step size, and it can be used to improve the quality of the confiner in some of these edge cases. I did not find a big performance impact either. I created a prototype quality control, but maybe we should expose the quality parameter as a scripting API only.

Testing status

  • Added an automated test
  • Passed all automated tests
  • Manually tested

Documentation status

  • Updated CHANGELOG
  • Updated README (if applicable)
  • Commented all public classes, properties, and methods
  • Updated user documentation

Technical risk

Comments to reviewers

Package version

@gaborkb gaborkb changed the title allow equality of center point special case. Expose step size for fin… Draft - Confiner2D Aug 10, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2022

Codecov Report

Merging #530 (3b21a8b) into release-prep/2.9.0 (b3c79ef) will increase coverage by 0.01%.
The diff coverage is 91.66%.

Impacted file tree graph

@@                  Coverage Diff                   @@
##           release-prep/2.9.0     #530      +/-   ##
======================================================
+ Coverage               24.01%   24.03%   +0.01%     
======================================================
  Files                     126      126              
  Lines                   18659    18663       +4     
======================================================
+ Hits                     4481     4485       +4     
  Misses                  14178    14178              
Impacted Files Coverage Δ
...achine/Runtime/Behaviours/CinemachineConfiner2D.cs 76.97% <75.00%> (+0.30%) ⬆️
com.unity.cinemachine/Runtime/Core/ConfinerOven.cs 78.39% <100.00%> (+0.13%) ⬆️

@gaborkb gaborkb changed the title Draft - Confiner2D CMCL-866 - Confiner2D precision issues Aug 10, 2022
@gaborkb gaborkb marked this pull request as ready for review August 10, 2022 06:11
@gaborkb gaborkb requested a review from glabute as a code owner August 10, 2022 06:11
Copy link
Collaborator

@glabute glabute left a comment

Choose a reason for hiding this comment

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

Camera still moves (a little) in the sample scene, even at max quality.
I'm not convinced that this quality business is a good strategy for handling such edge cases. 0.000005f is an insanely small step size. Maybe we can have a discussion about how to solve this better.

const float k_MinStepSize = 0.005f;

float m_MinStepSize = k_MinStepSize;
const float k_MinStepSize = 0.005f, k_MaxStepSize = 0.000005f;
Copy link
Collaborator

Choose a reason for hiding this comment

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

max is smaller than min?

const float k_IntToFloatScaler = 1.0f / k_FloatToIntScaler;
const float k_MinStepSize = 0.005f;

float m_MinStepSize = k_MinStepSize;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be called m_StepSize or something like that? It's a bit confusing between m_MinStepSize and k_MinStepSize.


m_confinerOven = new ConfinerOven(m_OriginalPath, aspectRatio, maxWindowSize);

quality = (quality - k_QualityMin) / k_QualityMax; // normalize quality to [0-1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Normalization is not guaranteed, because caller can pass anything for quality

@gaborkb gaborkb marked this pull request as draft August 10, 2022 13:33
Base automatically changed from release-prep/2.9.0 to release/2.9 August 11, 2022 06:40
@gaborkb
Copy link
Contributor Author

gaborkb commented Oct 12, 2022

No longer relevant. See clipper2 in CM3

@gaborkb gaborkb closed this Oct 12, 2022
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.

4 participants