Advertisement
Guest User

Unity lighting

a guest
Dec 30th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. Neon Jackal: yeah, I have no idea how to do the lights either
  2. ActionMan: i can probably help you with that
  3. ActionMan: what are you using to build the map geometry? Unity, or another program?
  4. Neon Jackal: sketchup, then exporting to fbx and importing into unity
  5. ActionMan: on the fbx asset in the project, make sure that Generate Lightmap UVs is ticked. That lets you do light baking. Also tick optimize mesh while you're there, and click apply
  6. Neon Jackal: cool, done
  7. ActionMan: that's mine for reference
  8. ActionMan: http://i.imgur.com/fe1g4gs.png
  9. ActionMan: then in the hierarchy view you can add different kinds of light objects to the scene
  10. ActionMan: I started off with 3 different directional lights, rotated to face different angles, with very low intensity, just to add some subtle ambient light into the level
  11. ActionMan: http://i.imgur.com/YDNnSmQ.png
  12. ActionMan: that will ensure there's no pure black areas anywhere
  13. ActionMan: then add some point / spot lights around the place later
  14. ActionMan: that will work in game, but will tax people's GPU's running all the lighting calculations
  15. ActionMan: To bake the lighting into textures, go to Window->Lightmapping
  16. ActionMan: in that window, you can click the Object tab, then select lights in your scene to decide if they will cast shadows or not
  17. ActionMan: You can then go into the Bake tab and fiddle with quality settings (high qualty / more bounces / more rays == better quality but longer baking time)
  18. ActionMan: then click on Bake Scene and a few seconds/minutes later your scene will be using a lightmap instead of evaluting the lights every frame on the GPU
  19. Neon Jackal: ahh
  20. Neon Jackal: fancy
  21. ActionMan: which means you can use as many lights as you like and it won't affect performance
  22. ActionMan: lightmaps also let you have 'bounced' light
  23. ActionMan: so when a wall gets lit directly, it itself becomes an indirect light source
  24. ActionMan: which looks cool
  25. ActionMan: fills out your rooms with ambient light magically
  26. Neon Jackal: yeah, I tried placing area lights in places but it looked odd
  27. ActionMan: baking should fix them
  28. Neon Jackal: cool, I'll give all that a crack
  29. ActionMan: the realtime lighting often does it per-vertex, so on a low-poly mesh it can look crap
  30. ActionMan: here's my current baking settings:
  31. ActionMan: http://i.imgur.com/oDOuwKH.png
  32. ActionMan: i'm still trying to find good quality settings at the moment...
  33. Neon Jackal: ahh
  34. ActionMan: lastly, instead of painting lights, you can use emissive materials. In my map, I've made some of the lights as geometry in sketchup and then put a special material on them. In unity, find the material, and change it's shader to Self_illumin/Diffuse, and enter an emission value: http://i.imgur.com/lGg67jG.png
  35. Neon Jackal: that sounds clever
  36. ActionMan: I think for them to work well, you have to use 2 (or more) bounces in your lightbaking settings... not quite sure yet. Quite handy for making your area lights in sketchup rather than unity though.
  37. ActionMan: i might post this transcript on the forums as a crappy lighting tutorial for anyone else who's map making :)
  38. Neon Jackal: yeah, that's a good idea
  39. ...
  40. Neon Jackal: None of the Mesh Renderers or Terrains in the scene are marked as static. Only static objects will be lightmapped.
  41. ActionMan: ah i forgot that step
  42. ActionMan: shit
  43. ActionMan: you have to select the instance that you've made from the FBX file in the hierarchy view, and click the static tickbox (and then yes to propagate static to the children)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement