• Godot Help
  • I need a camera to have more "far" distance

Is there a way to increase it more than 8192?

  • Certainly. You can also call the camera's set_far()/set_near() methods from elsewhere. Just remember to stay in a range of around 7 digits of precision, that is assuming the depth buffer is a 32 bit float, which I don't know !

    7 digits would mean 1 to 1000000, or 0.1 to 100000, or 0.01 to 10000. You'll see if you're out of bounds when things show up that shouldn't, because they are behind others, or when they start flickering in and out when very close or very far. Then push the near plane out a bit if you need the far sight.

    This document says the depth buffer on the PC is 24 bit , probably unsigned integer then I guess (because of available Vulkan depth buffer formats), but that's a Godot limitation, not a technical, and the document may not be up to date. And I don't yet know enough about the engine to tell if and how this can be configured.

Just realized that in 4.0 the slider only goes out to 4000. I don't really see why there is that limitation.

    Pixophir Just realized that in 4.0 the slider only goes out to 4000. I don't really see why there is that limitation.

    Probably because of floating point precision? Since the depth pass is linear and single precision I guess.

    Na, that can't be it. A 32 bit fp depth buffer, standard on PC, mobile don't know but can't really imagine that not, can handle much more. It starts to become quirky at ranges of more than 100km, that terrain in the distance starts to jostle, and only when the near plane is directly in front of the camera (0.1m). If one can adjust near/far dynamically than much larger ranges are possible.

    I would assume that it is just a limitation in the editor, and one can set higher values via script ?

      Pixophir Well, yeah, I mean the depth pass is linear and if you set your near value to be really small, say 0.0001 or something then it eats away at what your theoretical far value cap can be. In effect if we assume that the near/far fields divvy up the 32 bit float between them evenly then you effectively are only left with 16 bits of precision for the far field each of them.

      Pixophir I would assume that it is just a limitation in the editor, and one can set higher values via script ?

      Should be a camera node property. For the editor I think the setting is exposed via editor header menu somewhere.

      Yeah, you can't have it all, precision close and precision far. 0.0001 is close to a microscopic scale already, in Godot terms a tenth of a millimeter, approaching the scale of (large) monocellular organisms. That's incompatible with a large open landscape. Even a real person would have to rub their eyes and readjust focus to look up and out of the window. In a game the easiest method to adapt to these changes is to keep the depth range dynamic, adjusting near and far planes according to needs.

      Certainly. You can also call the camera's set_far()/set_near() methods from elsewhere. Just remember to stay in a range of around 7 digits of precision, that is assuming the depth buffer is a 32 bit float, which I don't know !

      7 digits would mean 1 to 1000000, or 0.1 to 100000, or 0.01 to 10000. You'll see if you're out of bounds when things show up that shouldn't, because they are behind others, or when they start flickering in and out when very close or very far. Then push the near plane out a bit if you need the far sight.

      This document says the depth buffer on the PC is 24 bit , probably unsigned integer then I guess (because of available Vulkan depth buffer formats), but that's a Godot limitation, not a technical, and the document may not be up to date. And I don't yet know enough about the engine to tell if and how this can be configured.