Skip to content
New issue

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

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

Already on GitHub? # to your account

Fixed ComposeMatteLayers method to work for invisible layers #479

Merged
merged 4 commits into from
Dec 15, 2021

Conversation

aborziak-ms
Copy link
Collaborator

translatedLayer.GetVisualRoot may return null if it detects that layer will not be visible (it has opacity zero, or visible time range is out of parent's time range). If this layer should be matted or should be used as a matte layer it may cause some artifacts to appear.

New implementation should be more robust and should handle most corner cases.

  1. If both mattedLayer and matte are not null -> compose them into one layer
  2. If mattedLayer is null -> skip both layers
  3. If matte layers is null -> we can skip them too, (!) except for the case when MatteType is Invert, in this case we are inverting invisible layer which mean that it is always visible, so we should keep mattedLayer

@aborziak-ms aborziak-ms requested a review from a team December 15, 2021 00:48
{
// Matte layer is null, which means that it is never visible and LayerMatteType is equal to Invert.
// In this case we should just return mattedVisual because matte layer is effectively a no-op.
yield return new LayerTranslator.FromVisual(mattedVisual);
Copy link
Contributor

@eliezerpMS eliezerpMS Dec 15, 2021

Choose a reason for hiding this comment

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

yield return new LayerTranslator.FromVisual(mattedVisual);

Is this what happens in After Effects? (As in if you make the matte inverted and not visible then it just shows the layer to be matted?)

Also should this produce an issue or something? Is there a case where a creator would have done this intentionally (have the matte never show up)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this is how it works in AE.

Actually this is a good idea I think, because that is how we discovered this bug, Lottie-Windows produced wrong result but there were no issues to see what exactly is wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. Thanks for adding the new issue!

I am thinking though that we probably want the issue to pop up even for the invert no-op case too right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, thx

Copy link
Contributor

@eliezerpMS eliezerpMS left a comment

Choose a reason for hiding this comment

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

:shipit:

@aborziak-ms aborziak-ms merged commit 426710b into master Dec 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the user/aborziak/matter-layers-fix branch December 15, 2021 21:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants