Hey everyone. So I’m having an issue with lighting from a distance. I have a lighthouse spotlight that I’ve placed in the lighthouse. I’m running into an issue where it isn’t viewable from a distance despite adjusting several settings (inverse square falloff is disabled, culling is disabled and set to an extremely low value in project settings, doesn’t matter what I set variety of distances to, intensity has been bumped up to 1 million). I’m using unreal 5, so maybe I’m missing something with lumen. The first screenshot is from the cinematic camera that will be rendered. Even when the directional light is turned off or rotated below the horizon, the spotlight is unviewable from a distance.
TLDR: Need to view spotlight from a large distance from camera.
I assume you’re using volumetric fog scattering for the effect? Volumetric fog has a limited distance.
You may be able to improve this by changing some of the cvars (r.VolumetricFog.*) but realistically you’re way better off achieving the effect some other way. There’s lots of ways to do this such as a billboard that is aligned in one axis, a conical mesh with a soft falloff in a translucent material, or a custom raymarcher.
You nailed the issue. Thank you. Performance isn’t a huge issue since my first goal is to render out a cinematic, but I have struggled with the material implementation. I couldn’t get an even falloff on both a cone and a cylinder. Could you elaborate on the billboard and raymarcher workflow? I am still learning and will attempt to look for them both on their own, but that’s how I ended up here on the volumetric lighting. Thanks again for your help.
Actually, changing the cvars didn’t work. I must be missing something else. I might have to go back and retry the mesh workflow with materials and looking into a custom raymarcher. The mesh seems more realistic, since it will be animated.
I made this with a mesh, but it uses the camera vector for falloff, so it is rather view dependent. A custom raymarcher would work, but it is by far the most complicated to set up as it requires a loop so it has to be done in a custom node in HLSL. If you want to go that route my advice would be Inigo Quilez articles and Ryan Brucks blog posts on the topic.
Ok, I tried something quick. It’s simple: just get the distance travelled through the cone by getting the distance between the entry point and exit point, conveniently similar to Inigo Quilez’s sphere density method.
The only problem is I use depth instead of world position, so it’s likely not physically correct. I’m doing this using two translucent cones, having one that doesn’t render to main pass and writes to custom depth first, then the other reads from custom depth, gets the distance between the depths, scales that by a density parameter, and uses that as the opacity. To get a falloff at the end of the cone instead of a hard cap, you would just make a mesh with a smooth cap. This lacks shadows, though, but you shouldn’t need that for a lighthouse spotlight.
Just need to figure out how to get the world position (or just distance on the ray) into a buffer instead of just depth.
You can also do this in an HLSL node; just intersect a cone and get the distance between the two intersections.
Edit: Scene depth also needs to be taken into account; this fixes the hard cutoff seen in the video when the cone intersects the ground, as well as other issues.
Thank you for this! I’m going to give this a shot. Some of this is a little complex for my current skill level, but I can figure it out. I really appreciate the response. Cheers!