UE4 Volumetric laser beams

Hi guys and girls :slight_smile:

Im finally dig in to some old idea about - how to make laser beams with volumetric effects (or maybe i should call it shadows in this case?).
I bit of problems immidiately appears. Most biggest problem is define smoke which we “scan” with laser beam plane. I guess some raymarching can work great in this case but raymarching are currently out of my skill range :unamused:
But mostly it works fine :slight_smile:

Beware of flashing light :sunglasses:


11 Likes

Nice stuff! :smiley:
I had to do kind of a similar thing in Unity recently, with HDRP. I found that using 3D Textures to get a coherent noise in every direction for the smoke is a good solution, instead of relying on the plane’s UVs. There are no 3D Textures assets supported in UE4 yet I believe, but you could probably prototype something with a Noise node in your shader (even bake that into a texture with a BP, with the 3rd dimension being encoded in a flipbook?).

I wonder how you did the shadows/occlusion tough, is this based on depth sampling or something? :slight_smile:

1 Like

Hey thanks :slight_smile:

I think vector noise can help, but not sure, and anyway vectornoise are not cheap node depend on used noise type.

I wonder how you did the shadows/occlusion tough, is this based on depth sampling or something? :slight_smile:

Yeap, sampling depth are the only way, probably. I was imaging something like kind of line tracing, checking ray collision with a geometry but again - something like that are quite difficult to me, and, probably, it can work only in screenspace.

I think we follow a similar path. My friend (Login • Instagram) and I created an AR game in Unity and I used the same song he showed me for the recap Login • Instagram. We’re planning to a physical art installation to continue the game and recently I’ve been learning a lot about lasers and UE4

1 Like

Hey :slight_smile: Yeah! That song are amazing. Groove are so tight and hypnotic.

Interesting, how you made the shadows in the laser beam? Is it some kind of custom shader or SceneCapture from a laser point?

This looks really excellent! The only practical things I would add to this are some “fresnel” like dimming when you are looking at the flat of the laser’s plane, so it’s brighter the closer to in-line with the laser the viewer is.

1 Like

Mostly done with that assets. Just need a little bit of extra work.

Here’s some nice feature: “Stationary mode”
“Statinary mode” means:
Only static objects will cast a shadows, but!.. We still can use those simple “scanning” animation. Nice, huh?! :smiley:
Ofcourse shadows will be work absolutely correctly and updated with animation aswell, but the cost will be significantly less.

In these scene i have sky and directional lights in movable mode, and 8 “stationary” lasers.
135+ FPS or ~7ms on GTX1060 in editor.

https://imgur.com/a/qRumSZ8

1 Like

Yeap, “fresnel-ish”, or, actually a camera depth fade (at least as epic call it) - implemented. So no ugly clipping or something like that :slight_smile:

In the video it was a old one “proof of concept” version without camera depth fade.

Another thing to check out is volume textures in UE4, could be something nice to add to what you’re doing. Check this: Working with Volume Textures in Unreal Engine 4 — Overdraw.xyz

2 Likes

Yeah, i implement volumetric smoke, but directly from Noise node. Its a bit pricey, but its depends on the settings and it can be relatively cheap, but anyway i think im also implement classic texture panning for “static” mode. Because If laser dont moving, its really hard to notice any difference. But when he moves, true volumetric effect starts to “shine” and make pretty huge visual impact.

Sad things is what, at least, my experiment with volume textures shows what they can work with particles, something which have even bounds like sphere, cube, etc. but if its a rectangle or non uniformly scaled triangle - where we have a problem with tiling, texture size and so on.

1 Like

Oh god, the more i think what im on the finish line to release, the more situations like - “Oh hi there! How about to fix that crap you little…!” appear.
One of those things especially pissed me off, cause its ruin all good look, but thats a thing which you can’t do without. The laser sign on the surfaces. Laser hit the surface - we see its light on the surface. So, i called it “laser sign”. Cause english not my native language (you probably clearly realize that without my notice :sweat_smile:) im still not sure what its a proper name for this.

So here some default DepthFade which im actually use pretty straingh forward manner for that laser sign:
Well… Ugly-fugly. Imaginable beam width are change drasticly on the surface. Is that what we want? No, god! Please no!

So here same DepthFade with correction. Is that worth extra ~18 instructions? I gwess so!
Well… nice and consistens size even for “hard for depthfade” situations. Is that what we want to see? Hell yeah!

Just want to show how it will looks in a orthogonal or “flat bed” laser.

Before and after on perspective laser:

And orthogonal:
https://imgur.com/a/hozu4td

Mostly just for fun, a bit of learning how to del with sequencer and video editing in blender.
https://www.youtube.com/watch?v=IqhCFvjrJ_U&feature=youtu.be

2 Likes