Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Avoiding extraneous point lights in Vertex Lit shaders?

Discussion in 'Shaders' started by JJC1138, Jan 25, 2013.

  1. JJC1138

    JJC1138

    Joined:
    Feb 23, 2012
    Posts:
    89
    Hello.

    In my game I'm using the Vertex Lit rendering path on mobile platforms, and my scenes are lit by one point light. I'm targeting ES 2.0+ hardware. I noticed when using the Xcode frame capture feature that the vertex shaders that are generated for this path support four point lights. I only need one so that seems like a waste of GPU. Is there a way of inducing ShaderLab to support fewer point lights in the Vertex Lit path?
     
  2. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    If you switch to the Forward Rendering Path and use the options novertexlights and noforwardadd, and implement your own vertex lighting in the vertex shader you might get what you want.

    That being said, if you really want to get best performance on OpenGL ES 2.x hardware, you probably should write a GLSL shader and optimize it.
     
  3. JJC1138

    JJC1138

    Joined:
    Feb 23, 2012
    Posts:
    89
    Ah, I did try the Forward path with lots of options to simplify the shaders but didn't consider actually just writing my own shader. I think that might be the best solution. Thanks for the tip.