Search Unity

POLM - GPU Lightmapper - NLM denoising test !

Discussion in 'Assets and Asset Store' started by Vagabond_, Feb 5, 2016.

  1. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    just a note... in 5.5 there are couple of errors which are already fixed but are not present in 5.4.X
    An update will be published as soon as i am done with the few new features i am implementing...
    I could provide the fix for 5.5 if needed on request... !
     
  2. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    just a quick preview on new feature in POLM v0.93b - Baking AO data into lightmaps...!
    NOTE : this is not yet available. It needs some more work before release...

     
  3. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hi, just bought your asset and I tested it on 2 models and getting weird results, attached screens: bake bug.PNG bake bug 1.PNG
     
  4. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, what is the probability of both meshes having messed up uvs...
    Would you like to contact me by the email provided in the POLM's Asset Store page with more info on POLM setup and eventually send me these two meshes! I would like to test them !
     
  5. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Thing is, those are models I either got from asset store: https://www.assetstore.unity3d.com/en/#!/content/31958
    or provided by artist with no means to update uvs (especially that i am programmer and there is no info in the docs about uv requirements).

    Not sure what you mean by "messed up uvs" as main texture obviously looks right. I also noticed that you said the same about standard Unity cube, I think that this means that a change in POLM should be considered for wider adoption.

    I'll gladly help, tell me what else you need, I could even share my screen in Skype if you'd like. PM me

     
  6. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Frendly bump.
    Thanks for this update. Works well on 5.5. :cool:
     
  7. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    As of dealing with any lightmapper, no object could be baked if no valid uvs are provided... this is just how any lightmapping tool is working !

    This means that the uvs are not well laid out in the 3d modelling software when the model is created...

    The Unity cube couldn't work because all the 6 uv faces are on top of each other and the model is provided by Unity, so this is nothing to do with POLM. The Unity cube could be baked with the Unity's lightmapper because they do some magic in the background to repack objects and apply new uv coordinates to the objects !

    The good news is that i am working on POLM. Already having a texture packing tool to be used with baking a group of objects into a texture atlas (like Unity's Lightmapper does) and i am re designing the tool's code (probably will create an API as well). So please be patient as i am working on a small game project which is with higher priority to me - thanks!

    NOTE: this was some general stuff and POLM is still in beta which means many things could change and bugs could appear ! As with any lightmapper you will have artifacts (mostly visible seams) which can't be avoided at 100%

    About the models issues:

    1. The model on the first picture looks to me like two or more separated meshes (objects):
    - If this is a single object, than it probably has overlapped uvs or uvs outside of the 0-1 space. Having the diffuse texture looking good doesn't mean the object's uvs are well done for lightmapping.
    - in other case, If there are two or more objects forming the table, and they are all using the same material - note that this is not allowed. As POLM calculates data per object, every object needs a separate material and if they are using a common material and if you have selected 3 objects to bake, every next object will replace the texture in the material !

    2. I notice the black dots on the second model. I will try to find the reason for that as i didn't get any artifacts like these until now.

    So in lightmapping you have to be sure that your models are having proper uvs.

    If you have more question let me know - if possible use the email provided in the POLM asset store page!

    Thanks!
     
  8. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Thanks. Glad to hear and will do my best to make an update with some new features as soon as possible :)
     
  9. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Vagabond_ likes this.
  10. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Oh, that's so kind :)
    Thank you. I appreciate it !
    Nice images. The robot looks much more detailed :)
     
    ZJP likes this.
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys, for those of you who are getting black dots in the AO texture, there is what you have to do to fix it. This is already fixed in v0.93 beta, but until it is released you might prefer to fix it yourself.

    So in order to fix the black dots open the file POLMCSDX.compute and at line 282 there is a line like this one :
    float3 rayO = lumels[lumelID].position + (rayD * 0.00001); - you have to increase the value a tiny bit.
    - just go ahead and change the value from 0.00001 to 0.00005 or better to 0.0001

    You might want to do the same at line 347 in the BakeAOPV function.

    Best Regards !
     
    ZJP likes this.
  12. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi to all, just to let you know, today i am uploading a new small patch version of POLM - 0.92.2b which fixes a couple of bugs one of them found by a user... Some lowpoly objects were not baked properly and for some reason on some models the UV2 wasn't baked properly as well - so these are fixed. Some other things that were added are some checks for missing data and notes for the baking progress. If you are using the standard shader you are going to be able to use the AmbientOcclusion slot to visualize the texture by choice now or to load the texture into the Detail Map slot of the shader which will automatically choose the uv set depending on what uv channel you have chosen in POLM !

    NOTE : as this is a small patch to the current available version only, the next version which will be like 0.93.0b or 0.95.0b will be totally rewritten. I am currently working on that in any free time i am having... The POLM tool should be wrapped in an API ans self namespace "POLM", and should consist of a few tools:

    1: tool for baking AO data to vertex colors
    2: tool for baking AO data per object - like the current version does
    3: tool for baking a group of objects into Atlas texture - you will be able to bake many groups
    4: NOTE : this is not yet decided - but there might be a tool for baking the whole scene - like Unity's Lightmapper (this is to be decided probably before the next big update as i am already able to bake AO to lightmaps and use them at run time)

    P.S. - a small announcement on a feature i am working on : a Diffuse GI might come as well in the next version.
    NOTE : this is still experimental and is a subject of change at any time - might be or not included in the next major update... and there is no any ETA yet...


     
    ZJP likes this.
  13. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    As i was doing some work on POLM today i got like pretty good results on the path tracing part...

    NOTE: this is rendering to screen texture and not to a lightmap yet. Currently supports color bleeding using diffuse bounce light and a single directional light with hard shadows.

     
  14. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Looking promising!
    Since it is coming with full source, I was wondering if POLM can work in runtime? even it needs a small modification, is it possible to bake AO (hopefully GI later on) to VC and texture at runtime?
    Thanks
     
  15. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I am wrapping POLM into an API. So i'm pretty sure you will be able to use it in editor as well at runtime (for baking AO and GI). I guess GI could come for vertex colors as well!
     
  16. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, the new patch version v0.92.2b has just been published...

    * Bug fixes
    - A couple of issues are fixed based on which some objects were not baked properly.

    * Improvements
    - Baking stages are displayed now in the progress bar.
    - A new options is added which allows you to chose to load or not the texture in some of the standard shader's slots (AO or Detail Map) if the one is used by objects material.
    - A new model is added showing how a model should look if proper uvs are provided
     
  17. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Great work so far. You said this would have an API. I would like to automate it on a server to add to our wrapping asset bundles pipeline. Be nice to let our users add AO in runtime as well.
     
  18. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi ippdev, Thank You for your feedback !
    There will be methods in the API that allow this... !
     
  19. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Sold.
     
  20. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys,

    a small patch (v0.92.3b) was just uploaded for review.

    * The precomputing algorithm was changed with a new one which uses CPU rasterization techinque and it is much faster.

    The patch should be available in a few days...

    Cheers!
     
    ZJP likes this.
  21. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    The patch 0.92.3b is out now:

    The precompute object step is about 4-5 time faster now and almost not noticeable.
    Next step is to provide API.

    Cheers.
     
    ZJP likes this.
  22. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Great. I would like to make it so that if the user moves a chair or other object in an archviz scene that the collision detection on move triggers a rebake of the chair and floor, for example. Your framework was pretty fast prior. It must be smokin' now:)
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    https://docs.unity3d.com/ScriptReference/Transform-hasChanged.html
     
  24. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
  25. Mattboy

    Mattboy

    Joined:
    Sep 8, 2013
    Posts:
    2
    @slimshader You need non overlapping UVs for lightmapping to work. The good news is that you can have Unity create these in the import settings:
    upload_2017-5-5_22-41-24.png

    Then you just need to use UV2 when baking your AO with POLM. You'll need a shader that uses UV2 for the ambient component as well.
     
    Vagabond_ likes this.
  26. Mattboy

    Mattboy

    Joined:
    Sep 8, 2013
    Posts:
    2
    Hey @Vagabond_ thanks for the great tool! I noticed some seams when baking and was wondering if you could add an option to chose the background color when making the textures. In the baked texture here the black background will sometimes bleed into the texture. Allowing me to set that to a less obvious shade would be really helpful. Thanks!
    upload_2017-5-5_22-52-38.png
     
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi Mattboy,

    yes sadly as we all know, seems is a common problem with lightmapping

    Sure this could be added with no problems. Let me know if you have some more suggestions !
    I could make new small patch with a few more improvements like dilating and smoothing on the GPU. This will speed up the post processing step as well.

    Adding patch will be better instead of waiting because i am doing some work on the next major version mostly, which will be able to bake GI as well. Having some working variant but will take some time before release.

    Cheers !
     
  28. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I am reassembling meshes that come from another application into Unity meshes in Editor scripts. In that pipeline which is to be automated on a cloud I would like to implement your toolset for AO baking. You said earlier in the thread you were working on atlasing and color bleeding as well as an API which will also allow for runtime usage. How far is this along the road to completion?
     
  29. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi ippdev,

    well i am having most of the functionality done, but still designing the API structure...
    Having a some working variant of the GI as well - however GI might not be included in the first release as it needs some improvements !
    As i am working mainly on a project, i couldn't spend а whole working day on POLM, but i guess if no some big road blocks are hit i could release a version in like 2 - 6 weeks which will be further worked out based on feedback !
     
  30. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey guys, this is a quick video showing current state of the global illumination baking process on the GPU...
    Still work in progress, as have to find a way to optimize some things !
    There will be separate options for baking AO and GI...

     
    ZJP likes this.
  31. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey guys i just did some work on the next patch of POLM tool (v0.92.4) and will upload it tonight to the store.

    So what has been done in this patch:

    1. A color field to use as a texture background has been added (this is a requested feature) !
    2. The uv set is now displayed as a grid ( like in the video if the previous post ). It is much easier now to choose a uvs set
    3. Added a couple of buttons ( to set all object in the list as blockers or as "To Bake" objects) This is useful in case you want to add like 10 blockers and only one object to bake. This way you can toggle all objects as blockers and just click once to toggle the object you want to bake instead of going though all objects and set them one by one as blockers
    4. Added "Clear List" button
    5. The initial values of Radius AO Power and clean up values has been altered
    6. The Dilate and Blur functions are moved to the GPU and you will not even notice the PostProcessing now
    7. The most important improvement is x2 boost in baking speed now :)


    You should be able to get the update in the next few working days!
     
    ZJP likes this.
  32. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    The new version has been uploaded for review.
    Here is a video showing a bake of 1K texture in 3-4 seconds in total :)

     
    ZJP and gurayg like this.
  33. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    POLM v0.92.4b is now available !
     
  34. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Hey, so I'm not the best when it comes to graphic related things so forgive me if this sounds stupid. But is this meant to be a replacement for Unity's built in lightmapper? Since I'm having so much issues with it an alternative would be interesting to look into.
     
  35. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, well that's the idea - to implement alternative Lightmapper which runs on the GPU... Currently it bakes only Ambient Occlusion per object though. I am having the GI implemented partially but it is not yet available... Keep an eye on POLM. Hopefully GI will come in some of the next updates !

    Cheers !
     
  36. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey guys,

    Unfortunately this is not mentioned in the docs or in the version history section, but there is a new small tool added to the package which you can use to blend (Multiply) two textures .
    If the textures have different resolutions you will have an option to match one of the resolutions and then you will be able to save the new texture. Internally copies of the source textures are generated in order to preserve their resolutions.
    You can use it to blend the AO texture with a diffuse one... Open it from the Tools menu.

    In the next update, some more blend options to choose from might be added !

    Here how it looks. Just drag and drop both textures to the slots and blend/save the new one...
    The new texture is currently saved to the "Assets" folder !

    TexturesBlend.png

    Cheers !
     
    Last edited: Jun 7, 2017
  37. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Nice. Remenber this (?) :
     
    Vagabond_ likes this.
  38. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yes, i remembered and i just added this at the last moment just before update :)
     
    ZJP likes this.
  39. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    That GI update looks pretty sweet. I wonder if the AO baking works for Alpha's on trees.
    Btw I am pretty proud of how far your asset has come along, congratulations!

    I noticed your asset isn't made for search results, why don't you rename the asset to Per Object Lightmap Baker and just remove the "Polm" part?
     
  40. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, thanks, glad about that :) - i guess you are aware it is in development and not yet available !?

    That's not yet implemented but a new structure to hold per object data was created already with references to textures, object colors etc. and alphas and transparency should be supported at some point.

    Isn't it ? As soon as i type "AO" or "lightmap" or even "Per Object" as key words it shows up in the first page !
    What keywords you are using for searching?

    Thanks for suggestion!
    I may consider renaming it !

    Best Regards!
     
  41. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Haha yes I am aware it's not ready :).

    It does come up but for me this is what I see.
    CropperCapture[1].png CropperCapture[2].png

    Your plugin is better than VertexDirt but isn't ranked very high for some reason.
    My paranoid mind thinks part of the reason might be because your title is using the space you get by using the word "POML -" instead of straight up saying "Per Pixel Lightmap Baker" etc.

    I remember when I first found the plugin I had to dig pretty deep in the asset store to find it.

    If you do plan on renaming it I think Per Pixel Lightmap Baker would be a great name. I was always looking for per pixel lightmappers but settled with per vertex solutions and it didn't meet my needs. If people become aware that there really is a good per pixel solution then who knows.

    I did really like the old spider icon for the plugin though haha.
     
    Last edited: Jun 13, 2017
  42. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Oh, i understand now...

    You really can not tell what is this plugin all about if you just look at the name and the icon...
    I have to agree with that :) - i will really think about fixing that ! New name and some new icons... !

    Some name like you have suggested or may be just something like GPU Lightmapping or Lightmapping on the GPU !
    And will get back the spider icon :)

    Thanks again - i appreciate your opinion !
     
    SilverStorm likes this.
  43. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Yes GPU Lightmapping sounds great too!
    You're welcome, glad to share it!
     
    Vagabond_ likes this.
  44. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys just to share how the work on the GI part is going !

    NOT YET
    available!

    All data needed for GI like main color, emission color, main diffuse texture and emission texture is now collected and prepared to upload to the GPU. Currently only colors are taken into account without the textures.

    _MainColor and _EmissionColor properties from any shader which uses them will be supported
    _MainTex and _EmissionMap textures should be implemented hopefully soon.

    POLM_GI.png
     
    RecursiveRuby likes this.
  45. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    I was wondering why does that monkey above show up as faceted rather than smooth? It's great that it's a low poly model but shouldn't it not look so hard edged after a bake?

    Btw nice progress!
     
  46. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Currently, model normals are just calculated based on triangle surfaces and not using interpolated vertex normals... I did that while developing for a reason and should be changed to using vertex normals and eventually give an option to turn it off...

    Thanks :)
     
  47. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys,

    i just wanted to show the new improvements in POLM v 0.96.1 Beta ( STILL WIP AND NOT YET AVAILABLE ! )



    The video shows rendering Global Illumination on the GPU with support for main and emissive color and main texture. Emissive texture is supported as well. A single directional light to act as a sun light is supported and emissive objects to act like emissive lights... Importance sampling is not yet implemented in any form.

    Still have some things to improve before release the update !

    P.S. the demo renders the screen to Render Texture as it is easier to implement and see the result from all new features. The Lightmapping should be added easily when the GI part is ready !
     
    Last edited: Jul 6, 2017
    SilverStorm likes this.
  48. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    F*ck.....that looks amazing! Probably the best baker I ever seen!
     
  49. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi glad you like it :) but this is currently rendering the screen ( what actually the camera sees )...

    The baking kernel will be ready soon as well... !
     
  50. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Still looks pretty amazing though, much better than any other competitor I seen so far and it's actually usable.
     
    Vagabond_ likes this.