Making a Cylindrical Light

For a game I’m developing, I’m intending to have a kind of light reflection mechanic. Basically, there will be lights that can be moved, and mirrors that can reflect that light. This is a mechanic, but the rendering of it is the difficult part, hence why I’m asking in this forum.

The key thing I need for this is a light that acts like a searchlight, also called a spotlight. However, in a true searchlight, all the light rays are parallel, so the emitted light forms a cylindrical beam with a consistent radius, so, the UE4 spotlight (which is conical) will not work… This photo shows an example:

Airsearchlight3kwtowerskyscrapersparkprisonskyrosesearchlight.jpg
I’ve been working on a faked light beam system using line traces and emissive decals to simulate this, and it works well, mechanically. However, there are obviously a lot of things I miss out on from UE4’s built-in lighting, since this faked light beam just adds an emissive value to surfaces (so no proper surface roughness, no use of volumetric fog, etc.).

So, what I want with this thread is a brainstorm for ideas on how to achieve this, preferably using UE4’s lighting system, but I’m open to faked alternatives if they can fulfill my needs. To summarize, what I need is a light with a 2-dimensional source (circular), which then emits all light in the same direction.

The three possibilities I’m looking at:

1. Programming a custom light shape
I have some experience with C++, but I can’t find much info on how to go about implementing custom light shapes. I get the feeling that this would be very difficult, since there’s nothing like it in the engine already. However, it would be the preferred solution since I could then use the existing lighting and shading systems. Specifically, I’d like to use volumetric fog to emphasize the light beam’s position (see the image).

2. Using existing lights
I’ve experimented a lot with the existing light shapes, and tried for example using normal spotlights with occluders, or barn door lights, and much more, but I’ve yet to find something that works satisfactorily. However, there are a lot of options altogether, so there might be some way to achieve it that I’m missing.

3. Faking the light beam
If I can find a way to simulate light relatively realistically without using the built-in lighting system, that might work. As said, I currently have a system where I am simulating a light beam with decals. I am primarily going for a fairly realistic style, so while there are some very easy ways to do this mechanic with a stylized art style (for example, a transparent cylinder mesh representing the light beam), that’s not what I’m looking for.

Any info or ideas that I can get are appreciated.

Unless you need the volumetric shape to be affected by shadows (in that something can enter the beam and cast a shadows within it) then I’d just use a mesh to represent the beam: Fog Sheet and Light Beams | Unreal Engine Documentation

So, you wrote that you have tried using normal spotlights. Are they still too conical for your taste even if you set the angle to a really small value?

What I would try is this: First I’d decide on the radius of the light shape when thrown at a surface. Let’s say your light beam has a radius of 20 cm. During Tick, I would trace from the light source to the surface it’s supposed to light up and adjust the light source angle according to the distance between light source and surface. That way, the visible shape of the light stays the same size no matter how far away the surface is. It’s still conical, but depending on the distance it might look okay enough, especially when combined with volumetric fog.

Another thing would be to go the route of transparent cylinders. They don’t have to look stylized if done right. I’d start out with a Fresnel node for the edge fade, maybe paired with a noise texture. For smooth intersections with geometry I’d plug in a Depth Fade node at the end of the opacity chain. That might be a good starting point for creating realistic light beams.

I actually need to create the exact same thing, is there a faster way we can do it now in ue 5.3 ?

1 Like