Page 1 of 1

Cropping Output

Posted: Tue Nov 16, 2021 6:56 pm
by frank_halfwong
Hi,

Reading the forums, the only thing I could was to use the "Resolution" module but I'm not sure if it''ll do an OBS like crop where some components aren't rendered at all outside of the cropped boundaries.

I've also seen the mask / polygon method.

Are those the only two ways to do this?

Thanks as usual!

Frank

Re: Cropping Output

Posted: Tue Nov 16, 2021 7:04 pm
by Magic
Those two ways are fine. Why would you need anything else?

Re: Cropping Output

Posted: Wed Nov 17, 2021 4:02 am
by frank_halfwong
Because they aren't the most rapid ones to do. click/drag area would be better but I understand that MMV's UI isn't built for that (or would it be possible maybe a more appropriate question).

Cheers.

Re: Cropping Output

Posted: Wed Nov 17, 2021 4:44 pm
by Magic
Ah, I understand. There have been some other threads about clicking/dragging in the output window, but generally we don't have it as a high priority.

Re: Cropping Output

Posted: Thu Dec 16, 2021 4:46 am
by frank_halfwong
Hi Eric,

I'm trying to do the crop the way we discussed but it doesn't end up being usable in order scenes.

Here's my goal :

I want to cut a camera input (1920x1080) into 4 quadrants and use these independently. Using trapezoid works but when it comes to reusing only 1 quadrant afterwards isn't simple/easy.

Any ideas?

Thanks
frank

Re: Cropping Output

Posted: Thu Dec 16, 2021 4:43 pm
by Magic
Not sure what trapezoid means.

Masking with a Polygon should work fine...?

Re: Cropping Output

Posted: Thu Dec 16, 2021 6:02 pm
by frank_halfwong
Let's put it this way then : How do i use only 25% of a scene's area as an input into another scene? I want to be able to use all 4 25% portions (top left, right, bottom left, bottom right), as independent components.

Even if I hide using polygons or whatever the module, 75% of the scene's undesired portions, when I'll add it to another scene I'll have 75% of the input blacked out but it'll still be there (i need it to become transparent alpha).

Let me know if it's clear.

Thanks
Frank

Re: Cropping Output

Posted: Thu Dec 16, 2021 11:15 pm
by Magic
I think I understand. So you would just need to scale/translate the desired portion so that it fills the screen.

Re: Cropping Output

Posted: Fri Dec 17, 2021 1:19 am
by Sadler
I think Frank, you want to 'capture' the 4 corners of your content and play with them something like this.
An output scene that recombines the four corners and manipulates each separately.
An output scene that recombines the four corners and manipulates each separately.
Screenshot 2021-12-17 003607.png (89.38 KiB) Viewed 10475 times
Trying to interpret what you've said above, I think you've tried to cover 75% of your content with opaque polygons to isolate a portion of the source content. This is not what 'masking' means. Masking means to multiply the pixels in your source content with a mask. In your case this mask would be a white polygon in each corner of the scene. Here is one way to do that using the Mask module:
Sub-scene that 'captures' a corner of the source content.
Sub-scene that 'captures' a corner of the source content.
Screenshot 2021-12-17 005303.png (29.04 KiB) Viewed 10475 times
This would isolate the top-right of the SceneInput for a 16x9 aspect ratio window. There would be a very similar sub-scene for each of the other 3 corners. It is these subscenes that are used in the first screen-shot. One can now split up any content into four separate quarters and manipulate them however you like:
Different effects applied to each corner of the source content.
Different effects applied to each corner of the source content.
Screenshot 2021-12-17 010621.png (481.79 KiB) Viewed 10475 times
There is an significant issue with this method however. Some (most) effects applied to each corner will be applied across the whole scene output (window/screen). Some (e.g. those in the first screen-shot), thankfully, apply only to the mask area but most, frustratingly, don't (e.g. Invert).

Re: Cropping Output

Posted: Fri Dec 17, 2021 12:04 pm
by Terry Payman
Further to Sadler's suggestion, if you want to use effects on your scene quadrants I think you can address the issue he raises by re-masking the output of any "problem" effects with an appropriate white quadrant before any translation/scaling/rotation of your scene quadrant (or by masking with an identically translated/scaled/rotated white quadrant afterwards).

To ensure your scene quadrants are opaque regardless of the alpha of the input scene (or any modification due to effects) you can use the Set Alpha module to set alpha=1 before the final masking.

Re: Cropping Output

Posted: Fri Dec 17, 2021 2:30 pm
by frank_halfwong
Thanks to both of you! i'll look into this method over the weekend; Sadler you got exactly what I was intending to do.

My little question is : there is no such module as "top/left" etc modules. I thought of doing the translate thing but I can't wrap my head around the value range.

I always thought 0 to 1 meant 0 to 100% translated but it seems to work on another basis. In my mind translate X and Y by 0.5 was going to cut it but it never really does a perfect cut. In my mind, it should have been scale X2 then take X,Y and trnslate by (0.5, 0.5), (0.5, -0.5), (-0.5, 0.5) and finally (-0.5, -0.5).

Never worked!

Cheers to both of you!
Francis

Re: Cropping Output

Posted: Fri Dec 17, 2021 5:28 pm
by Magic
Actually Frank I'm not even sure you need to crop for purposes of what you're doing.

See my images below. The first one is the full frame (no scaling/translating), the second is with the bottom left corner scaled and translated to fill the window.

Then you can apply an effect to the whole window, and then scale it back down if you need to. Make sense?

The amount you translate is related to the aspect ratio of the video, so if it's 16/9, that's ~1.78, which divided by two is ~.89.
Screen Shot 2021-12-17 at 9.23.35 AM.png
Screen Shot 2021-12-17 at 9.23.35 AM.png (1.02 MiB) Viewed 10463 times
Screen Shot 2021-12-17 at 9.22.54 AM.png
Screen Shot 2021-12-17 at 9.22.54 AM.png (1.02 MiB) Viewed 10463 times

Re: Cropping Output

Posted: Fri Dec 17, 2021 7:23 pm
by frank_halfwong
wow..... the translate values are based on the aspect ratio???????????????? omg.... i thought it was a % of total screen length/height. Wow you just rocked my world!

And yes, that's right, just making a translation/scale on an input is all i need that's perfect. Thank you so much I'll give it a try tonight!

Thanks again
Frank

Re: Cropping Output

Posted: Fri Dec 17, 2021 9:20 pm
by Terry Payman
I find it useful to have Aspect and Aspect/2 as globals, saving the need to put the same calculation into many modules.

As one cannot (yet?) use internals in expressions these are calculated using the internal "Overall Height" to set the value of an additional global "Height" .

Further, as I design nearly all my scenes for projection I need them to be reasonably aspect ratio independent. This is hugely facilitated by aspect globals as opposed to many embedded "magic" numbers.

Re: Cropping Output

Posted: Sat Dec 18, 2021 2:11 am
by frank_halfwong
Brilliant as usual Terry! I'll go ahead and create these internal variables as well, so smart.

Cheers, once again, for the amazing tips & insight!
Frank