Skip to content

Feature: Aspect ratio control#109

Open
FugLong wants to merge 4 commits into
chrrs:26.1from
FugLong:feature/AspectRatios
Open

Feature: Aspect ratio control#109
FugLong wants to merge 4 commits into
chrrs:26.1from
FugLong:feature/AspectRatios

Conversation

@FugLong

@FugLong FugLong commented Jul 12, 2026

Copy link
Copy Markdown

My friends and I have really been enjoying this mod but I kept finding myself wishing I could shoot 4:3 or even portrait, so I created this feature branch to attempt to make that possible!

This PR adds 2 things:

  1. Aspect Ratio Control:
    - Users can now cycle between aspect ratios using the pick block bind (middle mouse default).
    - Available modes are Screen, 16:9, and 4:3. Screen only appears for users who have an aspect ratio that is NOT 16:9 or 4:3.
    - The camera UI now shows current aspect ratio under the date.

  2. Landscape vs Portrait:
    - Users can toggle between landscape and portrait shooting rotation by pressing their crouch key quickly (default shift, holding will not trigger it)
    - Landscape/Portrait rotation toggle respects aspect ratios. Screen becomes screen inverse, 16:9 becomes 9:16, 4:3 becomes 3:4.
    - The camer UI now shows current landscape vs portrait mode rotation below the date.

In terms of work this was not actually hard at all because the whole mod already supported any aspect ratio, it just took pictures at screen resolution. This implementation is technically not the best because portrait shots are being cropped inherently so quality-wise they aren't going to be as high resolution as landscape but I don't think that's really the point of this mod, it's about clean UX, fun, and connection with your friends so I think this is a non issue.

I'm really happy with how the visuals look now too, here are some screenshots (third shot shows "Screen" on 16:9 image just for example purposes because I only have 16:9 monitors):
2026-07-12_11 56 19

2026-07-12_14 22 08 2026-07-12_11 57 45 2026-07-12_11 57 22 2026-07-12_11 57 36

FugLong added 3 commits July 12, 2026 11:34
Added:
1. Aspect ratios (screen, 16:9, 4:3), cycled by pick block (middle mouse default)
2. Landscape vs portrait (screen inverse, 9:16, 3:4), toggled by quick press of crouch (default shift)
@chrrs

chrrs commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Oh this looks really cool, thanks a lot!! I really like how you did the UI with the letterboxes being transparent.

I haven't had the time to look over this well, sorry, I'll get to that soon! Though on first look the code looks fine to me.

I do like pick-block for cycling aspect ratio's a lot, but I like the crouch bind less (easy to press by accident, and crouching is something I use a lot to make small changes in my position). Maybe it would make more sense to have crouch+pickblock be switching portrait mode? Ideally, I feel like there also should be some kind of key prompt on the screen to show how to switch that, because it isn't very obvious, but I'm not sure on the best way to do that without it getting in the way.

I definitely agree with the resolution part, it'd be way harder to make these higher resolution, so this is more than fine.

Thank you again, this looks great!

@FugLong

FugLong commented Jul 15, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback! Later today or this week I will experiment with improved input, I agree accidentally switching rotation mode would be bad.

Will also play around with ways to indicate to the player how to do the interaction; you're def right about the UI need. Maybe a little pixel art mouse with the middle button highlighted? But then if someone rebinds pick block it will just confuse them. Potentially on camera open we could just have text pop up on screen temporarily that tells them about pick block interaction but that seems sloppy lol.

I'll see what I can come up with 👍

@chrrs chrrs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hi! I only got to looking at this now, sorry for the wait!. This looks great, I really like how you did most of this. I left a few small comments, though nothing big or dealbreaking. :)

I thought a bit more about the controls. Maybe it could make sense to put them both on the scroll wheel? E.g. SHIFT+scroll changes aspect ratio, SHIFT+middle mouse changes portait/landscape?

I've struggled in the past with a keybind indicator, too. For example, in the picture screen, where you can save a picture with Ctrl+S, that shows up when holding Ctrl, but it's still not very discoverable and I'm not that satisfied with it. I think it's going to be a similar case here, because you don't want to make the UI messy by adding indicators everywhere. For now, I'd also be fine with just having it be a "hidden" feature temporarily if we can't come up with anything.

In any case, this looks awesome, it can definitely be merged after those few changes. Thank you again!

/// capture aspect ratio instead of picking a block or entity.
@Inject(method = "pickBlockOrEntity", at = @At("HEAD"), cancellable = true)
private void camerapture$onPickBlock(CallbackInfo ci) {
if (CameraCaptureControls.onPickBlock()) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think this function is short enough that it would be clearer to just do this inline, similar to how it's done for punching when taking photos. Otherwise you'll have to go a layer deeper to actually figure out what this does.

RATIO_16_9,
RATIO_4_3;

private static final double RATIO_MATCH_EPSILON = 0.02;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

In this case, I think it makes more sense to use a smaller epsilon. This value means that the ratio can be within 2%, but that means that when it says "16:9", that doesn't guarantee that the picture is actually 16:9, because it could be off and be something like 16.1:9. It's not a huge difference, but I think it's good to be precise.

case SCREEN -> orientation == CameraOrientation.PORTRAIT
? "text.camerapture.aspect.screen_inverse"
: "text.camerapture.aspect.screen";
case RATIO_16_9 -> orientation == CameraOrientation.PORTRAIT

@chrrs chrrs Jul 19, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

For these, I'd say it's fine just to do a literal text component. Aspect ratio's are not going to be different in other languages, and it'll give us the flexibility to add more aspect ratio's down the line if we really want to (2:1 / 1:2 for fitting blocks for example?).

A second (related) suggestion is to just make this function return Component, and return Component.translatable directly. I think that'll make it more obvious both here and at the caller site.

return this == LANDSCAPE ? PORTRAIT : LANDSCAPE;
}

public String translationKey() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

(same here, see above)

RATIO_16_9,
RATIO_4_3;

private static final double RATIO_MATCH_EPSILON = 0.02;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

In this case, I think it makes more sense to use a smaller epsilon. This value means that the ratio can be within 2%, but that means that when it says "16:9", that doesn't guarantee that the picture is actually 16:9, because it could be off and be something like 16.1:9. It's not a huge difference, but I think it's good to be precise.

@FugLong

FugLong commented Jul 20, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback and I love your suggestion for the input change! Will try to get this all implemented after I get off work today

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.

2 participants