Previous topicNext topic

Cropping Output

Questions, comments, feedback, etc.
Post Reply
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Cropping Output

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Cropping Output

Post by Magic »

Those two ways are fine. Why would you need anything else?
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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.
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Cropping Output

Post 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.
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Cropping Output

Post by Magic »

Not sure what trapezoid means.

Masking with a Polygon should work fine...?
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Cropping Output

Post by Magic »

I think I understand. So you would just need to scale/translate the desired portion so that it fills the screen.
Sadler
Posts: 1139
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: Cropping Output

Post 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 8713 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 8713 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 8713 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).
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Cropping Output

Post 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.
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Cropping Output

Post 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 8701 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 8701 times
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Cropping Output

Post 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.
Attachments
Aspect Ratio.jpg
Aspect Ratio.jpg (33.31 KiB) Viewed 8696 times
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Cropping Output

Post 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
Post Reply