godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a "Add Camera from view" button and shortcut in the 3D editor #1798

Open golddotasksquestions opened 3 years ago

golddotasksquestions commented 3 years ago

Describe the project you are working on: I need this in every 3D prototype, even the simplest scenes.

Describe the problem or limitation you are having in your project: Adding a new camera is always incredibly tedious. When working on my project, I live in the perspective view 99% of the time. I import and arrange assets and when it finally comes to saving the scene I want to add a camera. Currently this means pointless clicks through menus, dragging the camera from it's zero position, rotating it around until it finally is close to the perfect location I had in my perspective view already. I am frustrated and annoyed by this because I have to repeat this mindless task with every scene again and again, when there is a camera (perspective view) at the exact location and rotation I want already.

Describe the feature / enhancement and how it helps to overcome the problem or limitation: A single click instead of repeatedly wasting minutes of clicking and dragging to approximate what was already there. This would also make it a million times easier to place cameras for cutscenes, and 3D in 2D viewports. add_camera

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Just like in Maya I would really wish for a button and a shortcut that immediately adds a 3D Camera to the scene (to the last known scene tree position), at the precise translation and rotation of my perspective view.

If this enhancement will not be used often, can it be worked around with a few lines of script?: I would not know how. Even it is was possible, it's a much needed usability feature, I think anyone needs to have at their fingertips when they use the 3D editor.

Is there a reason why this should be core and not an add-on in the asset library?: It's not a usability improvement if it is behind the barrier of an optional download.

Calinou commented 3 years ago

This can already be done with the following steps:

Since this isn't something you need to do very often, I don't think we need to add a dedicated button for it.

golddotasksquestions commented 3 years ago

This is about usability. I don't manage to do this even with your explanation.

Calinou commented 3 years ago

@golddotasksquestions Apologies, it's Ctrl + Alt + M, not Ctrl + Shift + M. I edited my comment accordingly.

golddotasksquestions commented 3 years ago

Thank you, that works and is a super useful shortcut, but not exactly beginner friendly or transparent feature.

How about spawing the camera already with the perspective Transform when using Add Child Node (Ctrl+A)? It's much easier and beginner friendly to go to the Transform Inspector and hit the "default" symbol than go through lengthy online searches and learn about the Ctrl + Alt+ Mshortcut. Plus, I literally can't think of a single occasion I ever need the camera at Vector3(0,0,0) with 0 rotation. Whereas in 99% of the usecases I want it exactly with my Perspective view Transforms or somewhere close.

Btw, I imediately changed Ctrl + Alt+ M to Ctrl + F, since even with my giant hands this is quite an impossible combination to hit onehanded. Maybe worth considering changing this, as it is really useful for all kinds of situations, not just for cameras.

Calinou commented 3 years ago

How about spawing the camera already with the perspective Transform when using Add Child Node (Ctrl+A)?

This could be confusing if you're adding a camera as a child node of a player character or something like that.

golddotasksquestions commented 3 years ago

Why would this be confusing? It would be exactly what I want and expect. The only exception might be when you want to add the player camera for a first person game, but then all you need to do is to hit the two "restore defaults" icons next to the Translation properties. How to reset a property is very basic knowledge. How to learn about Ctrl + Alt + M is not. Just finding the shortcut menu is not easy to miss. Not to mention how would the user then know what shortcut to look for ... I have been annoyed with placing a camera in Godot ever since I first opened a 3D scene and I only today thanks to you pointing it out I learned about it. You better believe, I was looking everywhere for this.

Calinou commented 3 years ago

My issue with this is that we're creating "exceptional" behavior by positioning Cameras differently from all other 3D nodes on creation. If we change this just for Camera nodes and not any other 3D nodes, this might end up surprising the user. (It definitely wouldn't be a good idea to do this for all 3D nodes, though.)

golddotasksquestions commented 3 years ago

Yes, I understand what you are saying with "exceptional" behavior. However spawning a camera at 0,0,0 is "never needed" behavior. Hence the proposal for the button which would be a solution to all those problems: Consistent default behavior, yet obvious and userfriendly, intuitive, single click UI button - instead of many clicks with an obscure shortcut.

CedNaru commented 3 years ago

A camera at 0,0,0 might be a "never used" case, but it's also a neutral/reference starting position. This looks more like a personal preference than a QOL feature. Also, such a button seems really easy to implement in a few lines with an addon.

Jummit commented 3 years ago

Also, such a button seems really easy to implement in a few lines with an addon.

I made a plugin that implements this proposal: camera_adder.zip

