media
media copied to clipboard
[Transformer] Overlay rotation around the X and Y axles
Thank you for the excellent work on the transformer! I've learned a lot by reading your code.
Use case description
At the moment, we can only rotate overlays around Z axles. It would be awesome if we could rotate around the other two axles.
Proposed solution
OverlayMatrixProvider is where the calculation happens. It looks very complicated and intimidating to me.
Thanks for you comments! Nice to see the work is appreciated.
Spinning around the x or y axis would be a 3D customization, and we don't support those in overlays sadly as we found combining different geometric operations didn't work as well as we'd hoped in would as the aspect ratio was often a little off.
In Media3 version 1.1.1 we supported defining your own transformation matrix. You could play around with that version and that api and see if you can get a lateral or vertical rotations working that by the gl matrices yourself and passing it in. We have a 3D spin effect that can show you what matrices are involved in creating a rotation around y axis. If the setMatrix()
api proves useful then we may consider bringing it back in another form.
Thank you for the quick reply and explanation! The repo is full of precious code! I'll try those APIs and report back here if I can pull it off. :D
just went through the API and realised there is this method in the Overlay base class TextureOverlay: https://github.com/androidx/media/blob/d13a0f4ec62ca092b79746a5725b62a3244cc5b4/libraries/effect/src/main/java/androidx/media3/effect/TextureOverlay.java#L55
if the matrix you can get a 3D spin matrix working, you can input it there to have it applied on the Overlay
In summary, this can be solved with the current API. Hope this helps!