Search Unity

Any ideas for having a line renderer (or similar) generate specular reflections?

Discussion in 'High Definition Render Pipeline' started by dgoyette, Aug 23, 2021.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    In my game, I have something like a "laser" beam, which I've implemented as a LineRenderer. The tricky thing about these beams is that their path can bend due to strong gravitational forces acting on them:

    upload_2021-8-23_17-16-11.png

    On unfortunately thing, visually, is that the beam doesn't produce any specular reflections, the way the light sources in the scene do. (For example, you can see the purple light source below the "Rift" in this scene.)

    I was looking into ways I might add specular reflections, but so far they don't see viable.

    The first approach I took was to use Tube-shaped Area lights. That actually works really well for perfectly straight beams. But, due to the curve of the Line Renderers, I need to place on Tube light per segment of the line renderer. This is expensive, and quickly caps out the number of active lights.

    I've considered having the Line Renderer instead be a mesh with strong emission, but I don't think emission affects specular, just diffuse, so that wouldn't work anyway.

    And another option would be to use planar reflections, but I think that concept is way over budget for the kind of performance I'm looking for.

    Is there some other way to produce specular reflections from a line renderer? Or simply specular reflections from a mesh, similar to what a light produces, but following an arbitrary mesh?
     
    valarnur likes this.
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Hello !

    You are right that only direct lighting will produce specular reflections out of the box (see this answer for more detail).
    Indeed, the solution of having one area light per segment will work but it's incredibly expensive and is not really a viable solution either in your case.

    Whether your mesh is emissive or not, it won't affect the indirect specular by default and you will need something else.
    Since you already talked about Planar Reflection being too costly, Real-time reflections probe will also most probably be out of budget too.

    However, I don't see any reason why Screen Space Reflection wouldn't work in that scenario.
    It still not cheap but It should properly reflect you line renderer.
     
    valarnur and dgoyette like this.