It's not a usability improvement if it is behind the barrier of an optional download.

I disagree. I use a lot of QOL addons and it's really easy to add them to a project if you already have the plugin downloaded somewhere.

FyiurAmron commented 10 months ago

@Calinou FWIW, Ctrl+Alt+M doesn't do exactly what it should (or at least doesn't do what I would expected based on your description) for the camera:

image image

(I matched them manually to be pixel-per-pixel aligned on my monitor)

putting the obvious difference in lighting etc., there's a very visible offset here, see this pic which overlays both:

image

Calinou commented 10 months ago

FWIW, Ctrl+Alt+M doesn't do exactly what it should (or at least doesn't do what I would expected based on your description) for the camera:

You need to enable camera preview in the editor by ticking the Preview checkbox in the top-left corner of the 3D editor viewport. Otherwise, your 3D editor viewport won't be using the same FOV as the Camera3D node (the default value intentionally differs).

FyiurAmron commented 10 months ago

@Calinou

the Preview checkbox

BTW, what's the difference between the "Preview" from the camera and the "Cinematic Preview"? I couldn't find any docs describing this in detail.

(the default value intentionally differs).

Hm. That's actually quite interesting TBH, care to elaborate? I mean, what exactly is the difference (is it just the 70 deg FOV for viewport by default and 75 deg FOV for camera, or are there other things that differ), and what is the rationale for it existing? I kinda expected the default FOVs to be aligned to either 60 (Unity's default), 90 (UE/FPS default) or 70 (other common choice in games), the 75 deg default is somewhat surprising here IMVHO (I've seen it in the wild a couple times, e.g. in NMS, but I'd still consider it non-standard).

I'm not gonna lie, I'd actually expect the default values to be aligned, since that is POLA IMVHO; doing the camera-to-view in Unity, Blender et al. "just works". Here, Ctrl+Alt+M with default values gives me a camera that's not strictly aligned with the viewport, and even Preview is not exactly this functionality, since you can't move the camera then (the MR with this exists I guess though). I don't care about shortcuts/icons etc. like OP too much (I can do a plugin etc. to have that), but I'm just looking for a way to have a way to clone the settings from the viewport to camera 1:1.

Calinou commented 10 months ago

BTW, what's the difference between the "Preview" from the camera and the "Cinematic Preview"? I couldn't find any docs describing this in detail.

Cinematic Preview previews the camera that is marked as current in the currently edited scene. This is the first camera with the Current property enabled, or the first camera in the scene if there is no camera with Current enabled.

Hm. That's actually quite interesting TBH, care to elaborate?

The 3D editor viewport doesn't cover the entire screen, so you're technically viewing it over a smaller surface. A smaller FOV makes more sense here.

the 75 deg default is somewhat surprising here IMVHO

The default Camera3D FOV was increased to 75° (vertical) in 4.0 to better match the usual 90° horizontal FOV on a 4:3 aspect ratio (~106.26° on 16:9), which is popular in PC games. The exact value to match this with a vertical FOV is roughly ~73.74°, but it would look a bit strange if we defaulted to that value, so we rounded it up to 75° (which is equivalent to ~92° horizontal on a 4:3 display).

Unreal uses horizontal FOV by default, so its measurement can't be compared to vertical FOV. Unity's default (60° vertical) is more suited for games played from a couch-TV distance rather than PC games on a desk, where this FOV can feel nauseating in the long run (even 70° vertical does that to me).

FyiurAmron commented 10 months ago

The default Camera3D FOV was increased to 75° (vertical) in 4.0 to better match the usual 90° horizontal FOV on a 4:3 aspect ratio (~106.26° on 16:9), which is popular in PC games. The exact value to match this with a vertical FOV is roughly ~73.74°, but it would look a bit strange if we defaulted to that value, so we rounded it up to 75° (which is equivalent to ~92° horizontal on a 4:3 display).

Aah, so it's not 90 but 92 HFOV due to rounding, understood! :)

One more question though @Calinou - would it be possible to make the in-editor docs about viewport FOV more explicit that this is a vertical FOV? The docs for regular cameras are completely transparent about this, since by default it uses "keep height", so per doc default FOV is VFOV image - but for viewport camera, I can find no mention that this is VFOV (and no way to have it "keep width" BTW, it seems it always keeps height fixed).

image

Calinou commented 10 months ago

would it be possible to make the in-editor docs about viewport FOV more explicit that this is a vertical FOV?

Done: https://github.com/godotengine/godot/pull/86690