Make Object be rendered far away

How do i make a specific object be rendered from an infinite distance? For an example, if the rendering limit for a camera is 300, how can i make a script that makes a single object to be rendered no matter it’s distance from the camera? Is it even possible? I need to be sure that a sphere in my game is going to be always rendered and seen.

3D computer graphics operate on what’s called a “z-buffer,” which basically describes how ‘far away’ things are from the camera. That data is stored as a bunch of values (floats, I think), which have a finite size (and therefore a finite accuracy.) The z-buffer operates between the “near clip plane” and “far clip plane” of your camera. The smaller the difference between your near and far clip planes, the “more accurate” your scene is going to be rendered.

If the distance between your clip planes is too large, you’ll start seeing geometry ‘wiggle’ because the step-increments for the z-buffer are too large.

You can generally put the clip plane out to a few thousand units without too much trouble, as long as you don’t have any tiny objects close to your camera that you need to render accurately.

I made a space combat game once that required rendering both tiny fighters and huge battleships that were several kilometers away, so what I did was use two cameras, one set with clip planes from 1-500 units, and another with 500-10,000 units, and render the ‘short range’ camera ‘on top’ of the ‘long range’ camera. This works fine as long as you’re not using anything too fancy as far as post-processing effects (like toon edges or whatever).

Let me know if any of that helps. If you can give an example of the kind of game you’re trying to make I can give a more tailored suggestion. :slight_smile:

Yes, it is possible. Heres how you can do it. Set up two cameras A and B, where B is a child of A. (Note, make sure that you reset the transform of Camera B so they are looking at exactly the same location).

Camera A: near: 0.1, far: 300, clear flag: "Depth Only"
Camera B: near: 300, far: 3000, clear flag: "Skybox" or "Solid Color"

Let us assume you have an Object A that you want to view far away.

  1. Create a layer called Infinite Range
  2. Assign Object A to Infinite Range
  3. Set Camera B’s Culling Mask to Infinite Range

You should be able to see far away objects (such as mountains or whatever). Cheers!

I would do it the other way around. Set far clipping plane far away, 3000 units maybe or whatever distance you need. Then cull all the other objects at the distance you don’t want to see them. For example you don’t need to see a tiny screw from 20 meters away, but you might want to see a mountain 3 km away or a house 1 km away. I also use this to hide interiors from 50 meters away in one game, because I don’t have bigger interior areas and if I’m 50 meters away from house there is always something in between so I wouldn’t see the interior anyways. Kind of lazy mans substitute for occlusion culling in that case.

Setup is quite simple, you just need to add some layers to your objects and a little script to your camera:

To see massive objects from massive distances, just follow what Darkgate answered and set the far clipping plane on camera B to the highest number it can go 3.402823e+38, (3 followed by 38 digits) and remove the audio listener on camera B to prevent warning error on console