Emissive line decal

Hello! I am trying to achieve this effect:


I want to paint a emissive line on to any surface texture that my lightsaber touches. Any idea? I think the correct way is using a decal system.

It’s a cool effect… I’d approach it with a particle system set to emit over distance and no randomness, emit in world coordinates.

Here’s what I would try first:

  • raycast down the light saber to the wall to get a point
  • lift away from it by a small amount (half your particle radius)
  • move the particle system to the new location, which will cause emit-over distance

For handling the start and end of drawing, I’d probably try setting the particle system emit-over-distance rate multiplier to zero or to one appropriately.

1 Like

A trail renderer could do it.

Thanks guys for the quick respond. The problem with these solutions is that it does not stick to the surface. So for example if the emissive line is on a cars surface and the car moves away then the lines stays in place and is not attached to the car.

Are you making a 2D game? I only ask because the example you give is a 3D game and you’ve tagged this with “2D-Graphics” which is why it’s appearing in the 2D Product area. This should be used when using 2D features like Sprites, Sprite-Shape, Tilemap etc.

If not then it’s best not to use the 2D tags; I can remove it for you if not.

1 Like

Then you could probably add a particle system as a child, emitting in local space, to any movable thing that needs this effect on it.

Instead of a known particle system the player “has” on them, they would either add or look up the particle system on whatever they’re drawing on.

Everything else would be the same I suppose. What have you tried so far?

1 Like

And what about skinned mesh renderers? I think the only approach for that is using decals. Or is there maybe another, more performant way? because as i know decals are not very performant.