Home Unity

Lightmapping + dynamic lights

Ged
interpolator
Offline / Send Message
Ged interpolator
So who here has attempted to use vertex dynamic lights and lightmaps in unity? Ive tried and failed, unity seems to turn off the possibility of vertex based dynamic lighting when you lightmap your level. The only solution I found is to bake your level elsewhere rather than in unity but thats far from ideal. Has anyone found a way to make this work or created a shader that makes it possible? Im working on mobile games so this kind of tech would do wonders for me.

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    I'm doing this, in Unity Pro. Lightmap is added automatically to all Unity shaders, so no need for something special. Just have to make sure the light Cullmode is setup properly, so it affects the lightmapped meshes. You might also want to set those lights to Realtime Only, so they don't get added to the bake.
  • Ged
    Options
    Offline / Send Message
    Ged interpolator
    I'm doing this, in Unity Pro. Lightmap is added automatically to all Unity shaders, so no need for something special. Just have to make sure the light Cullmode is setup properly, so it affects the lightmapped meshes. You might also want to set those lights to Realtime Only, so they don't get added to the bake.

    Im not sure I understand what you mean, heres a screenshot of what Im doing. Im trying to add vertex(not important) point lights eg explosion effects lights to an already lightmapped scene. As you can see in the screenshot the light is not effecting any of the nearby surfaces. I know it will look a little wierd if shadows get brightened but I dont mind too much as its just to make dynamic lights look more awesome.
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    Culling mask. It's not lighting anything, because it's not set to light anything. Set it to something that is the layer of something nearby.

    Also if you want explosions to look a bit better, mess with halos and flares and what not. Usual lens flare texture probably won't work though.
  • Ged
    Options
    Offline / Send Message
    Ged interpolator
    Brendan wrote: »
    Culling mask. It's not lighting anything, because it's not set to light anything. Set it to something that is the layer of something nearby.

    Also if you want explosions to look a bit better, mess with halos and flares and what not. Usual lens flare texture probably won't work though.

    Ive tried putting on culling masks, it shouldnt have been set to nothing in that screenshot, its usually on default. Sorry heres another screen to show what I mean, I want the light to still effect the lighting of the meshes even when set to "render mode: not important" as that is vertex lighting and ideal for mobile devices.
  • Brendan
    Options
    Offline / Send Message
    Brendan polycounter lvl 8
    Ah, I think you've maybe hit your limit of lights, and/or somehow vertex lighting and SH is just being ignored.

    Somewhere in quality settings or render settings should be a light limit, of course this only applies if you're using forward rendering. Are you messing with shader models or anything as well?
  • Ged
    Options
    Offline / Send Message
    Ged interpolator
    No sorry there arent any extra lights or settings wrong, I saw this on the unity forums:

    "Yeah, the limitation Ethan talked about only affects VertexLit shaders. A vertex lit object, once lightmapped, does not receive any realtime lighting. We kind of chose this by design; using vertex lit almost always means "I want to run this as fast as possible" that's why we opted for no lighting once it's lightmapped.

    Per-pixel lit shaders, once lightmapped, are affected by non-lightmapped lights. "

    its on this page http://forum.unity3d.com/threads/104328-Vertexlit-gone-after-lightmapping

    at the bottom of the page someone suggests an interesting vertex lit shader as a possible workaround.
  • Ged
    Options
    Offline / Send Message
    Ged interpolator
    so basically, just to conclude this, it seems its just not possible to use vertex lit materials and vertex lights and lightmaps all at once in unity. Unless you have the know how to make some bespoke vertex lit lightmap shader that accepts vertex lighting?
  • Goeddy
    Options
    Offline / Send Message
    Goeddy greentooth
    now this is crap, i have been having the same issue with the project im working on currently :<
Sign In or Register to comment.