Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Enter the 2020.2 Beta Sweepstakes for a chance to win an Oculus Quest 2.
    Dismiss Notice

Occlusion Probes

Discussion in 'Graphics Experimental Previews' started by DavidLlewelyn, May 15, 2018.

  1. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,570
    I think the communication problem lay in the difference between:
    - this is what unity can do
    vs
    - this is where a team a specialist can push unity
    Book of the dead being the later.

    The obvious course of action is just a mere "framing" adjustment to avoid confusion. Ie present these demo by minimizing internal part of unity (as in they are not official presentation of given features) but emphasize inspiration for where unity will go by specialist. I mean when someone make a great game with unity, there is no confusion that's it's using "out of the box" unity features, we understand it's a mix of these features and the team ingenuity, ie their own specialist knowledge. And then the implementation of these specialist knowledge can be share by the benefice of everyone, with each people sorting how far they can push into that knowledge.

    I think a lot of confusion simply emanate from the fact that unity communicate on democratizing game development, but then present stuff that require specialized knowledges and skills, with no easy access to that knowledge, hence why people get easily confuse and why the communication need to adjust to balance these aspects.

    Especially in the realm of visual rendering, shader knowledge are becoming incredibly specialized and intricate, and access to the basics are obfuscated. This is not something that will be solved by shader graph only, when you look at paper and they start using words like "pdf" and have dialect shift like using either visibility and geometry, it become hard to catch up. Even now the use of words like "scalar" is moving stuff a bit further away from democratizing stuff. Especially when behind these concept are sometimes simpler that the naming suggest.

    I'm not blaming anyone with this observation, but it muddy the communication problem in regard democracy.

    Sometimes I ask question about term and I have no answer (not limited to unity), and these are for basic things if you are educated on the matter, education I don't have and tried to catch up. For example, I was confuse for a long time by "pdf", now I know it mean it's a probability distribution function and it's not a shader dialect like NDF (normal distribution function) but simply a statistical concept, but still has a proper shader context that the vanilla definition don't cover (the pdf is the probability that a unit volume of space will emit a given amount of light). Just pointing me it's a basic statistic term would have saved me month of detective mode and self training.

    But it's an example, and might be to specific (pdf is not widely use outside of paper), the point being is that, unlike pbr whose principle was hammered down with clear graphics, access to the knowledge these advance features are obfuscated, so it's not just a problem of code, UX. These type of terms are used when the features are presented to the public, it's in the blog and it's in the code and it leaves ambiguity to a class of users who can't define for themselves the boundary of what's being told and leave them to fantasize to fill the blank. The communication should not just be geared from specialist to specialist, especially when sometimes these terms can be replace by simpler one. Eventually that knowledge will be vulgarized and metaphor will trickle down, but it's messy.
     
  2. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    68
    So...can we have them now?
     
    Shorely likes this.
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    There are plans for a high level API, but like everything else this is not yet available and not yet on the roadmap. If you have technical know-how you can have them now.

    @neoshamanShader graphs are accessible to all, and the code on github is not obfuscated - it's basically HLSL, which is very widely understood by graphics programmers. The in between nonsense is what surface shaders were, and going back to that is where gibberish will occur. Best a clean break: HLSL and Shader Graph.

    I don't see what democracy has to do with any of that since it satisfies the novice and the expert. Progress is not making something like surface shaders again, but simply being able to code HLSL nodes for shader graph.
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,570
    I was talking about perception not reality!

    If you show something and says everyone can do it, and then in practice it is reveal only specialist can do it, well it throws a wrench in the communication when people I can't do that. It's not about satisfying the specialist and the profane, it's the lack of emphasis on the difference between the two. That's why people were disappointed by the adams demo too.

    The end goal is to make sure everyone can do it, and that's what unity documentation are for, we have the delighting tools, photogrammetry guideline, etc ... But the gap between a reveal and that end state create lots of confusion.

    Eventually the things that are too technical will be vulgarize by users like brackey and skyoo, who will gave the digestible version, before unity fills the gap themselves (sometimes by hiring those people). But that's fragmenting the sources of information.

    Unity must be aware of the gap since they made a unite talk at berlin this years about technical communication. Meanwhile that gap still exist and that's when we see people going up on arms about "democratization".

    I'm filling the gap for myself continuously, so I'm aware of some confusing aspects, like anything shader a bit too "advanced" need some solid statistical background, and a great dose of dialect exposition, to understand that scalar is just a number and that "vector" is basically an array of number.

    That is a problem when sharing that for an audience of pure artist. I mean I'm still struggling to properly learn spherical harmonics (beyond the limited tools provided) as any specialist I ask has is eyes glancing off to the distance for some reason, It's hard to be properly mentored on that without proper background ion math, all the resources are in ugly math dialect (but I'm getting there, i'm filled with determination).

    I mean it's accessible (as in they give you the sources) but not accessible (it's hard to understand to the profane). And crossing that gap from profane to specialist is hardly covered either. You can only do so much by using a shader graph without proper understanding of the secret math sauce.

    That's why I'm talking about a mere framing adjustment.
     
    Thall33 and Shorely like this.
  5. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Using Occlusion Probes (once you know that you need to bake them from the lighting menu without automatic bakes) isn't something that would need super specialized skills tho, but we could use better documentation (just ship some doc along the files or put it on BOTD github wiki). You need to copy one folder that contains all the relevant scripts and then you need your modified shader to access the occlusion probe data. Shader doesn't need huge changes, the legacy shader example on the original post on this thread shows how minimal the changes are to access the occlusion probe data. If I had more free time I'd probably take the occlusion probe only diff from BOTD so it would be trivial to apply it to regular HDRP alone. I'm still considering in using occlusion probes along with the legacy pipeline myself but will see how it goes.
     
    one_one likes this.
  6. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,570
    If it's a reaction to my post, I was mostly commenting on the sub topic that was started a bit earlier.

    Occlusion "probe" don't seem that confusing, it's been stated it's a 3d texture, I have yet to check the baking method though, I thinks it's just casting ray for each cells of an array and accumulating the result in a single shading value. Reading should be trivial, as in finding the world position of a pixel and then finding the corresponding cells (actually the trilinear interpolated position) in the texture. Could even works with open gl 2.0 with the cost of doing trilinear interpolation by hand with a flatten volume texture, and too many texture fetch :confused:.
     
  7. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    5,457
    You, and other people, who thinks Adam demo or the Book of the Dead is cheating makes the mistake because Unity is about 'democratizing game development' and not 'democratizing high-end AAA graphics development'.

    With that said, obviously the more Unity can give to us who doesn't have a clue which end of this thing is the blade and which is the handle the better. But it's not fair to force upon them things which they didn't say they would do (do they intend to do? sure, but they haven't promised anything like that).
    They haven't said that everyone can make the Book of the Dead or the Adam movie. They said 'it can be done in Unity'. Not less, not more. And they're 100% right.
     
  8. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,570
    Nah, I'm just attempting to understand why people feel cheated, I'm personally fine and can follow just fine.
     
    BazookasCedric and Lurking-Ninja like this.
  9. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    I played today a bit with occlusion probes, finally figured the one oddity I had when using these on legacy renderer (I always had to swap back and forth between SRP and legacy for occlusion probe data to show up). I figured that code for legacy was bit funky as it relied on occlusionprobes script being attached directly to the camera, so I fixed this by adding a callback to cameras OnPreRender instead.

    Now that I get the data reliably, I've been wondering about one other thing, I can't bake the occlusion probe data unless related objects are marked static for lightmaps, but this also bakes lightmaps for these objects, right? Isn't the purpose of occlusion probes to specifically bypass the lightmaps for certain objects, like dense foliage? I looked at Book of the Dead environment and there all trees seemed to be marked to be static for lightmap baking as well, but Unity dev also mentioned in past that there are no lightmaps for the trees, what am I missing?
     
    Thall33 and one_one like this.
  10. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    573
    I updated my comment above, you might not like it, but I gave it a fair shot. As long as you say it won't affect Vanilla developers then I'm all for it.

    The kite demo from Unreal which is fairly old now still looks better than Book Of The Dead.
    One reason also is because it's not practical to fork over all that fps to eye candy and no game play elements included.

    The technical features of the book of the dead example do not show anything that cannot be done outside of vanilla Unity. I am sure Unity vanilla could achieve the same level with higher performance with a bit of tweaking.

    The real challenge should be getting book of the dead working in Vanilla and then we can talk to see if there's a real comparison.

    I tested the performance of HDRP and it was bad from the sample scene to an empty scene by factors of several times in performance. It didn't offer anything noticeable in visuals over vanilla.
     
    Last edited: Aug 23, 2018
    Shorely likes this.
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    It does affect the built in renderer you are using, but only in the sense that the built in renderer will not get new features, only bug fixes if any. As you say, it probably does not need new features in your case.

    I have and that required two titans to render (for the movie) so that isn't a good comparison to make.

    I switched from built in to HDRP and have more stable framerates, that is, it can do half a mile of shadows that are crisp, with volumetric lighting and runs faster with everything set to realtime with thousands of draw calls and full post effects. Something I found impossible to achieve with builtin.

    Builtin will seem faster and better if you haven't got the time for experimentation and most people don't because it's not finished and not documented. Will need lots of documentation and time.

    If you are happy on built in and its going well for you that's good, and it should be used, in fact most people should probably still use builtin until HDRP is fully documented and mature.
     
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    so, if anyone knows this, I'd greatly appreciate the answer :)
     
  13. torbjorn

    torbjorn

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    210
    "Scale In Lightmap" = 0
     
    AlejUb and one_one like this.
  14. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    oh, I didn't realize you could do that :) I tried looking around all kinds of options to ignore the thing but couldn't figure out any that would have kept the trees effect in bake while ignoring the bakes on themselves.

    Now this makes a lot more sense, thank you!
     
    one_one likes this.
  15. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    219
    Shouldn't this be part of the new SRP feature?
     
    Alverik likes this.
  16. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    219
    I love Unity. A lot. But that is just hogwash.
    So Unity is democratizing game development but not AAA development... well, A. until recently it was not even capable of pulling AAA visuals. So that is one thing. B. Saying that and thinking of another engine which name I will not mention, is offering easy AAA solutions out of the box, does it mean that the other engine actually IS democratizing AAA game development? :D

    I am not sure you understood what exactly you implied in such competitive world.
    You unwittingly imply that unlike some other engine, Unity deliberately holds people back to give an advantage to AAA studios with larger budgets and tries to lure users with false promises and unattainable (for them) dreams. That is not good. And I am pretty sure that is not what Unity is thinking, doing, or intents to. :D

    Such features are crucial for high end visuals and Unity must provide these tools to us, in fact, these are the kind of tools it needs to provide us with in order to compete out there. Else you will soon see any and all AAA aspiring studios who may start small today, but have a bright future and could be great success stories for Unity, jumping elsewhere. To you know who. :p :D
     
    Alverik and Shorely like this.
  17. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Before this derails again further (and mods need to clean it up like they've done before), you can use these occlusion probes already without deep understanding with rendering tech. You do need to understand the shader changes it requires so that you can include it on your own project but I find that acceptable. Indies can use this feature, it's not something that's completely out of reach atm. And as long as Unity keeps updating Book of Dead environment sample, we keep getting some updates if there are breaking changes in the future.
     
  18. almertineshop

    almertineshop

    Joined:
    Dec 29, 2017
    Posts:
    14
    Do you use it with built-in or HDRP? can you please sum up the things you have done to make it bake properly.... and what version it works on, did you use the scripts from GitHub or from the book of the dead environment?
     
  19. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Occlusion Probe itself uses custom bake API introduced in Unity 2018.1 so that's the absolute minimum engine/editor version you can author the occlusion data in.

    I've tested mainly on legacy renderer. You can find 2018.1 legacy shaders in this zip: https://drive.google.com/a/unity3d.com/file/d/1YgoX5Zz7SDMWSjhzG2Plizn8vlmMAiLa/view?usp=sharing (link from the original post on this thread). Also as mentioned on my earlier post on this thread, the occlusion probe script itself requires some minor changes to work on legacy-only setup.

    As for HDRP, Occlusion Probes are not working on stock version Unity ships, only with Book of the Dead version. You can spot the relevant HDRP occlusion probe changes from this diff: https://github.com/0lento/ScriptableRenderPipeline/commit/a969c38a31279fd9ecda2e847b5fb9e6fa8bb899. That commit is whole diff between 2.0.5 HD SRP and BOTD SRP but Unity has commented most of the changes so it should be somewhat easy to separate occlusion probes there (or pick the changes from https://github.com/Unity-Technologi...mmit/8ddc802a014c028448125e437048be34ab1da1bb but I suspect this might be missing some changes, I'd use changes from BOTD SRP instead as basis). I'll probably make some separated branches for some BOTD additions per tech when I move to HDRP myself (still using legacy), this would make it easier to merge individual things to stock HDRP.

    Anyway that being out of the way, to use Occlusion Probes, you need the actual occlusion probe implementation either from BOTD (located in Assets/Features/OcclusionProbes) or from https://github.com/Unity-Technologi...Pipeline/Core/CoreRP/Features/OcclusionProbes (there may be small differences, again favor BOTD version as it's definitely working). For checking the bake, I've just used the legacy shader as it's displays the occlusion from the generated data.

    After having the implementation in place, do following:

    1) Go to Renderer->Lighting Settings and disable "Auto Generate" so it will not automatically bake the lighting while you work with this. I think auto bakes don't trigger the occlusion probe bake either so you probably need manual bakes anyway even when setup is done.
    2) Make a new gameobject in scene and insert OcclusionProbes.cs as it's component. You can add additional detail probes FROM this script if needed ("Add a detail occlusion probe set" -button).
    3) Adjust the scale of the gameobject you just created to adjust the overall dimensions of the probe area.
    4) Adjust resolution of the probe in X, Y, Z from the Occlusion Probes script, these will just define how many sample points you get in 3D for the probe area, you'll see small points in the border of the probe to visualize this (probably hard to see if you don't scale up the probe first).
    5) Mark all things you want to contribute to occlusion bake from the scene so that they are set to be included in lightmap bake (lightmap static).
    6) Set "Scale In Lightmap" from Mesh Renderers to zero for objects that you want to contribute to the occlusion baking but don't want to bake lightmaps for (trees, dynamic foliage?).
    7) Add a directory with your scene name in the scene folder location. For example if you have map named Assets/Scenes/TestMap.unity, you need to create folder Assets/Scenes/TestMap/ as that's where the occlusion probes store the map related data (would be probably a good idea to force C# script to create this if it doesn't exist).
    8) Hit Bake ambient probe from the Occlusion Probes script.
    9) Go Lighting Settings, make sure you have Baked Global Illumination and Progressive Lightmapper selected and hit "Generate Lighting", this will bake the lightmap but also occlusion probe data once it's finished with the lightmap bake.
    10) Examine baked data with custom shader.

    If there's interest on legacy sample, I can put some simplified sample on github later on but I'm suspecting most people looking at this feat are really wanting to use it on HDRP.
     
    Last edited: Sep 10, 2018
  20. almertineshop

    almertineshop

    Joined:
    Dec 29, 2017
    Posts:
    14
    Thank you very much that was very helpful :D
     
  21. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    I pushed two very simple samples based on the demo scene from lw/occlusion-probes SRP branch. These samples are using Unity 2018.2.7f1 and HDRP sample is using slightly modified HDRP 3.0.0-preview.

    First, here legacy renderer sample with three custom ASE (Amplify Shader Editor) shaders (and two shader functions):

    https://github.com/0lento/OcclusionProbesDemo/tree/legacy

    I've modified the Occlusion Probes script to work properly even when not attached to the camera when using legacy renderer. I've also ported the occlusion probes modifications for the 2018.2 standard shaders. These modifications are based on the zip from this threads original post (zip contained modified 2018.1 shaders). Additionally, I've tried to mimic the look from those shaders in my "AS Occlusion Probes Legacy Custom" shader, but it's a bit of a hack. This custom shader does let you tweak the occlusion probes strength and the amount it distributes to indirect vs direct lighting. "Simple" shader variant only lets you control the strength and it's just directly wiring occlusion data into AO input of the shader (it will not give same end result). There's also unlit "Debug" shader that lets you visualize the material with occlusion probe data only.
    Edit-> As additional note, you don't have to use those modified standard shaders at all if you make your own shaders. Nothing on occlusion probes rely on them (for example example would work without them using Occlusion Probes and provided ASE shaders).

    For HDRP, don't expect full example as I didn't port the actual shader changes from BOTD:

    https://github.com/0lento/OcclusionProbesDemo/tree/hdrp

    I've only modified HDRP 3.0.0 slightly to allow HDRP callback needed for the Occlusion Probes script and there are two custom ASE shaders here as well: "Simple" and "Debug". I don't really think that simple variant will do for real projects but it does let you try the thing out. If you plan to use this, do have another look at BOTD shader changes for this.

    For both branches, do check the commit notes and commits themselves to get more info what happened here, I tried to include only the mandatory steps in versioning to keep it simple. In the samples themselves, you can use the included "M Occluded" material to quickly swap the shaders for testing as every object in the scene is only using that one material.

    For the custom shaders, I used ASE 1.5.6 (obviously not included here but you need it to edit the shaders if you want something else than occlusion probes and solid color :D). There's nothing special in the shaders themselves, you can remake them in Shader Forge for legacy and Shader Graph for HDRP. You do need to create custom nodes to be able to do that on SG. The main component is basically this function:
    https://github.com/0lento/Scriptabl...b899#diff-3f75544a8ee6e044f8ed81849d84b4eaR49
    After you have that there, it's more of a question where you apply that data so it makes sense for the end result.

    Sample scene itself is really simple (and again this was mostly from lw/occlusion-probes): there's only bunch of boxes where top and bottom are static and rest don't contribute to the occlusion baking (but they do receive the occlusion data as long as you use shaders that support it). You can try including the smaller boxes in the bake if you wish but they doen't really give any meaningful results with this small shapes. I didn't bother assembling "proper" test scene with tunnels and trees, this is more of a simplified example how to be able to run these with Unity 2018.2.

    Small disclaimer: most of this content is originally provided by Unity and I didn't attach separate licensing for my changes, original Unity licenses are in the repo. If something breaks on due to my changes, please don't blame Unity as it could be simply my fault :D
     
    Last edited: Sep 14, 2018
  22. almertineshop

    almertineshop

    Joined:
    Dec 29, 2017
    Posts:
    14
    Sincerely, You are the Best. Thank you again the sample really helps clarify a lot of things:D
     
  23. MrJimGamer

    MrJimGamer

    Joined:
    Nov 24, 2015
    Posts:
    17
    Capture.JPG
     
    Last edited: Mar 21, 2019
    Lars-Steenhoff and keeponshading like this.
  24. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195
    Still no news about occlusion probe out the box for HDRP feature?
     
  25. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Not exactly same but they are now working on voxelized shadowmaps for 2019.1 (their WIP branch contains support for LWRP, you'd expect HDRP to be eventually supported too): https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/vxsm-19.1

    I don't really know what it does specifically but I'd expect it to be more like what Unreal does with their volumetric lightmaps. Would love to see some staff comment on this.
     
  26. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Been testing Shader Graph's upcoming Custom Function node along with HDRP's new Baked GI input. With this setup one can add really simple sub graph node to get Occlusion Probes on HD Lit Master.

    It seems to give nice looking results but I have no clue if it's still somehow incorrect. Also note that I don't even know what that Baked Back GI input does and playing around with it didn't really give any more ideas so I just left it unconnected. :)

    Here's the actual sub graph for it (in this graph Custom Function node reads occlusion probes sampling function from separate hlsl file):


    I've also moved Occlusion Probes into package and changed the callback and global shader property setters so that this will work on unaltered HDRPs in the future (right now it still relies on this PR for the SG).

    I'll push the PM package to github once the SG PRs are included on both 5.x.x/Unity 2019.1 and 6.x.x/Unity 2019.2 HDRP releases. Also note that this package will not work on 4.x.x/Unity 2018.x due to different SG implementation.
     
    Last edited: Feb 22, 2019
  27. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195

    Please share this package
     
    keeponshading likes this.
  28. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Like I mentioned on the post, I'm still waiting for Unity to merge the needed PRs so this will work on unaltered HDRP. I'd expect this to happen soon and will likely happen before final Unity 2019.1 gets out (they removed the old custom nodes from SG, they need this new system to replace it).

    Don't worry, I'll publish this asap once Unity gets the changes merged in following HDRP releases.
     
    hippocoder, keeponshading and Danua like this.
  29. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195
    Yeah! You're rock!
     
  30. Danua

    Danua

    Joined:
    Feb 20, 2015
    Posts:
    195
    @rizu . Is it real implementation of occlusion probe? Will it work with stock hdrp lit shader ? It's separated component occlusion probe like at botd ?
     
  31. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    You'll need HD Lit Shader Graph for any material that you want to receive this occlusion data, but it's trivial one node drop in the graph. And it's still using the same component setup from BOTD (but it does work).
     
    hippocoder, Darthlatte and Danua like this.
  32. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Well, two things are happening now :D First of all, custom function node (which is needed for my custom package) has been merged into master and release/2019.2 branches, meaning it will be in the 5.8.0 and 6.6.0 SRP's. There's also an underlying custom bake api issue on 2019.1 that currently prevents occlusion probes baking in 2019.1 but Unity has a potential fix for it in 2019.1.0b8 (custom bakes do work on all 2018.x Unity versions and in 2019.2, but crash in 2019.1 atm).

    But.... Unity is also now merging occlusion probes to the SRP directly as well! https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/3179. This PR is only for LWRP but could imagine they would port it to HDPR soon after they get the LWRP version done.
     
    Last edited: Mar 12, 2019
    hippocoder and Darthlatte like this.
  33. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Here's my unofficial port of Occlusion Probes, moved into Package Manager package (requires Unity 2019.1+):

    https://github.com/0lento/OcclusionProbes/tree/package

    This package doesn't require any SRP customization, it will use standard callbacks from built-in RP or SRP, depending on which one is in use. Package itself only contains required runtime and editor scripts, no shaders or example project is included.

    Additionally, I made another package for reusable HDRP SubGraphs that help you craft Shader Graphs with Occlusion Probes support:

    https://github.com/0lento/OcclusionProbes/tree/package.hd

    These are the main things included on this package:
    - Sample Occlusion Probes (samples Occlusion Probes texture)
    - Reflection Occlusion Amount (returns the reflection amount set in Occlusion Probes Data asset)
    - Baked GI with Occlusion Probes (custom BakedGI node that takes AmbientProbe into account)

    And these are the combo nodes for ease of use:
    - Occlusion Probes BakedGI with Ambient (puts everything above together)
    - Occlusion Probes BakedGI (same as above but without AmbientProbe)

    Additionally, HD package also contains one unlit Debug shader which only visualizes the Occlusion Probes texture.

    And finally, here's the old sample but now using these two new packages, powered by stock HDRP 5.10:

    https://github.com/0lento/OcclusionProbes/tree/2019.1-hd-sample

    This sample has two Shader Graph examples that demonstrate how to build your own graphs with Occlusion Probes. When you first open the project, you will get errors for these two shaders, you fix that by simply opening both Shader Graphs in the Assets/ShaderGraphs folder and saving them again once they open.

    Technically the sample will also open on 2019.2.0a9+ but it'll be still using 5.10 HDRP for it. Also worth mentioning that 6.6.0 HDRP would work with these SG nodes out of the box as well but it's not released yet :D

    Additional note: In case the occlusion effect dissappears after restarting the editor, make sure the Occlusion Probes script on the scene has OcclusionProbeData asset assigned to Baked Results->Data. I've noticed this sometimes goes missing after new bake.

    Additional note #2: When you hit Generate Lighting to bake the lighting and new Occlusion Probes textures, you may notice an error in the console telling it will not process custom bake inputs. While the error may seem alarming, it's not correct at all: it will still process the custom bakes for occlusion probes. Issue report on this here: https://issuetracker.unity3d.com/is...ed-callback-throws-an-error-on-the-first-bake. Of course you still have to use CPU PLM for the baking for this to work in the first place.

    Additional note #3: I have no idea if the AmbientProbe setup is right on the subgraps: I just tried to mimic what BOTD did. This is why I also included alternative BakedGI version that doesn't use it.

    Additional note #4: Right now there are three different shader includes for the new SG custom function nodes which are used on the HD SubGraph package. I'd prefer having only one for all three custom functions but this is not possible today due to SG bug (it includes the files three times and complains about redefinitions if I put these in the same file). Issue ID #1138033.

    Additional note #5: Occlusion Probes baking only gives decent results if you have old style low intensity lighting. If you use realistic higher intensity lighting values, Occlusion Probes texture will be all white. If you have any idea on how to begin fixing this, please drop me a note.
     
    dnnkeeper, AlejUb, RockSPb and 6 others like this.
  34. Darthlatte

    Darthlatte

    Joined:
    Jan 28, 2017
    Posts:
    27
    @rizu Hi, thanks for your work on the occlusion probes :) Sooo.. I tried to give this a go in a scene of mine.

    Silly question: Does this only work for light baked (static) geo?

    I tried to open up your sample project in 2019.1.0b8 to see how it was set up, but it's a mix of pink and dark grey - so I couldn't really see any effect in it.

    Next I tried to replicate the setup in my own project. I have added both the "default" package and the package.hd to my project, setup a new material using the SG with the node setup from the sample project and also created a new object with the occlusion probe script attached (the probes bounding box covers all of my scene), but where do the "Baked results -> Data" come from? I ended up copying the file from the sample project and added that, then I tried to hit bake, nothing happens. Btw. the editor crashes when baking lighting while having the occlusion probe script added to an empty gameobject in the scene.

    Again thanks a lot for your work :)
     
    Last edited: Mar 23, 2019
  35. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Only static objects that contribute to the lightmaps (their lightmap size can still be 0) can contribute to the occlusion probes bake, but the baked occlusion texture can still be applied to dynamic objects. You need something static for the bake to get anything in the occlusion probes texture though.

    Did you resave the two shadergraphs like instructed in the earlier post? I can test what clean clone does tomorrow on my end, afaik it should work after resaving (and therefore recompiling) those two SG's. You do probably need to enter play mode at least once to see anything proper though.

    OcclusionProbeData asset gets generated by the custom bake api after you bake the lighting yourself, this should appear in that field automatically after bake. Make sure you use CPU version of the PLM and don't have automatic bakes enabled. Bake has to be started manually by pressing that "Generate Lighting" button.

    Hmmm, I've never tried it on empty scene, does it crash even if you have something to bake there? There was a bug on 2019.1.0b7 and older that crashed the editor on custom bake api but it's been fixed on b8 (at least works on my sample scene now). Also make sure you got the subfolder with your scene name there (see how I have one on the sample). Occlusion Probes script doesn't generate the folder if it isn't there already.
     
    Win3xploder and Darthlatte like this.
  36. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    So we can use occlusion probes to occlude the HDRP dynamic ambient probe? The problem with the dynamic ambient probe is that every mesh assumes it's outside, and this kind of sucks, obviously. So the occlusion I'm looking for should also work on static geo since it's time of day...


    Dropped enlighten (realtime and baked) entirely, so it's just a realtime lighting setup now. Can still bake if it'll work fine with time of day though. And I'm not really seeing how that could work here...
     
  37. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Occlusion Probes are static by design, so it's not going to work with dynamic day/night cycle (unless you make tons of captures and lerp between I guess, no idea how feasible that would be or what kind of results one could expect).
     
    hippocoder likes this.
  38. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Yeah it's not going to be a useful thing for me. Much more useful would be some kind of AO that's not baked. GDC has a presentation on realtime open world GI for huge environments that is within the golden range of 0.6 to 2ms for console hardware, and that is somewhat special. In fact it would probably make occlusion probes a tad redundant too I guess. Why are we even looking at baked workflows for something like HDRP anyway?

    Seems daft.
     
  39. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    397
    Because baked is extremely fast, and works for most people.

    Honestly I don't know if I buy it's possible to have good looking realtime GI at only 2 ms. If is is, why don't we have it yet? :p
     
  40. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    No idea but several AAA games do. I'll be patient? In any case - can't use occlusion probes with time of day so I'll excuse myself from the thread.
     
  41. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,570
    I was wondering if a AO 3d texture storing zonal harmonics sample by the time of day would be interesting, given than the precision increase linearly unlike regular SH. I still has to get into the math though...
     
    keeponshading and hippocoder like this.
  42. Pepe-Hoschi

    Pepe-Hoschi

    Joined:
    Feb 27, 2016
    Posts:
    7
    Thanks for sharing your work Rizu :D
    Just installed your repo in a fresh 2019.2 install with the 6.1 hd pipeline and everything works fine.
    Btw. I don't see a reason why Sky Occlusion should not work for dynamic day/night cycles. As it is only a 3D Texture with baked Sky Occlusion remapped to the worldspace.
     
    keeponshading likes this.
  43. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    You'd need to bake bunch of 3D textures and lerp between them probably, I've thought about it but it would probably take away some details from it.
     
  44. xrooshka

    xrooshka

    Joined:
    Mar 5, 2014
    Posts:
    57
    Oh, it's not just like ambient occlusion? Bad news. I thought it's just darkening some occluded areas from the sky and nothing else, so it can be used with Time of Day.
     
  45. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    It's static, which is why in BOTD blog it mentions that while time of day can change slightly it will break the illusion if it's more pronounced. Being a 3D texture means it's going to be rough on bandwidth for any kind of larger scenario.
     
  46. torbjorn

    torbjorn

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    210
    I'd say the bandwidth used by the 3D texture is fairly small compared to other textures/rts you're likely to have in an HD project, but if you're looking at making really large levels you might want to refine the base+detail approach into something a bit more cascade/clipmap like.
     
  47. AlejUb

    AlejUb

    Joined:
    Mar 11, 2019
    Posts:
    25
    I find the information a tad fragmented.
    What I understand currently:

    One Solution:
    We have rizu with amazing progress, tools, assets and samples done on it. It is a volume texture, so probably the potentially most high fidelity one (all the thanks and hats available goes to you).

    We also have the official version added to Unity's existing light probes. That repo says it's merged on 2019.1
    Can't seem to see the options on the lightmapper, scripts, shaders, etc. Objects do seem to get 'occluded' a bit though when getting close to a shadowed wall, could be just a less intense GI probe change.

    Edit: forum doesn't let me post the unity github where the occlusion probes are merged to.
     
  48. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,814
    Afaik, the official thing that got merged in is just affecting the LWRP probes, I dunno if there's more info about it somewhere but it's not used in HDRP afaik and it's not the volume texture thing we got on BOTD.
     
    AlejUb likes this.
  49. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    491
    The marketing teams want as much hype as they can get, and they aim high. Unity throws a tremendous amount of focus and money at making people go "ohhh, Unity can do that", in order to draw people in. I don't think Book of the Dead is meant to solely impress a AAA studio into deciding to use Unity ... I'm pretty sure if that were their only target audience, their marketing would look different. Not to mention ... yes ... they're bringing HDRP to everyone with the goal of giving high-end graphics to everyone. What you mean is, there is naturally a difference between what a team of specialists can do with their tools, and what laymen can do, and they aren't promising their high-end AAA graphics development will put your content on par with a specialists content. The same way you can give me a ten thousand dollar paint set, but I'm still not painting something people are going to want to hang on their walls.

    Unity wants people to go "oohh" and "ahh", and get drawn to the new shinies. They don't want the majority of people watching that to think "heh, that's way beyond anything we can ever do, no point in my caring ... Unity doesn't even support all of this out-of-the-box anyway!" ... that would probably be counter productive. There's a reason why they're show-casing how far specialists can push Unity, and not what the average user will have access to, even though that would probably be more relevant to most people.

    Unity is a large business ... so I'm assuming they have marketing teams figuring out how to make sure they're making money ... and those movies are probably part of those plans ... of course, they never said everyone can do it, because that's not going to happen. They're pushing Unity as far as they can, which is naturally going to be further than most people can go. The problem people have is the lack of open, blatant communication that those tests are not actually show-casing vanilla Unity, but a souped up version, on top of using it in ways that the average user is not going to even think to use it. Which ... I suspect Unity is banking on, or people would care less, as impressive as it is. I don't mean to take away from what Unity is showing us or building for us in any way ... only that they probably benefit from the fantasy that anyone can make an "Adam" or "Book of the Dead".

    I suspect the biggest problem is people forget that there's marketing involved, so they forget that _of course_ there's going to be "cheating" involved. Unity isn't showing you what they think "you" will be able to make, but as you're saying, something impressive that "can be done in Unity". But ... its not really fair to say Unity isn't heavily pushing "democratizing high-end AAA graphics development", since that's kind of the whole point of their making HDRP with a slew of different built in shaders, with all sorts of shiny built in options, on top of Shader Graph making it easier for non-AAA studios to build pretty things. That's a large thrust of how theyre spinning what they're building ... and they're doing a pretty good job in my opinion.

    I guess my point is, Unity isn't doing anything wrong. But the fact that people make the mistake of thinking they can do everything Unity is showing them is also something I suspect Unity is aware of. Unless I'm just cynical in thinking a team of people who are trying to figure out how to make the biggest impression to somehow increase their revenue is involved.
     
    Last edited: Jul 18, 2019
    OCASM likes this.
  50. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,872
    Ok, so... still no official news about occlusion probe? :D
     
unityunity