Question about Camera3D far plane and distant land culling

Godot Version

4.6.1 stable

Question

Hello,

I have a question about how Camera3D works in godot.

In my game, I have a huge 3d map where the player can navigate in first person view. However, there is a problem where distant mountains will disappear when they get to the center of the camera view. I spent some time investigating my chunk code thinking it was a bug, but trying to reproduce the issue in a new project with no chunk system (the map is a single large 3d mesh instance) produced the same result.

What I think is that if the far plane of the camera is indeed a plane facing the player, then the distance from the plane to the player is greater on the edge of the camera view, which creates this effect where the land will be shown only on the edge of the camera. I’m not sure this is the correct explanation.

My question is, did anyone have the same type of issues and how did you work around this ? Is there someone who made a game where you can see the land from very far away who knows another way to solve this problem ? I thought I could bring the scale of everything down so the camera “far” value is well beyond the limits of the world ?

Here is a footage demonstrating the issue, where the mountains disappear as I rotate the camera. Of course, this only happens when I’m at maximum zoom level

Camera near and far are adjustable camera properties. For the editor camera they can be changed in View->Settings.

1 Like

That’s only a problem in the Editor?
You can change the view setting, on top under View - Settings

I should have been more explicit sorry, but the problem happens in the editor and in the game itself, even if I set the far property of the camera to its maximum value.

In the editor, it seems I can increase the far value to remove the issue and display the whole land, thanks for the tip :slightly_smiling_face:

Does it mean that to apply the fix for the game itself, I should increase the far value beyond the suggested editor limit of 4000?

Editor camera and your camera node are two different things. You can set the far value as high as far you need to see.

1 Like

But in this case rise the near plane a little bit, too. To avoid z-fighting. They depend on each other.

1 Like

I increased the far value of the in game camera in gdscript since the inspector won’t allow me more than 4000.

It’s much better now, though I still don’t understand how the far distance can be used practically, with this angle issue.

Thank you both !

It’s just a slider limit. You can type in any value.

Actually I still have the issue, because I can’t just increase the far value too much, beyond 20000 it crashes the game.

And still at this value, the world gets cut in the same manner, with the mountains disappearing at the center of the view.

I don’t know what to do about this

Why do you need such large mesh?

Crashes in what way?

When I say it crashes, I mean the it crashed during the loading of the game when the godot editor logo is displayed. It crashed silently, with no message/warnings/errors in the editor.

I am making a game where the player can navigate in a huge world. So I want the player to have a large view of the world around, made mostly of flat landscapes and mountains.

I tried both systems : one where the world is divided in chunks and they get loaded/unloaded dynamically. And another where the world map is a large mesh.

Then I found a plugin for creating and managing the world map that is very convenient for my project, so I’m currently using this: HTerrain plugin documentation

Nevertheless, I had the same problem with all the solutions above. Because it doesn’t seem to depend on how the world mesh is done but rather the camera itself.

If you have problems with the plugin you should contact the developer.

Camera far plane value is very unlikely to crash the project.

Are you using a single mesh? What’s its polycount?

Thanks, but the issue has nothing to do with the plugin. It does the same thing with a chunk based world map and a single mesh one (with no plugin)

You can reproduce the exact same issue with a very simple project, adding a large mesh instance and changing the camera far value.

You should see the same issue from the video I uploaded, which isn’t made with the plugin.

What’s a “large mesh instance”?

Can you write down the exact steps to reproduce it?

I now set the camera.far value in gdscript with

camera.far = 200000.0

The game starts and runs.

I set this same value to 300000.0 and the game crashes

Well those are not steps to reproduce it from scratch. If I set a camera far to 300000 - nothing happens.

Can you reproduce it in a fresh project?

You mean reproducing the crash or the culling ?

The crash happens when the far value is above 32700.

I am seeing if I can reproduce the crash in another empty project

When it crashes though (for a far value above 32700), I have the following output in the godot console :

ERROR: Condition “!res” is true. Returning: false
at: prepare_camera (servers/rendering/rendering_light_culler.cpp:544)

Could be a bug. Try to find a way to reproduce it in a fresh project.

1 Like

I found out that my near value was set too low compared to the far value. When it crashed at 32800.0 far value, that was for a near value of 0.001.

I think that the crash only happens when the near value of the camera is too low and the far value too high. If I set the near value to 0.05 the game doesn’t crash even with a far distance of 400000.