Search Unity

VertexDirt - Per vertex Ambient Occlusion baking [WIP]

Discussion in 'Works In Progress - Archive' started by ZFarago, Jun 2, 2013.

  1. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    Thanks for explaining that. Also, if it can be used as just a component then it can be applied to an existing prefab as well? I read something in the docs mentioning I would need to use this tool before creating the prefab.
     
  2. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Yes, you are rigt, if you using prefabs, you have to save them before. This is the working way right now, but I'm wokring on it to make it better. If you have trouble using VertexDirt with prefabs, feel free to write me in private and I will help you by tailoring VD scripts for you.
     
  3. Carpet_Head

    Carpet_Head

    Joined:
    Nov 27, 2014
    Posts:
    258
    I'm curious if this can be done at runtime? Time taken is of no matter.
     
  4. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    if time is not matters, then it could be, yes. The core calcualtions are not depends on editor functions.
    It is not tested recently, but early versions did it well.
    But please note, no component or function available in the package that can trigger a baking at runtime right now. You have to implement it.
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Any idea why does it give grey output on both 5.2.2p3 (VD 1.59.2) and 5.3.2 (VD 1.59.3). Fresh project, example sphere scene ? Spheres are baked properly when I load scene but using your tool gives plain grey result. Win7 DX11.
     
  6. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    hi, there is a sampling slider which sometimes shows zero. Sliding it up to maximum will fix it.
    Sorry about that! (making that slider was a bad idea anyway...)
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Definitely as you sample whole 64x64 texture to take first element of ReadPixels array from ... MIP controlled by slider ? It's supposed to take always highest MIP level (readpixels array should be then of length 1) to benefit from Unity auto MIP texture. Plug this slider to texture size (2^blur level) rather. Update docs maybe. Thanks for the free L11 plugin anyway. Took me quicker to debug your pipeline than writing my own baker :).

    Tom
     
  8. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    The pleasure is mine.
     
  9. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    I can't seem to get anything useful out of this.
    I followed the pdf and I also tried in the example scene but no matter what I do the output is just a solid grey.
    So in the spheres sample that makes them a flat grey because the shader is an unlit one, and in my scene I'm using the diffuse but it's again just a grey diffuse, no AO.
    I tried min, max and between settings on the sliders.
    Do I need to set up the camera in a special way? I must be missing something to not even get the sample to work.
     
  10. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hi, sorry to hear that.
    What is your unity version?
     
    Last edited: Feb 11, 2016
  11. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    5.3.2f1
     
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Try to set "Sample Blur" slider to at least 7. On example scene it helped :) Then try to play with "legacy" / "compatibility" toggles but they didn't make any difference for me.

    Tom
     
  13. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Thanks tomaszek for helping. New package with the bugfix was sent for review.
    Can I ask about your project working on with VertexDirt? New RTP feature?
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    No, it's game project we hopefully showup soon.

    Tom
     
  15. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Nice! Looking forward to it!
     
  16. KeaGen

    KeaGen

    Joined:
    Feb 12, 2016
    Posts:
    4
    @tomaszek I am evaluating different approaches of baked Ambient Occlusion at the moment. Sorry if I missed anything, but could you show a screenshot in which I can see the wireframe and the polycount?
     
  17. Dudledok

    Dudledok

    Joined:
    Oct 24, 2013
    Posts:
    110
    Thanks guys, getting some good results now.
     
  18. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Good to hear that!
     
  19. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @ZFarago Could you provide some explanation for the 'sample blur' feature? There is no information for this feature in the documentation. Thanks.
     
  20. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    It was an experimental feature, mainly for debugging reasons, and removed from the next version. It soon be accepted in the store.
     
  21. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    Really loving the asset but I'm having trouble when I build out to Android. Runs fine in play mode but the included unlit shader breaks in my build (i.e. all pink).
     
  22. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Well, that is an old shaderlab shader, but it should work on android anyway. Maybe the new unity versions dropped that support. Write me in private, I send you a surface shader immediately.
     
  23. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    @ZFarago

    Hi there. I have just purchased the asset (version 1.59.31), imported into my Unity 5.3.4 project, and tried it on the included Cornell box and sample scene assets like the steering wheel. Unfortunately, it doesn't seem to work as intended. Nothing is baked into the vertices aside from uniform light gray values, no matter the settings.

    Here is how the sample scene asset looks in it's original, unmodified state:



    Here is the result of baking - despite running for ~60 seconds, it's completely blank:



    Compatibility mode changes nothing, aside from prolonging the bake by another 20 seconds.
    The only way to get any results out is to use the legacy mode, which results in this:



    I'm not sure why there is such a stark difference in contrast between your own included bakes and the bakes produced on my side in the legacy mode, though. Also, legacy mode triggers this error:

    Code (csharp):
    1. Releasing render texture that is set as Camera.targetTexture!
    2. UnityEngine.Object:DestroyImmediate(Object)
    3. VertexDirt:Dirt(Object[]) (at Assets/Plugins/VertexDirt/Scripts/VertexDirt.js:188)
    4. VertexDirtWindow:OnGUI() (at Assets/Plugins/Editor/VertexDirtEditor/VDAmbientOcclusionWindow.js:64)
    5. UnityEditor.HostView:OnGUI()
    P.S.: Also, your PDF document is possibly a bit outdated - there is nothing about the modes, and it mentions the possibility of modifying camera near/far clipping settings through the static class properties, which I'm not seeing exposed in the current version of VertexDirt class. Taking out a mention of a nonexistent "scripting reference" or creating that reference would be neat too. :)
     
    Last edited: Apr 4, 2016
  24. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hi!

    Please use the legacy mode, and it will work fine. I used a medium-to-dark grey when baking the samples, that's why you experienced a slight contrast differences on your bakes.
    I had only a little time on the past months to work on VertexDirt, and sorry about that. Bugfixing and docs refreshing very soon. Please be patient.
     
  25. atpkewl

    atpkewl

    Joined:
    Jun 30, 2015
    Posts:
    17
    Hi @ZFarago How's the performance on Mobile ?
    I'm trying to create similar effect of object color as Chameleon Run... Please let me know if this is possible.
     
  26. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hi!

    VertexDirt do not have realtime baking, so it can not updates the shades dinamically. Chameleon run using some nice lighting rig and maybe image effects I think.
     
  27. atpkewl

    atpkewl

    Joined:
    Jun 30, 2015
    Posts:
    17
    Hi @ZFarago what do you think Chameleon run use ?
     
  28. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    Hi, I just bought your plugin. I tested on a MacBookPro 15 10.10.5 and UnityV5.3.2f1 with a basic cube from UnityEditor in a basic scene.
    When I click on the "Start" button, I got this error
    "
    Releasing render texture that is set as Camera.targetTexture!
    UnityEngine.Object:DestroyImmediate(Object)
    VertexDirt:Dirt(Object[]) (at Assets/Plugins/VertexDirt/Scripts/VertexDirt.js:188)
    VertexDirtWindow:OnGUI() (at Assets/Plugins/Editor/VertexDirtEditor/VertexDirtWindow.js:64)
    UnityEditor.HostView:OnGUI()"
    And nothing is baked. Any idea ?
     

    Attached Files:

  29. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hi!

    Releasing render texture that is set as Camera.targetTexture!
    That is just a temporary bug, going to fixed in the next version. Should'nt affect the results imho.
    Would you please send me more screenshots about the scene or the project via pm?
     
  30. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    Hi,
    It works now. I thought there was an error due to the error message of course, and also because the first try I made with "real scene" has led to a deletion of the targeted game object. The "test" cube object I used after didn't show any change, due to the position of the light. Thanks, I will proceed to other tests
     
  31. Synean

    Synean

    Joined:
    Jul 9, 2013
    Posts:
    3
    Hi,

    is there any chance to get this plugin working with skinned meshes?
     
  32. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    +1
     
  33. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hi Synean, hi ZJP,

    Well, it is definitely planned. It is quite an actual question, because I have just finished the thickness baking function.
    With that, you can have nice translucent surfaces, like human skin or so. And this function is shout for skinned mesh support :) (and AO baking also gets it soon ofc.)
    translucent-head.jpg
     
    Reanimate_L likes this.
  34. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the reply. ;)
     
  35. tombombadil1988

    tombombadil1988

    Joined:
    Feb 21, 2015
    Posts:
    20
    Is the quality of AO going to be linked to the number of polygons of my model? I have pretty low poly models but wouldn't want any visible seams or artifacts.
     
  36. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    If the topology is fine (the vertices arranged evenly and no big differences in triangle size and no too narrow triangles), then the results should be acceptable even at low poly cases.
    I think your pine will be fine :)

    pine-tree.jpg
    pine-tree2.jpg
    Low poly pine tree test - default settings.
     
  37. tombombadil1988

    tombombadil1988

    Joined:
    Feb 21, 2015
    Posts:
    20
    Wow that is some killer support right there. Buying right now!
     
  38. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Thanks! :)

    If you'll have more questions in the future, feel free to contact me in email or PM!
     
  39. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    New version in the asset store!

    key improvements:

    - improved baking. Better quality, shorter baking times
    - new sample scenes and new manual!
    - progress bar during bake
    - prefab support
    - able to multiple to existing vertex colors,

    Enjoy!
     
  40. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    Have you deprecated this asset? Its no longer working for me in Unity 5.6, all the objects I apply it to turn a shade of green... Do you know what might be going wrong?
     
  41. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hello!

    It is not deprecated, and it should work. Try changing the parameters or reseting the editor layout, or try to bake in other versions. If you can provide some test project, please send me via email.

    Apologise for your trouble,
     
  42. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Reanimate_L likes this.
  43. Karan90

    Karan90

    Joined:
    Mar 19, 2019
    Posts:
    13
    Does this work on Oculus Quest?
     
  44. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Yes. I actually use it in my quest projects.
     
  45. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    Hey guys,

    I am using Unity 2019.3.4f1 and the Universal rendring piepline (for Quest dev) and just downloaded the asset.
    I am trying it on a simple cube for test, but it takes ages... (or seems to be stuck).
    Is it compatible with this version of Unity ?
    Beside just selecting the object I want to bake, is there anything to do ? I used the default settings...
    Thanks !
     
  46. ZFarago

    ZFarago

    Joined:
    Aug 13, 2012
    Posts:
    155
    Hello,

    The results can be seen in SRPs, like the Universal rendring piepline, but unfortunately the bake process will not work in SRP.
    I working on the solution. Please feel free to contect me via email for further assistance.