Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Using vertex lights with lightmapped geometry

Discussion in 'Shaders' started by Ng0ns, May 25, 2019.

  1. Ng0ns

    Ng0ns

    Joined:
    Jun 21, 2016
    Posts:
    32
    Is it possible? Didn't expect it to be a problem but from what I've read using one sorta exclude the other? I'm simply trying to add some cheap lights to enemies on mobile, but the environment is static geo with lightmaps baked.

    - Cheers.
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    339
    Sure its possible. You'll have to write a custom lighting function if you want a surface shader (the manual and built in shaders have enough examples), or a custom everything if you want a vert/frag shader.
     
    Ng0ns likes this.
  3. Ng0ns

    Ng0ns

    Joined:
    Jun 21, 2016
    Posts:
    32
    I see, well at least its possible. Will look into it :)

    Thanks for the help Brownnboot.
     
  4. Ng0ns

    Ng0ns

    Joined:
    Jun 21, 2016
    Posts:
    32
    Apologize, but I'm still stuck on this after countless of hours trying. I've been looking at the frag shader "Vertex lit shader" in the asset store https://www.assetstore.unity3d.com/en/#!/content/75977, trying to make it work in my surface shader without any luck.

    I've also been trying to implement the different custom lighting functions described in unity's documentation. They work but the second I bake lightmaps realtime lights go out the window.

    I'm kinda surprised so little I've been able to find on the subject. Would've assumed lots of people required vertex lights for explosions in mobile games while also having baked geo., or am I just looking at this the completely wrong way?

    Cheers
     
  5. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    339
    If you don't need something fancy just use the Standard Shader it will just work. If you need something custom you'll have to look at the GI functions in the built in shader cgincs and handle all the combinations of features you care about.
     
    Ng0ns likes this.
  6. Ng0ns

    Ng0ns

    Joined:
    Jun 21, 2016
    Posts:
    32
    Thanks for the reply Brownnboot.
    The issue is that I'm using different custom shaders for vertex blending, snow etc., so using the standard won't do. That said, I'll have another round with the GI lighting functions and see if they're softening up.

    Thanks man.