Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

► 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,168
    No it has not.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 12, 2016
  2. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    215
    Hallo,
    I have a small problem with the Generator, as you can see in my (generated) meshes not everything gets occluded correctly (see left upper side and right bottom side):



    This is (probably) because my geometry is generated out of several chunks, as you can see here:


    (The scene actually contains 5 meshes.)

    Is this behavior to be expected, or a bug?

    Regards,
    ratking
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Package contains two solvers for Ambient Occlusion calculation:
    1. Raycast solver - works only with selected(one) mesh and can not interact with other meshes in the scene.
    2. Occlusion Render - Can interact with all meshes in the scene (controlled by Layer Mask parameter).

    Which solver are you using?



    VacuumShaders - Facebook Twitter YouTube
     
  4. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    215
    Ah I see. I use Raycast, because it looks ...not so good with Occlusion Render. :-/

     
  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Solvers use different algorithms and final result may be different (especially with such low-poly meshes).
    If Raycast solver produces 'better' result use it instead. If several meshes must be included in AO calculation, first group gameobjects in hierarchy by putting all of them under one parent transform and then select that 'parent' as source object and generate AO with Combine Into One Mesh option enabled.



    VacuumShaders - Facebook Twitter YouTube
     
  6. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    215
    I'd like to not combine the meshes, because I separated them in the first place. I guess I need to find another solution then.
     
  7. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    968
    I could have overlooked this in the description, but is or will there be support for WebGL? Thanks.
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    It works with WebGL, just do not forget to include Per-Vertex Ambient Occlusion shader into Always Include Shaders array (Main Menu -> Edit -> Project Settings -> Graphics)



    VacuumShaders - Facebook Twitter YouTube
     
  9. WestHill

    WestHill

    Joined:
    Oct 29, 2012
    Posts:
    129
    Hi

    I have tried to the FBX file output from Blender.
    But it has gotten to the warning.

    "Source object 'model_name' has no mesh data."

    Do this tool can not be used in the FBX file?
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Supports all type of meshes. Seems you are doing something wrong. Can you show screenshot?



    VacuumShaders - Facebook Twitter YouTube
     
  11. WestHill

    WestHill

    Joined:
    Oct 29, 2012
    Posts:
    129
    ok, I've taken the gif video.

     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Add mesh to the scene (Hierarchy window) and drag it from there.



    VacuumShaders - Facebook Twitter YouTube
     
  13. WestHill

    WestHill

    Joined:
    Oct 29, 2012
    Posts:
    129
    I tried also it. It was the same result.
    If I send a model to you, would you check it?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Sure.



    VacuumShaders - Facebook Twitter YouTube
     
  15. WestHill

    WestHill

    Joined:
    Oct 29, 2012
    Posts:
    129
  16. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    v1.4 released
    • 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.
    improved_occlusion_renderer.png



    VacuumShaders - Facebook Twitter YouTube
     
  17. JonasPersson

    JonasPersson

    Joined:
    Aug 14, 2016
    Posts:
    65
    Hi!
    I have a large outdoor environment with a lots of objects. Can you use this tool to generate vertex ao on the ground (wich is a model not terrain) directly in the scene, taking all the objects in the scene in consideration when calculating?
     
  18. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Yes, it can. But quality of baked AO depends on mesh vertex count.
    AO is generated per-vertex and saved inside mesh vertex color.
    If ground plane is a simple mesh with just a few vertices AO result may even not be visible.



    VacuumShaders - Facebook Twitter YouTube
     
  19. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    Quick question. Everything is working well in the editor, but once I build my game, the One Directional Light shader doesn't seem to work.

    In the logs, I see the following errors:
    WARNING: Shader Unsupported: 'Hidden/VacuumShaders/Vertex Color/Vertex Lit/Opaque' - Pass '' has no vertex shader
    WARNING: Shader Unsupported: 'Hidden/VacuumShaders/Vertex Color/Vertex Lit/Opaque' - Setting to default shader.

    Suggestions on what I should do to solve this problem?
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Seems Unity shader compilation bug, or something else.
    Found plenty of them:
    http://answers.unity3d.com/questions/1071198/please-help-me-resolve-these-errors-related-to-sha.html
    https://forum.unity3d.com/threads/unsupported-shader-errors-in-chrome-and-firefox.351915/

    At my side there is no compilation problems.



    VacuumShaders - Facebook Twitter YouTube
     
  21. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    Thanks Arkhivrag. My build compiles fine, the issue arises when running the executable. I'm getting the same problem in a newly created Unity project, version 5.4.1f1 with nothing besides your tool and a couple test models. What version of Unity are you running it against? Perhaps there is a versioning issue. If all else fails, I suppose I can reinstall Unity and see if that fixes anything.
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Using latest Unity 5.3.x and 5.4.x versions.
    I tend to think it is hardware or driver issue. You can try compiling shader inside editor and make sure it has no bug.



    VacuumShaders - Facebook Twitter YouTube
     
  23. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    349
    I am getting this error:

    Shader error in 'VacuumShaders/Vertex Color/Unlit': undeclared identifier 'unity_ObjectToWorld' at Assets/VacuumShaders/Vertex Color Shaders/Shaders/Unlit/../cginc/VertexColor_Unlit.cginc(103) (on glcore)
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    You are using version for Unity 5.4
    Download version for Unity 5.3 using Unity 5.3 editor.

    1) Remove asset from the project.
    2) Clean Asset Store cache:
    PC - C:\Users\[Your Profile Name]\AppData\Roaming\Unity\Asset Store
    MAC - "~/Library/Unity/Asset\ Store".
    3) Now, download package from the Asset Store.



    VacuumShaders - Facebook Twitter YouTube
     
  25. Trinary

    Trinary

    Joined:
    Jul 26, 2013
    Posts:
    349
    Ok, thanks. I'll try that.
     
  26. blamejane

    blamejane

    Joined:
    Jul 8, 2013
    Posts:
    214
    I'm hoping to purchase this asset to use for my project. I have a project with a room full of tools (table saw, band saw, work bench, shaper, jointer, dust collector, etc) and I want them to have the clay look of ambient occlusion. If the focus in the scene happens to be on one of the tools, then the dirt pass will be switched to full color material for that tool. In the middle of the room/workshop is a chair with the amazing wireframe shader (awesome), and hopefully these will play nice together.

    Platform is iOS and hopefully Android.

    My question is do I gain any benefit from using this AO asset in Unity vs rending a dirt pass in my 3D modeling app (modo) and using the saved texture for the ao in Unity? Keep in mind I will have diffuse textures for the tools to render when in focused mode.

    I was hoping performance-wise it would make sense to use this asset rather than having two textures for each asset. What do you think?

    Thanks for awesome support!
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Of course, generating custom AO map inside 3D modeling will have better visual result.
    This tool generates AO per-vertex. And it's baked quality (saved inside vertex color) depends on mesh vertex count.



    VacuumShaders - Facebook Twitter YouTube
     
    buttmatrix likes this.
  28. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    368
    Does this work on a multi model scene? Does it work for inside architecture (like a living room), or even a large outdoor forest?
     
  29. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Yes.



    VacuumShaders - Facebook Twitter YouTube
     
  30. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    837
    Hello!
    I am trying to use the editor tool with 2017.1.0f3, but no matter what source object I choose, nothing happens and I get "Generating failed :( Object reference not set to an instance of an object" error message.
    The runtime demos work just fine.
     
  31. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    You are using tool for Unity 5.4 inside Unity 2017.1
    Remove plugin from the project, clear Asset Store cache folder and download fresh version from the store.




    VacuumShaders - Facebook Twitter YouTube
     
  32. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    837
    Thank you for swift response, I will try this.
     
  33. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    hi,@Arkhivrag ,I want to use your plugin for my runtime project
    but here are some confusing
    1:the performance is very slowly !!!compare with POLM
    2:are there some asynchronous generate funcition? because use these code below



    mesh.colors = Generator.Generate(gameObject, ambientOcclusion, indirectLighting,OnGenProgress);
    GetComponent<MeshFilter>().mesh = mesh;


    private void OnGenProgress(string _name, float _value)
    {

    Debug.Log(_name+""+ _value);
    }

    because you use main tread,we can't trace the progress while generatING AO,the whole project was freezing.。。
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Plugin uses Unity API for generating AO and uses main thread. No asynchronous methods available.
    AO generating speed depends on 1) Mesh vertex count 2) Solver type and their options.



    VacuumShaders - Facebook Twitter YouTube
     
  35. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    HI,ark,here I compare with some other plugins at assets store.
    upload_2017-10-9_21-59-46.png
    left POLM right Per-vertex

    it's seem per-vertex have no shadow
    upload_2017-10-9_22-1-7.png

    this is per-vertex detail without shadow

    upload_2017-10-9_22-7-17.png

    here is other v-ray detail



    upload_2017-10-9_22-9-12.png upload_2017-10-9_21-59-46.png upload_2017-10-9_22-1-7.png upload_2017-10-9_22-7-17.png
     
  36. jsecapture

    jsecapture

    Joined:
    Jan 2, 2017
    Posts:
    1
    First of all, thanks for the great asset.
    It is giving all our objects a really nice look and more depth overall.
    But I really would like to see an option to generate more than one Material from the original mesh.
    Its always really annoying to replace all my materials in a multi material mesh.
     
  37. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    Hey I just picked this up and i'm getting errors in unity 2017.4:

    Code (CSharp):
    1. `Generator' does not contain a definition for `Generate'
    Any idea how to fix?
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Just updated for Unity 2017.4 and Unity 2018.2
    Download new version and make sure there are no other script compilation errors, otherwise plugins will not be imported and you will receive such errors.



    VacuumShaders - Facebook Twitter YouTube
     
  39. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    492
    Hi,
    I just bought your asset but it doesn't work.
    When I try to bake an object with the included editor window, all I get is this error:
    Code (CSharp):
    1. Generating failed :(
    2. UnityEngine.Object UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(UnityEngine.Object)
    3. UnityEngine.Debug:LogError(Object)
    4. VacuumShaders.AmbientOcclusionGenerator.AmbientOcclusionGenerator_EditorWindow:Draw_GenerateButton()
    5. VacuumShaders.AmbientOcclusionGenerator.AmbientOcclusionGenerator_EditorWindow:OnGUI()
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    I'm on Unity 2018.3.0f2

    -EDIT: I have tested it with the example meshes. Same error.
     
    Last edited: Jan 27, 2019
  40. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    492
    However, the script examples do work. But I don't know how to generate a full hierarchy of meshes. It only seems to deal with a single mesh, not a whole gameobject with it's hierarchy of childs.
    Also, the output is a color array, so it's supposed to be only for a single mesh?
    I can feed it a single mesh at a time, but will this take into account the surrounding meshes of the same gameobject?
     
    ThermalFusion likes this.
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Confirm bug in 2018.3f, working on fix.
    Package comes with two solver, one takes scene objects into account for AO calculation, another one - no.

    [EDIT]
    Package has been updated.



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Jan 29, 2019
  42. crimn

    crimn

    Joined:
    Jan 8, 2013
    Posts:
    24
    hello, i am working on a run time level editor for a low-poly webgl game,so my question is does this ambient occlusion will make serious impact on the game performance? i am not sure if the ao get instantly applied or is calculated every frame?
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    In run-time AO is calculated as Color array, you can assign it to a mesh vertex color later or use otherwise.
    As it is just a method, you can use it any amount of times you need, just once with mesh generating or on every frame if you need it.
    Performance and quality is proportional to the mesh vertex count, ray count used for AO, or objects mesh interacts with. Everything is controllable from settings.



    VacuumShaders - Facebook Twitter YouTube
     
  44. nickthane

    nickthane

    Joined:
    Feb 20, 2018
    Posts:
    2
    First up just wanted to say what a great asset this is. I'm building a mobile game with procedural generated meshes meaning I can't bake AO and SSAO isn't really an option so it's perfect and works perfectly.

    Only thing I've noticed is that when using a project with LWRP the Occlusion Render and skybox indirect lighting option both crash Unity (18.3.0f2). I'm assuming this is something to do LWRP and render textures?
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Already fixed, download new version.



    VacuumShaders - Facebook Twitter YouTube
     
  46. nickthane

    nickthane

    Joined:
    Feb 20, 2018
    Posts:
    2
    Blimey, that was quick! Just updated the package and Unity 18.3.12 and working perfectly. Thanks!
     
  47. Sledo

    Sledo

    Joined:
    Dec 27, 2013
    Posts:
    7
    Hello. I have a very large location size in the scene. Standard means Unity give an error for lack of memory even at the minimum settings, and he considers it four days.
    Does this asset cope with calculating large locations?
     
  48. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Had no problems with "large locations" before.
    What is "large"? Size of a mesh or vertex density?



    VacuumShaders - Facebook Twitter YouTube
     
  49. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    182
    Does this work with skinned meshes? I need this for baking AO for my hair.
     
  50. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,168
    Skinned meshes - yes.
    Blend shapes - no.



    VacuumShaders - Facebook Twitter YouTube