Camera Clipping View Distance Adjustment Per Object

JoshChristianeJoshChristiane Posts: 7Member

I have a very large scene and I have a large mesh that's quite far away which I'd like to render, the problem is I must set the viewport "View Z-Far" distance globally to past 10,000 in order to see it. I don't want to load everything that's far away, just this one single mesh. I'd prefer to keep my view distance around 2000 or less, and that just doesn't offer me enough distance to load what I intend to always be seen in-game.

How can I override the View Z-far for only one object, or perhaps write a script so that camera doesn't apply view distance to that object but just renders the entire thing ignoring the clipping distance for that sole mesh?

I don't necessarily need an answer for the viewport as that won't really matter so much in the long run, so if it's only possible for an on-camera script that is fine as well. Just looking for a simple solution.

Let me know if there are any ways you know of, so far I haven't figured out how to do it. If I figure it out I'll put the answer on the forums for others to see.

Answers

  • WolfeWolfe Posts: 7Member

    I'm still learning 3D and this solution may be too simple to be legit, but what if you simply add a fraction of the camera's transform to the far object's transform?

    For example, a parent of both the far object and camera/player could do something like this:
    $Far.transform.origin = Vector3(0,0,-75) + $Camera.transform.origin * 0.9

    The problem I see is that the far object may end up in front of "nearer" objects, but if the far object and camera's far view distance are sufficiently distant I could imagine getting away with it.

  • JoshChristianeJoshChristiane Posts: 7Member

    Thanks for the idea Wolfe, I did play around with that to unexpected results not as intended. So probably won't work for me unfortunately, but perhaps somebody else may glean a useful tidbit out of that!

  • TwistedTwiglegTwistedTwigleg Posts: 3,330Admin

    Is the object always supposed to be in the background? If so, you could try using a 3D skybox with a Viewport node, like I mentioned in this topic: How to simulate very far away objects? (camea far clipping distance)

    I think the Google drive download link still works, but if it does not, let me know and I'll PM you a link so you can download the project (assuming the 3D skybox idea will work)

  • JoshChristianeJoshChristiane Posts: 7Member

    I was actually planning to have a mountainscape/landscape around the center of the map and you should be able to go to it physically. If that doesn't work out then I'll go the skybox route, as I have considered in the past. Thank you for the response! It's a great idea.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file