[rlgl] Proposed fix for default near/far clipping range #4906
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've noticed the default near and far clipping planes were recently changed, and I'd like to suggest a fix
The current range
[0.001, 10000.0]
feels excessive and hard to justifyThe near plane is too close, which can cause depth buffer precision issues and visual artifacts, while a far value of
10000.0
seems unnecessarily high for a default hereIf the intent was to increase the far plane, a more reasonable default would be
[0.05, 4000.0]
, offering a better balance between depth precision and visible rangeFor special cases,
rlSetClipPlanes
already exists to override these defaults anywayHere is a visual example using shadow mapping, where the scene depth (from the camera's point of view) was projected with a near/far range of
[0.001, 10000.0]
:simplescreenrecorder-2025-04-22_15.10.23.mp4
And here is an example with
[0.05, 4000.0]
:simplescreenrecorder-2025-04-22_15.10.48.mp4