Inverse Foliage Culling?

Is there a way to cull foliage based on distance to the camera, but starting close to the camera and extending away?

My scene consists of a desert like landscape full of foliage. I am using a Post Process Material with an editable Sphere Mask to switch between it’s natural/realistic materials and an overall stylized/outlined material. The problem is that the foliage makes the stylized version look too busy because the outlines are all over the foliage as well as the other meshes on the landscape. Is there a way to cull the foliage at the same time and scale as the Sphere Mask in the post process material so that it all happens at the same time?

  • I should mention that the effect
    starts at the camera and extends
    outward as I increase the radius of
    the Spherical Mask.

  • I should also say that I first tried
    to fade the material opacity based on
    distance to camera but the post
    process material saw right through my
    trick and outlined the invisible

I think rather than a direct inverse solution, you’d likely need a torus culling shape (or just two spheres). You want the trees close to you to not render, as well as the ones in the distance, otherwise, you’ll end up with performance issues. Not at all sure how to do this, but just thought I’d point out a potential flaw with an exact inverse.
I know it’s possible to get a reference to a foliage actor and convert it into a static mesh for games where you’re cutting down/harvesting trees. Maybe start by looking at those tutorials and if you can somehow grab the foliage actors that are within a small radius of the player, convert them to static meshes, hide those static meshes while they’re inside the radius, and then unhide them and turn them back into foliage actors once they’re outside the radius, that might be a viable solution.

I’m not too concerned with the performance aspect because this scene is only intended to be used as a cinematic video export and not a game. Still, you are probably correct, a direct inverse of the native culling system may not be what I am looking for. I do not mind if the regular culling does what it is supposed to. I think I really just want add to its function by having a secondary effect of culling based on a editable radius around the camera.

Regarding the conversion technique, I can see how that might work with a small area. Do you think this would work using a very large area with so many thousands of foliage instances? I imagine that would be pretty heavy.

Yeah, it might be expensive to do this in a large radius. I wouldn’t know though because I’ve never tried it. Was just trying to brainstorm a solution for you. It’s a tough challenge for sure. Maybe there’s a way to simply hide the foliage in a radius without having to convert to static meshes and back? Using a material to hide them won’t work as you discovered, but actually turning off their visibility would.