Search Unity

Unity Lightmapper free for all.

Discussion in 'Scripting' started by MEGATON, Mar 4, 2008.

  1. MEGATON

    MEGATON

    Guest

    Joined:
    Mar 3, 2008
    Posts:
    28
    Hi all that

    Everyone should know that you can't make a big scene/level by only using dynamic shadows unless you got a mega ultimate machine.
    Yes, I know Crytech, Unreal Tech and Geomerics have done some awesome coding... but their tech costs $250000

    Quake 1 engine(1996) has it
    Unreal(1996) has it
    Serious Sam engine too
    even Torque game engine has it

    I'm talking about a built-in lightmapper / lightmap-baker
    Any speed concious game developer should consider this.

    So I thought I'd make a lightmapper for Unity in the hopes that it'd send some signals here and there...
    "OTEE"
    I don't wanna wait for GFX cards w raytracer chips, it could take years still.

    I hope someone eventually might optimize this script... like, adding a super fast vector reflection math or raytracer that is just accurate enough for the purpose - speed contra precision, etc.
    If geomerics can do it real-time, that means the proper code can speed up this tool so indirect light calculations become cheaper.

    Anyways, here is the stuff.
    I attached the Unity Package at the bottom of the page.

    First up.
    Here is a lil tutorial on the use of it,:

    MEGATON
    ....

    ===============
    --
    ===============

    ===============
    --
    ===============

    ===============
    --
    ===============

    ===============
    --
    ===============

    ===============
    --
    ===============

    ===============
    --
    ===============

    ===============
    Lightmap textures must be imported to either of: ARGB32bit, RGB24bit, Alpha 8bit
    ===============

    ===============
    --
    ===============


    PRESS PLAY TO RUN LIGHTMAPPER

    .
    ENJOY
    .
     

    Attached Files:

  2. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    WOW!

    This will be very usefull for a lot of users, thank you very much.
     
  3. Alpha-Loup

    Alpha-Loup

    Joined:
    Jun 23, 2006
    Posts:
    797
    This looks awesome. Cant wait to get home to try it out. Thanks Megaton.

    Frank
     
  4. Obscurity

    Obscurity

    Joined:
    Nov 13, 2007
    Posts:
    203
    This will definitely come in handy. Maybe no more booting back to windows for a simple static lightmap tweak. Excellent!

    I too can't wait to get home and try it out.
     
  5. David-Helgason

    David-Helgason

    Moderator

    Joined:
    Mar 29, 2005
    Posts:
    1,104
    This is seriously impressive Sam! Thank you so much for donating this. Want to migrate this to the Unify Wiki?

    And you're supposed to be an artist :)

    d.
     
  6. BlueMumm

    BlueMumm

    Joined:
    Feb 7, 2008
    Posts:
    43
    Great! thanks so much good work :D
     
  7. noradninja

    noradninja

    Joined:
    Nov 12, 2007
    Posts:
    420
    If I use a higher res texture for the lightmapper material (say, 1024 or 2048), will the final lightmap output be higher detail? (Could you post a screenshot of this?) Does this technique take colored lighting into account? Is the reflected light option similar to final gather or radiosity lighting? (Screenie pls?) Does this only work with point lights or does it also work with directional and spot lighting?

    Thanks for making this, this is really great. Would be awesome to write a script or something to simplify it; I will look into it.
     
  8. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    I was working on a lightmapper using a similar technique while in copenhagen, except mine casts a ray from each texture pixel instead of casting a bunch of rays from the light. I saw this post and had to bring it out. It needed a little bit of fixing to work well and I wasn't able to figure it out before but now I know how and it works pretty well:
     

    Attached Files:

  9. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
  10. MEGATON

    MEGATON

    Guest

    Joined:
    Mar 3, 2008
    Posts:
    28
    Thanks ya'llz. :)

    With the lightmapper I won't need to bounce back and forth between external lightmapper and Unity. And having 20+ scenes with 50+ static objects per scene + lightmap-render time per object, I bought myself alotta time on this project. :twisted:

    I'm not a programmer so this lightmapper is not the mega-asskicker I had hoped it to be.

    This lightmapper will soon be eating dust from Talzors upcoming lightmapper. Its based on the same method as MegatonLightmapper. But its faster, userfriendly and mimics Unity point lights accurately. Let this be the teaser for "TALZOR'S ASSKICKING LIGHTMAPPER!"
    Better to post Talzors lightmapper on Unify Wiki instead of this one.

    I am an artist... but at night I roam the realm of ones and zeros and spread chaos.
    - or -
    A cg artist creates graphics. A cg artist + programmer creates videogames.
    :D
     
  11. MEGATON

    MEGATON

    Guest

    Joined:
    Mar 3, 2008
    Posts:
    28
    If you use a higher texture size you will need to set a higher "RaysPerDegree"
    If combining higher raycasting settings with lightbounces you should, after about 15minutes, be able to fry an egg on top of your computer. <secret feature>
    Theoretically, the end result would be a very nice looking lightmap. I haven't had the patience to check it out.
    It only works with pointlights and so far there are no plans for adding other light types.

    This is a Raytracing Radiosity Lightmapper. :idea:
     
  12. MEGATON

    MEGATON

    Guest

    Joined:
    Mar 3, 2008
    Posts:
    28
    You can definetly shave off 10%-70% of the baking time tracing from texture pixel.
    As I mentioned earlier, I'm not a programmer so I can't imagine the huge ammount of work involved. How will indirect lighting be generated?
     
  13. Talzor

    Talzor

    Joined:
    May 30, 2006
    Posts:
    197
    As I promised MEGATON I've adden a simple LightMapper to the wiki at:
    http://www.unifycommunity.com/wiki/index.php?title=LightMapper
    Hate it, love it , ignore it... The choice is yours :).

    Attached example took ~3:20 to render and could probably be a lot faster with lower settings without affecting the quality much.
     

    Attached Files:

  14. Obscurity

    Obscurity

    Joined:
    Nov 13, 2007
    Posts:
    203
    Thanks, Talzor. Nice and succinct. I look forward to using it.
     
  15. diese440

    diese440

    Joined:
    May 25, 2007
    Posts:
    105
    Megaton : Thank you so much !
    Talzor : I love it !!!! Awesome...

    Very nice job :D
     
  16. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Mine achieves bounce light by shooting a few rays from each texel and then by using a bunch of fancy image based techniques (Read: Blur the hell out of it) it makes a nice soft result. Ambient occlusion is calculated using the same rays.

    You can see some bounce light from the green light in the picture I posted before.
     
  17. reset

    reset

    Joined:
    May 22, 2009
    Posts:
    393
    Hi

    I am eager to try Talzor's lightmapper - has anyone got it to work?

    I copied his script and put it in my Editor folder - but no lightmap wizard appeared under GameObject

    thanks
     
  18. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    same as Reset... with no pictures in the first post anymore, i cant figure out how to use this script.

    any help ?

    thanks

    PARADOKS
     
  19. bitomule

    bitomule

    Joined:
    Oct 27, 2008
    Posts:
    173
    I wan´t to use this too, but how?
     
  20. Jimmy273

    Jimmy273

    Joined:
    Jan 18, 2010
    Posts:
    14
    This requires Pro, right?
     
  21. TheSturge

    TheSturge

    Joined:
    Nov 8, 2009
    Posts:
    29
    anyone know if this is just for Pro? have been trying to get it working with no luck :(
     
  22. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Has it eluded you all that this may not work in your current version of Unity because the script and thread is over 2 years old?

    Send the creator(s) a PM asking if they can help you update the script or start a new thread about the same.

    It's very annoying reading very old threads because the original posters may not even be around anymore and like some of you have noticed images etc. are missing.
     
  23. sueds

    sueds

    Joined:
    Sep 18, 2009
    Posts:
    46
    just tested it the script is working.