Light beams_Show LIghting

Hi all,

I wondering if UE4 has tools to do a showlighting like this :

Volumetric light isn’t possible with UE4 right?

You could make something that looks like that, using meshes to represent the volumetric lighting, but it wouldn’t be dynamic.

I ever saw that in some threads and the in the Blueprint epic’s example with the surveillance camera. The problem with this technic is, if you see the beam from outside, that’s good, but when you have a look to the point light from inside the beam, there is no light, wich is not realistic.
I someone has some ways to acheive this result?

You would just need to make sure the source object has an emissive texture so that it has a glow effect

That’s directional light only. And not physically realistic either, it’s a post process.

I’m aware, but rendering volumetric lighting realistically is insanely expensive, I’ve played with it. Here, this matinee capture is 640x480, 25% resolution scale. I’m only getting 30 FPS on a R9 280X. There’s only 1 light, and the geometry is all in shader and really simple. Anything more complex is a crawl.

Here’s how it’s done, if anyone wants to mess with it.


//TraceScene -CMOT Float 3:
float muS = 0.0;
float3 lightPos = float3( 20.0+15.0sin(t), 15.0+12.0sin(t),-20.0);
float3 lightCol = (6000.0float3( 1.0, 0.9, 0.5));
float transmittance = 1.0;
float3 scatteredLight = float3(0.0, 0.0, 0.0);
float d = 1.0;
float material = 0.0;
float3 p = float3(0.0, 0.0, 0.0);
float phfu =1.0/(4.0
float dd = 0.01;
for(int i=0; i<numIter;++i)
float3 p = rO + drD;
float mu=CustomExpression1(Parameters,p,t);
float3 S = CustomExpression0(Parameters,p,t) * mu * phfu
float3 Sint = (S - S * exp(-mu * dd)) / mu;
scatteredLight += transmittance * Sint;
transmittance = exp(-mu * dd);
d += dd;
return scatteredLight;

//EvaluateLight -CMOT Float 3:
float3 lightPos = float3( 20.0+15.0sin(t), 15.0+12.0sin(t),-20.0);
float3 lightCol = (6000.0float3( 1.0, 0.9, 0.5));
float3 L = lightPos-pos;
float distanceToL = length(L);
return lightCol * 1.0/(distanceToL

//ParticipatingMedia -CMOT Float 1:
float geoFog = clamp(clamp((sin(pos.x)+sin(pos.y)+sin(pos.z))/3,0,1)-(-pos.z/10),0,1)*10;
float constantFog = 0.041;
float muS = constantFog + geoFog;
return muS;

//VolumetricShadow -CMOT Float 1:
const float numStep = 30.0;
float shadow = 1.0;
float muS = 0.0;
float dd = length(to-from) / numStep;
for(float s=0.5; s<(numStep-0.1); s+=1.0)
float3 pos = from + (to-from)*(s/(numStep));
float mu = CustomExpression1(Parameters,pos,t);
shadow *= exp(-mu * dd);
return shadow;

A number of games have physical volumetric lighting now–Killzone Shadowfall used it everywhere, GTAV has it for both things like spot lights and a whole-environment volumetric effect. Not sure what technique is used but it works well in the games that use it. Alan Wake had it too.

The above example uses the same technique used by the Frostbite engine.

While you can get better performance by rendering volumes that aren’t so huge, performance degrades linearly with the number of lights.

@xnihil0zer0: Thanks for sharing your material! I try to rebuild it, but I get the following error, any idea?

Looks like you have a 1 as an input on all your functions, but it’s supposed to be t, as in time. And Number is supposed to be NumIter as in number of iterations.

Thanks, it works now :wink:

If you want it to work with normal geometry, you’ll want to make it translucent. Then add a distance behind translucency node, as an input to the main function. Then at the end of the main loop add:

if (d>whateveryoucalldistancebehindtranslucency)break;

Generally every AAA that’s coming out these days has Vol lighting and good real time G.I used vastly in the game world. These might be very performance hungry as we do it but if epic decide to throw some resources on them I think we will end up using vol lighting everywhere we want without big concern.