Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the default Camera Zfar to 4000 #33207

Merged
merged 1 commit into from
Dec 19, 2020

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Oct 31, 2019

This makes it possible to view far away objects without having to tweak any settings. This results in a more usable editor when working on large-scale levels.

This change should have no impact on performance, but note that Z-fighting will be visible at a distance. This can be made less visible by increasing the Znear value (however, doing so will cause nearby surfaces to disappear).
This change was also applied to the editor, but it will only apply to newly created scenes.

This also changes the default camera settings in the glTF importer to match the Camera node's defaults.

cc @lawnjelly, as he inspired me to do this in #32764. I also considered increasing the default Znear value back to 0.1 for better depth buffer precision, but this may not be a good idea as many games may be putting the camera close to walls/floors.

This closes godotengine/godot-proposals#853.

@lawnjelly
Copy link
Member

It was this issue #32764.

I'm no precision guru but generally as I understand it if you are pushing the Z far out, you'd usually be wanting to be pushing the Z near out as well (rather than further in).

Myself I'm not sure the defaults for the camera are all that bad, but it depends on the game and the scale used in the game. Another possible option is that in the editor you could dynamically change the Z near and far if you were worried about objects going out of view, not sure if this is practical or really needed that much.

In that issue it was a bit of a special case that is unlikely to happen in reality, aside from having very large planes with no tessellation.

Also some hardware might end up with less Z buffer precision than others (I think there is a setting in Project Settings->Rendering->Quality->Depth->Hdr) so something that looks ok on desktop with a massive range might not look so good on mobile with more z fighting.

@aaronfranke
Copy link
Member

aaronfranke commented Nov 3, 2019

As-is I don't think this is a good change. At best, if any issues with Z-fighting are hard to notice, this would still mislead users into thinking that Godot currently supports such large scales. Until we have double-precision floats (proposal 892), the usable area is limited to a few kilometers in most use cases.

Eventually, it would be nice to have multiple cameras per viewport, which would allow for vastly larger clipping distances without Z-fighting. The linked PR is closed due to this being an issue that should be tackled in 4.0 with Vulkan, but aside from that, I would suggest waiting to implement multiple cameras until after proposal 892 is implemented so that it would have a practical use case.

For right now, honestly, the current value of 500 could be larger without too many downsides. I suggest no more than 4000 to avoid being misleading, so perhaps 4000 or 2000 are good values.

@Chaosus Chaosus added this to the 4.0 milestone Nov 7, 2019
@Calinou Calinou changed the title Increase the default Camera Zfar to 10000 Increase the default Camera Zfar to 4000 Nov 15, 2019
@Calinou

This comment has been minimized.

@Calinou
Copy link
Member Author

Calinou commented Feb 28, 2020

Now that #13129 is resolved in the master branch, this pull request can be considered again. However, we'll still want to test this on mobile (with Vulkan and GLES2) once those renderers are implemented. If this proves to be an issue on mobile, we should find a way to decrease the default value there somehow.

@Chaosus
Copy link
Member

Chaosus commented Jun 23, 2020

I personally think that 1000 is enough for majority of users...

@Calinou
Copy link
Member Author

Calinou commented Jun 23, 2020

@Chaosus Maybe, but going above doesn't seem to cause much of an issue from my testing (in master at least). That said, I haven't been able to test this on mobile since 3D doesn't work on mobile platforms yet in master.

@RevoluPowered
Copy link
Contributor

RevoluPowered commented Nov 24, 2020

I'm always having to increase this limit when working in the engine, I'm for changing this by default as it always seems very low when working on the importers at least its much more practical to have it at that level to me. I import probably the most varied set of models so this is useful for me.

You can try the lumberyard bistro and without the limit change its bad.

@akien-mga
Copy link
Member

akien-mga commented Dec 18, 2020

Needs a rebase, otherwise seems good to merge as I think 4000 seems to be consensual enough.

And maybe a dedicated PR for 3.2 if this is not trivial to cherry-pick (might not be once rebased).

This makes it possible to view far away objects without
having to tweak any settings. This results in a more usable
editor when working on large-scale levels.

This change should have no impact on performance, but note that
Z-fighting will be visible at a distance. This can be made less
visible by increasing the Znear value (however, doing so will cause
nearby surfaces to disappear).

This change was also applied to the editor, but it will only
apply to newly created scenes.

This also changes the default camera settings in the glTF importer
to match the Camera node's defaults.
@Calinou
Copy link
Member Author

Calinou commented Dec 19, 2020

Rebased.

And maybe a dedicated PR for 3.2 if this is not trivial to cherry-pick (might not be once rebased).

We'll have to fix the issue with SSAO artifacting in 3.2 before we can consider increasing the default camera Far distance.

@akien-mga akien-mga merged commit 2797c2a into godotengine:master Dec 19, 2020
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase the default camera Z-far distance for better editor usability
6 participants