This one node makes almost any shader faster. (Unreal Engine)

Поділитися
Вставка
  • Опубліковано 27 вер 2024
  • Many shader instructions are calculated on every pixel by default. However, we often don't need per-pixel details for every instruction.
    The Vertex Interpolator is a less known node which can improve the performance of almost any shader by forcing certain instructions to run per vertex instead. Since there will almost always be fewer vertices than pixels on a given mesh visible at any given moment, this is usually a net gain in performance.
    However, certain instructions must be performed per pixel, like most texture samples, or else a loss in visual quality will occur. Be sure to profile your shader with the complexity view-mode to ensure you are lowering the complexity.
    Shown in UE5 preview 2, but works in most versions.

КОМЕНТАРІ • 8

  • @IstyManame
    @IstyManame Рік тому +1

    I'm so glad i found your channel

  • @_Caose
    @_Caose 2 роки тому +1

    This inspired me a lot. Thanks!

  • @manafon5398
    @manafon5398 2 роки тому +8

    Be careful about comparing the colors of the shader complexity buffer, if I'm not wrong it completely ignores the cost of the vertex shader and only shows you the Pixel Shader cost.
    In other words, you could be in the Brightest Red for the Vertex and Brightest Green for the Pixel and the visualizer would show up Bright Green which would be a bit deceiving.
    Other than that the logic is sounds solid, if you have a VERY low poly model that's REALLY big (cover a lot of pixels in the screen) and you can get more or less the same details through the VS instead of the PS then it stands to reason that it would be cheaper, though I can't be sure, I have it understood that VS is less optimized than VS for most operations, something to keep in mind though.

    • @TechArtAlex
      @TechArtAlex  2 роки тому +8

      The visualizer will show a VS and PS position on the meter so it's really easy to tell if there is a big difference between them. It's quite rare for the vertex shader to be higher cost than the pixel shader anyway, but if it is, this technique may not be a good idea for that shader. But as with anything you won't know till you properly profile. The great news is it is so easy to implement that there's no harm in trying.

  • @unreolog8699
    @unreolog8699 2 роки тому +3

    Thank you for sharing. Your explanation is really good. However, can you explain the difference between the CustomizedUV input pin and the Vertex Interpolator node?

    • @TechArtAlex
      @TechArtAlex  2 роки тому +1

      The vertex interpolator is just a shortcut to customized UVs, meant to replace them and make it easier to do and understand. There's no meaningful difference that I'm aware of.

  • @robostep9829
    @robostep9829 2 роки тому +3

    Seems very helpful. I would recommend you share this somewhere else.