Search Unity

► Per-Vertex Ambient Occlusion and Indirect Lighting Generator ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Sep 23, 2015.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Hi,
    I've decided to release Per-Vertex Ambient Occlusion and Indirect Lighting Generator tool (included in Mesh Materializer) as a separate asset too.



    Tool comes with two Ambient Occlusion solvers: Raycast and Occlusion Render.

    Raycast solver - Calculates ambient occlusion by 'throwing' multiple rays from each vertex.
    Quality and generating speed depends on ' thrown' ray count.

    Pros:
    • Can run on any device.
    • Produces correct ambient occlusion result.
    • Multithreaded.
    Cons:
    • Ambient occlusion quality depends on ray count per vertex.
    • No environment interaction.
    • (Only on low ray count) Will produce 'artifacts' if mesh has split vertices. Can be fixed with Smoothing option, but at additional pass price.


    Occlusion Render - Calculates ambient occlusion by rendering occlusions from the position of vertex.
    Quality is smoothest(similar to infinity ray count in Raycast solver) and works faster on high poly meshes.

    Pros:
    • Produces smoothest result.
    • Has no problem with split vertices.
    • Does environment interaction (optional).
    Cons
    • Requires RenderTexture support.
    • Not multithreaded.


    Occlusion Render solver result also may be slightly overbright.


    Indirect lighting is calculated using:
    Cubemap (very fast)
    Scene skybox (requires RenderTexture support)

    Cubemap vs Scene Skybox.


    Cubemap indirect lighting is ultra fast, while Scene Skybox can be generated even from custom skybox shaders.


    Additional info:
    • Both solvers support DirtTexture.
    • Plugin works in Editor and Run-Time.
    • Can calculate Ambient Occlusion and Indirect Lighting separately.
    • Final results are saved inside mesh vertex color RGB or Alpha channels.
    • Can be combined with mesh original vertex colors.
    Editor tool creates mesh asset file, sets up ready to use prefab(with vertex color material) and spawns it in the scene.
    Run-Time API returns Color array with full Ambient Occlusion and/or Indirect Lighting info of a mesh.
    • If source gameobject has multiple mesh hierarchy - No problem - AO will be generated for all them.
    • If source gameobject has multiple mesh hierarchy - they can be combined into one mesh.


    Editor window


    BIG.jpg

    v2019.1
    • Updated for Unity 2018.3
    • Plugin can placed anywhere inside project and has no more restriction to be inside specific installation location.

    v2018.1
    • Updated for Unity 2017.4 and Unity 2018.2

    v2017.2
    • Fixed OcclusionRenderer and IndirectLighting producing 'black' results.
    • Fixed VertexColor shaders reading wrong Unity ambient color.

    v2017.1
    • Unity 2017.1 compatible

    v1.4
    • Added mesh compression option. Generated mesh file size can by smaller about x5 times.
    Mesh Asset Name format option replaced with more intuitive Skip Similar Meshes option.
    • Improved Occlusion Render solver.

    v1.3
    • Retina display support.
    • Fixed: SkinnedMesh was not recognized.

    v1.2
    • Unity 5.4 compatible
    • Improved vertex color shaders

    v1.13 - v1.14
    • Mesh combine now will ignore hidden meshes.
    • Removed Unity 4 support.

    v1.12
    • Fixed, losing some of sub-meshes when 'One Sub-Material' option is selected.
    • Fixed, losing some of sub-meshes when 'Combine Into One Mesh' is selected. Final combined mesh will have only one sub-mesh (itself).
    • Fixed original mesh vertex color blending with generated colors.
    • Inside editor generated data can only be save inside vertex RGB or Alpha channels.
    • Run-time script generator function changed. Removed 'SAVE_CHANNEL' enum option.
    • Added example scene for run-time blending mesh vertex and generated colors.

    v1.11
    • VacuumShaders assets synchronization. Required update for all VacuumShaders assets.
    • Added Vertex Color shaders: Unlit, One Directional Light, Legacy and Standard shaders.

    v1.1
    • For Occlusion Render solver Include Environment parameter is replaced with Layer Mask parameter.
    Layer mask defines scene objects that interact with Ambient Occlusion generator.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 29, 2019
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    ZJP likes this.
  3. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Good new. Waiting for. :cool:
    What about the price?
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Price: 15$



    VacuumShaders - Facebook Twitter YouTube
     
  5. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Deal ...

    Edit :
    Can you post a picture with the 'Dirt Texture Option' activate?
     
    Last edited: Sep 29, 2015
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    dirt texture.png
    Mask With Alpha - Is a dirt texture strength measured by texture alpha.



    VacuumShaders - Facebook Twitter YouTube
     
  7. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Oh sorry, my bad : i mean a result picture (statue, teapot) with a Dirt Texture activated. :oops:
    Nevermind. I've faith in your product. :p
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    ZJP likes this.
  9. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    229
    Hi,
    You're mentioning this is also included with Mesh Materializer.
    But I can not find "Occlusion Render" option in Mesh Materializer.
    Is this feature only available on this asset or an update is coming to MM with "Occlusion Render" feature?
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Occlusion Render solver will be added to Mesh Materializer in coming update.
    Raycast solver is already there.

    Edit:
    Ambient occlusion and indirect lighting generator will be the same as in Mesh Materializer.
    All features added to this plugin will be added to Mesh Materializer too.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Oct 2, 2015
  11. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
    Very nice.
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
  13. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Hurry up, price will increase on 1 of November.



    VacuumShaders - Facebook Twitter YouTube
     
  15. oceanq

    oceanq

    Joined:
    Apr 10, 2015
    Posts:
    22
    Hello, I just picked up your vertex AO baker, and have a problem. Say I have a bunch of copies of an object in the scene, like this:
    http://imgur.com/lDoA7n4

    And I bake AO on it - instead of every instance getting its own values, they all share the values of the first one:
    http://imgur.com/C4ms44T


    Which is obviously broken.

    I notice that if I combine them into a single mesh, then they work:
    http://imgur.com/HoRYCV6


    But I need them to be separate. Is this a bug? Is there a workaround?

    Thanks,
    Ocean
     
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    It is not broken ;)
    In your case you need to change Mesh Asset Name property to some with (ID).
    For example: (meshName)_(ID).

    By default it's set to (AO)_(meshName) - it means that generated meshes (not main prefab asset) will have original mesh name with AO prefix.
    If in target selection are multiple meshes with same name - each one will overwrite previous inside save folder.
    Property with (ID) prefix/suffix will prevent it. As every object in Unity has unique ID, converted meshes will have also unique names and will not overwrite each other inside save folder.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Oct 26, 2015
  17. oceanq

    oceanq

    Joined:
    Apr 10, 2015
    Posts:
    22
    That works great! Thank you, it's an excellent tool!
     
  18. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    1,195
    Looks good, +1 for runtime support for procedural stuff. What will the new price be if I may ask?
     
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Price will be changed on 1st of November with 25$.



    VacuumShaders - Facebook Twitter YouTube
     
  20. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    Deal at $15. Thanks. But $25 still a good price. :cool:
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    per-vertex-ambient-occlusion-Glass-Shutter.png

    Update v1.1 released.
    • For Occlusion Render solver Include Environment parameter is replaced with Layer Mask parameter.
    Layer mask defines scene objects that interact with Ambient Occlusion generator.




    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 2, 2015
    startleworks and theANMATOR2b like this.
  22. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    33
    Hi Arkhivrag, I noticed you use a custom shader.
    What do I have to do to still use the asset but have a different shader?
     
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Custom shader is used only by Render Occlusion solver and if you change it final AO result of course is not predictable.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 3, 2015
  24. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    33
    I don't really understand.
    What I meant to say was, can I have the standard unity shader(PBR), that uses the GI etc AND add the AO data to it, somehow? I tried using 2 materials, with PBR underneath, but the AO shader doesn't have any transparency.
    Is this even possible?
     
  25. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    OK, now I understand your question.
    All generated data is save inside mesh vertex color and to use it you need shader with vertex color support.
    Package contains only one such shader.

    To use mesh vertex color with other shaders and effects you have to manually modify them, or ask shader author (if purchased on Asset Store) to add mesh vertex color.



    VacuumShaders - Facebook Twitter YouTube
     
  26. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    And what about saving the 'AO result' as a texture?
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    It needs uv layout per-pixel AO calculation, that is not purpose of this asset.




    VacuumShaders - Facebook Twitter YouTube
     
  28. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    :(
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Update v1.11
    • VacuumShaders assets synchronization. Required update for all VacuumShaders assets.
    • Added Vertex Color shaders: Unlit, One Directional Light, Legacy and Standard shaders.




    VacuumShaders - Facebook Twitter YouTube
     
    startleworks likes this.
  30. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    Hi Davit. I have mesh Materializer and trying to just add AO to my mesh.

    But whenever I try, its always creates a faceted version in white. If I try to put the material into Default Material slot in your asset window, it then keeps the original mesh structure, but doesn't apply any AO? How do I get it to keep the original mesh and texture resolution but add AO to it.

    Using your demo scenes
     
    Last edited: Nov 26, 2015
  31. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    So you are having problems with Mesh Materializer and not with this asset.
    Then why not use Mesh Materializer forum: http://forum.unity3d.com/threads/mesh-materializer.293796/
    Anyway, faceted version will not be created unless that option is selected.
    As for AO baking make sure you are using VertexColor/Unlit shaders, that shaders display only vertex color and help you find whether generated results are satisfied or not.
    Included Vertex Color shaders support texture and mesh vertex color using simultaneously.

    P.S.
    Not David, but Davit.



    VacuumShaders - Facebook Twitter YouTube
     
  32. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    Because its related to the AO which is the functionality i am having an issue with. Seeing as this is part of MM, does it really make a difference?

    Ok so made all those changes but still not the result im looking for. It needs to be the original mesh and texture but with AO baked on top of that. The one on the bottom right is the new created mesh, it firstly has a nulled down texture and not the original and also didnt receive the AO. I made it red so it would stand out, but nothing there.

    Thanks mm ao.jpg
     
  33. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    OK, continuing discussing Mesh Materializer in Per-Vertex Ambient Occlusion forum.
    Can you generate only Ambient Occlusion to see if it works?

    Here is what I got
    Mesh_materializer.png


    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 26, 2015
  34. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    hey man no need for your sarcasm, becoming very tedious very quickly.
    Secondly thats not what ive explained twice now. The second one doesnt retain the original material, i dont want flat shaded stuff. I want my original mesh and material but with AO baked in.
     
  35. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    1. It is not sarcasm, just fact ;) forum messed up.

    2. Images I show you display data baked to vertex color, meshes there are not flat, but copy of original.

    3. As I wrote above included Vertex Color shaders support texture and mesh vertex color simultaneously.
    So when you bake AO for your mesh use any of included Vertex Color shaders. If using Unlit or One Directional Light shader check Texture using flag inside material editor.
    a1.png

    If you are using some third party or custom shader, then it must have mesh vertex color support.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 27, 2015
  36. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    Thats it, but im stil not sure how you got there. I followed all instructions and have the default shader set to vertex/unit as per screenshot. Maybe a quick video or step by step screenshots.

    You cover all other functions on your youtube channel but nothing that gets to this stage, which is a very important part of using this asset. Thanks
     
  37. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Yes, asset has improved so much comparing with the first release that tutorial videos are slightly oldish.



    VacuumShaders - Facebook Twitter YouTube
     
  38. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Have you considered adding DICE style transmission generation too? (Invert normals, bake AO, restore normals)
     
  39. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Can not find much info about 'DICE style transmission' but here is quick results of - Invert normals, bake AO, restore normals

    Left one is ambient occlusion, right one what you asked for.
    DICE_2.png
    DICE.png



    VacuumShaders - Facebook Twitter YouTube
     
  40. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
  41. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    So how did you make the blend with the original texture and AO?
     
  42. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Thanks, will check.


    Ambient Occlusion is just saved inside mesh vertex color and then inside shader it is multiplied with sampled texture.




    VacuumShaders - Facebook Twitter YouTube
     
  43. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    Please show me using screenshots, i really dont know what you are refering to. thanks
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    After baking AO use any of provided VacuumShaders/Vertex Color shaders.
    If using Unlit or One Directional Light shaders enable texture flag inside material editor.




    VacuumShaders - Facebook Twitter YouTube
     
  45. oceanq

    oceanq

    Joined:
    Apr 10, 2015
    Posts:
    22
    I've got a bunch of data packed into vertex Alpha that I want to preserve, while still baking AO into RGB. Is there any way to bake RGB without also stomping on whatever's in the Alpha channel?

    Thanks
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Update v1.12
    • Fixed, losing some of sub-meshes when 'One Sub-Material' option is selected.
    • Fixed, losing some of sub-meshes when 'Combine Into One Mesh' is selected. Final combined mesh will have only one sub-mesh (itself).
    • Fixed original mesh vertex color blending with generated colors.
    • Inside editor generated data can only be save inside vertex RGB or Alpha channels.
    • Run-time script generator function changed. Removed 'SAVE_CHANNEL' enum option.
    • Added example scene for run-time blending mesh vertex and generated colors.



    VacuumShaders - Facebook Twitter YouTube
     
  47. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Yes,
    Inside editor generated results can be combined with original mesh vertex color.

    If blending inside RGB channel:
    finalColor.rgb = vertexColor.rgb * generatedColor.rgb
    finalColor.a = vertexColor.a

    If blending inside Alpha channel:
    finalColor.rgb = vertexColor.rgb
    finalColor.a = Grayscale(generatedColor)

    Inside run-time scripts it is up to you how mesh vertex color is blend with generated data.



    VacuumShaders - Facebook Twitter YouTube
     
  48. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,184
    @Arkhivrag I'm trying to understand your plugin, is it at run-time or pre-computed (baked)?

    Also, could you tell me if it would meet my specific needs as mentioned below.

    I have a 3D FBX model of an airport that is split into 3 separate meshes inside Unity: the ceiling, the airport with all the details, and the outer wall. Due to the requirements of the project I'm working on the scene needs to be all white with Ambient Occlusion everywhere.

    I'm trying to weigh the cost of using a plugin tool vs having my artist bake the ambient occlusion and lighting into the textures of the models.

    I was wondering what are the benefits of using this tool vs having my artist do it? My artist mentioned that if they were going to bake the AO into the textures of the model, they would have to unwrap UVs on every part of the model first. Does your plugin automatically handle unwrapping UVs, or does it handle AO some other way?

    Thank you.
     
  49. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,209
    Ambient Occlusion and/or Indirect Lighting is generated per-vertex and saved inside vertex color, no UV unwrapping is required and no UV unwrapping is done.
    Plugin works both in editor (generates mesh asset with baked AO into vertex color) and in builds using run-time API.
    Note, generated AO quality depends on mesh vertex count, if models are very lowpoly then better provide custom textured AO.



    VacuumShaders - Facebook Twitter YouTube
     
    Ben-BearFish likes this.
  50. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,184
    Thanks for the info. Do you know if your tool has a demo version?