0
\$\begingroup\$

Is it possible to force rendering of an object that's beyond the far clipping plane? For example, more realistic "space" rendering, where a large mesh such as a planet should be rendered even beyond the far clipping plane.

As a software developer in another field (but with an interest in video games!) I have only a very basic understanding of rendering engines - so please excuse if any of my assumptions in this question are wrong:

In every game I've played that includes space, usually one can tell the "trick" they're using to render large objects such as planets, is to make them smaller and move them closer to the camera such that they're close enough as to not be beyond the far clipping plane. This works kind of well, but the illusion breaks if one moves the camera left and right, and can see that the "large object" is actually much closer than the texture would have you believe.

What are the drawbacks (or maybe it's just technically infeasible?) to simply making these large objects closer to real size, placing them well beyond the far clipping plane, and forcing the rendering engine to render them no matter what? I'm aware that this could be a good candidate for just being a skybox, but what if you wanted something more complex, like the object rotating, or moving around?

As a follow-up, I'm also curious if there are any rendering engines that are designed to accommodate something like this. Technical answers, links to papers, or just plain math on the subject is greatly appreciated!

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

The clipping planes are used to scale the depth buffer. If the range the buffer has to cover is too large, you get depth-fighting where meshes can't work out which one is closer to the camera.

The only methods I'm aware of to achieve the desired effect are:

  • Do one render for distant objects, then another over the top of it for foreground.

  • Cheat... Either use billboards that are scaled to appear appropriately sized when placed closer than the far clip plan or perhaps generate a skybox on-the-fly at low frequency. Depends on your use-case

Ultimately, [excluding VR] distance in computer graphics is a fairly arbitrary concept given there's no absolute scale.

Even with VR, very distant objects will appear identical between eyes.

\$\endgroup\$
5
  • \$\begingroup\$ "Do one render for distant objects, then another over the top of it for foreground." this technique is commonly used in Source Engine games, such as to render the distant Citadel in Half Life 2. I think Kerbal Space Program uses a similar technique to render the celestial bodies with one set of clipping planes, then layer your space ship on top with a much narower set. \$\endgroup\$
    – DMGregory
    Sep 17, 2022 at 20:42
  • \$\begingroup\$ @DMGregory Yep. Particularly noticeable in de_desert for Counter-Strike: Source. I'm sure you know this, but for anyone else reading... Distant objects and the tops of palm trees 1/20 scale models outside the usual draw distance and rendered as part of the "sky" render pass. There's a "sky" camera that mirrors main camera rotation and translation but scaled down, so perspective is maintained. If you fly around with the death camera, you'll notice buildings always render in front of palm tree leaves. \$\endgroup\$
    – Basic
    Sep 17, 2022 at 21:12
  • \$\begingroup\$ Note that the 1/20 scaling is more for editing convenience - so the regular map and its sky component are similar in size, and you don't have to zoom in and out so drastically when moving between them. Floating point precision errors scale proportionate to the size of the values, so scaling everything to 1/20th scale means the errors are about 1/20th the size... or exactly as big relative to the objects you're rendering as they were before you scaled them down. So scaling down this way doesn't help retain precision, necessarily. \$\endgroup\$
    – DMGregory
    Sep 17, 2022 at 21:18
  • \$\begingroup\$ Interesting. I actually watched a video of the KSP developers talking about some of the tricks they used to develop the game and they mentioned the double camera trick too. Didn't realize the issue with the z-fighting if near and far clipping planes are too far apart either. \$\endgroup\$
    – valkmit
    Sep 17, 2022 at 21:38
  • \$\begingroup\$ @valkmit May be of interest: Logarithmic Depth Buffers and Problems of Scale [Video/Youtube] \$\endgroup\$
    – Basic
    Sep 17, 2022 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .