Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official Adaptive Probe Volumes (APVs) experimental release for HDRP in 2021.2

Discussion in 'Graphics Experimental Previews' started by Matjio, Feb 11, 2022.

  1. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    So we are making a game with procedural levels. We need to shift the contents of the next level in order to line up with the exit door of the previous. Is APV simply out as an option? Is the data in a black box? If there is anyway for us to get at it we can offset the probes ourselves.
     
    Last edited: Apr 29, 2023
  2. Super_RafyYT

    Super_RafyYT

    Joined:
    Oct 5, 2021
    Posts:
    11
    still not working at all
     
  3. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    Is it possible to somehow select and bake specific scenes in the probe volume baking set using C# API?
    Doing that by hand is painful. Would like to make a progressive baker, since currently its super unstable to bake that many scenes all together. Just gets stuck at random % and doesn't continue even after many hours. Would loading scenes and disabling/enabling probe volume in the scene achieve the same effect? or would those probe volume sets, get reset, overridden or somehow else broken?

    upload_2023-4-30_15-22-47.png
     
  4. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    It's not currently possible, but i am making some API public on the baking set to make it possible to automate the setup
     
    Avol likes this.
  5. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    Unfortunaltely APV is not an option for that, you will have to rely on the light probe group.
    Since 2023.2, you have the ability to move baked light probes at runtime via script.
     
  6. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    I think I found a work around for this. Basically open center scene, and 8 scenes around it. Copy game objects from surrounding scenes into the baking scene. Close other scenes, bake, destroy gameobjects. Bakes do stay in different scenes. Not fully sure yet if lightning is correct on scene edges.
     
    adrien-de-tocqueville likes this.
  7. Caparrini

    Caparrini

    Joined:
    Jun 21, 2017
    Posts:
    63
    It appears that in the Probe Volume Settings, the Layer Mask menu doesn't show all the Layers actually available in the project. I'm using the User Layer 31 and it doesn't show up as an option to select or deselect.

    And it actually raises the Error of:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    UnityEditor.MaskFieldDropDown.OnGUI (UnityEngine.Rect rect) (at <9dccbc75b8a249d78358fb192f335670>:0)
     
    Last edited: May 5, 2023
  8. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    121
    Being able to move the baked data at runtime (I understand the resulting baked data has little to do with the actual probes themselves) is a must, it shouldn't be that hard to add an option for this, much like has been done with light probes in 2023.2, right? If I'm misunderstanding this, an explanation on why it would be technically unfeasible would be fine too, I just want a little bit of closure on this (in my opinion, relatively major) problem.
     
  9. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    it's feasible to add an API to move all the APV probes at the same time, but i'm not sure it'll help your case (maybe i am misunderstanding though)
    It's not possible to bake the rooms of your level separately and then load them together and shift them so that they match, because you can only have one baking set loaded at a given time.
     
  10. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    Well, at least for our use case we have a workaround. We were using a “transition room” anyways so now we will have that room lightmaped and move it so that it goes to the entry point of the new room that uses apv and spawns in normally. But being able to combine baking sets at runtime would open up so many possibilities.
     
  11. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    508
    I think being able to bake the probes in place and save them to assets and being able to place them anywhere in the scene as volumes, would open up many possibilities (being able to add them to prefab being one of them). The objects would then pick the appropriate volume. Similar to how reflection probes work. But I guess the entire system is working in a different way and it is tied to the scene, right? Probably much more complicated than it seems...
     
    Last edited: May 9, 2023
    Spikebor likes this.
  12. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    280
    GI baking is weird, some scene it takes like seconds to bake, some scenes (especially scenes from Unity's Original assets like the Snap Art's City and Garden, I don't know what is up with them) they take hours.
    Can some devs from Unity go back to those scenes and check what made them take so long to bake GI?
    Edit: User error, I forget to mark some meshes as static, anyway I'm surprised just from that it can reaches an unbakeable long time. Now after all are static, it still bakes super long compared to my other asset store's assets scenes, 10 mins versus few seconds or up to 1-2 mins.
     
    Last edited: May 10, 2023
  13. Brindelmold

    Brindelmold

    Joined:
    Apr 28, 2018
    Posts:
    8
    Had a play around with the feature - a mix of the APVs and lightmaps seems great.

    The big issue I'm having is that the option to bake Lighting Scenarios just doesn't seem to exist! It's possible I need to update my HDRP - I've got a few installs I've been playing around with and the most up to date is 2023.1.0.a21. I've been working in 2022.1.23f1 a bit more, but my version of HDRP is then 13.1.7(I think).

    I'm guessing I need to get a more up to date HDRP from the github to get those features? And is there a mimimum Unity version i need to be working with?

    I definitely need to be able to change the lighting condition at runtime - I was previously swapping lightmaps, but the ABVs seem more suited to a lot of what I need.

    If it's not feasible - is there a way to save out the different conditions manually?

    Documentation (1.)(as far as I can tell) suggests that I should be able to but the probe reference volume is always a singleton, so I'd have to save out the values to a separate class and swap at runtime.

    Cheers.

    1. https://docs.unity3d.com/Packages/c...ndering_ProbeReferenceVolume_lightingScenario
     
  14. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    You probably need to enable it in the HDRP asset, by default it's disabled
     
  15. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    121
    First of all, APV is a great feature, and really deserves praise. One small Issue I have with it is to do with baking, as in interiors, artefacts are common without high probe samples (lightmapping settings). The issue is that with high light probe samples, comes high baking times, not unreasonable per se, just much higher. With large worlds, baking exterior, low detail probes with high samples is an incredibly painful process. Two necessary improvements include a way to split large, multi scene bakes into smaller jobs, for example, baking a certain number of cells at a time, or baking scene by scene in a baking set. The second improvement would be to give probe volume specific sample counts, to allow for lower detail probes to be baked at different fidelities.
     
    PutridEx likes this.
  16. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    121

    To be honest, shifting all probes in the scene at once would be a useful feature to have, as with any somewhat large world, it becomes necessary to do origin shifting, which with the current implementation isn't possible. Although, having more settings in general be probe volume-specific is what should be strived for. Ideally, having sets be configured, and stored per volume (perhaps with a global setup for sets like we have right now which can be opted in and out of by each probe volume). This would let us have so much more fine control over everything, for example: a scripted sequence of a door opening in a cave and letting in bright sunlight, we would be able to blend a probe volume specific to that one cave (and only that one), from a dark scenario, to a sunlit one, approximating a Realtime GI in a scaleable way, which would be immensely useful to games with any sort of world altering event which would need some form of GI update. Settings for bake quality, such as sample count also pretty much need to be probe volume specific, if we want any hope of being able to use APV for large worlds, without crippling bake times. Effectively, as much stuff as possible that can be moved out of the scene itself, and into components, makes the system much, much more usable and versatile. This along with LODs for probe volumes (No idea exactly how that would work), and the ability to progressively bake only a few cells of probes at a time (Obviously baking a whole game world to see what a point light does is a questionable workflow), for iteration, would make APV a genuine contender for a real, flexible GI system in unity, one we so desperately need.

    The good news is, most of the groundwork and technology is already in place, APV is pretty great technology wise. Light leaking, quality, and other technical aspects are absolutely good enough already, It just desperately, and I mean desperately, needs some more usability features. I know changes like this, specifically the one about moving away from scene data, are complicated, but please, better do it now, then let APV be abandoned in the future, when a newer, more versatile system is needed.

    If anyone else agrees with me, or has ideas for a better way to do the things I've outlined here, I advise you post about it, to let unity know what still needs doing.

    Also C# light baking API looks pretty cool. Thanks for working on that.

    I also apologize for the overly long post.
     
    ontrigger, YuriyPopov and BOXOPHOBIC like this.
  17. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    508
    I agree 100% with you. As I mentioned somewhere above, APV should be decoupled from the scene, and just be a regular component holding the light probes which are saved to disk, similar to reflection probes. They could be moved around, scaled, added to prefabs, etc. The light scenario could be on the volume itself, so you can blend between different lighting locally. So basically, make it modular and scalable.
     
    DragonmoN likes this.
  18. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    976
    Sorry if this has been asked already, but does APV not work with shadows?

    Notice the sphere here, which is using probe volumes:
    https://gyazo.com/f6667e81b9c0b3e27d332065faa682c8

    When the furthest shadow cascade goes out of view, the sphere will appear lit, even though it's sitting among probes that are not lit.





    This does not happen when using standard light probes.
     
    Last edited: May 25, 2023
  19. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    I working on a project in which levels are loaded in additively. The current setup for APVs is that scenes can only be assigned to one set and only on Probe Volume can be loaded at a time. This requires all the scenes in the game to be in the same set and baked at the same time. However, this has proven to be futile because it fails to bake when all the scenes are loaded. Does this mean that APVs cannot be used in a game in which scenes are loaded additively?
     
  20. Brindelmold

    Brindelmold

    Joined:
    Apr 28, 2018
    Posts:
    8
    I did indeed miss it, and it's now working! Hurrah.

    I am having a problem trying to swap the lightmaps in editor from code - I haven't tested at runtime yet. I'm trying to automatically change my lighting and rebake, saving out my lightmaps and swapping the lighting scenario.
    Code (CSharp):
    1.  
    2. string toActivate_lightingScenarioKey = "T" + index;
    3. ProbeReferenceVolume.instance.BlendLightingScenario(toActivate_lightingScenarioKey, 0.5f);
    4.  
    Each of my lighting scenarios is named T0, etc. I'm pretty sure it's meant to be called in the instance - Currently I have to manually swap the lighting scenario otherwise it just overwrites the currently selected.

    Similarly - is this how you call it for changing scenarios in game? I was pretty sure this was how to do it but apparently not!

    Documentation read linked from:
    https://forum.unity.com/threads/ada...r-hdrp-in-2021-2.1238824/page-10#post-8945400

    EDIT It's me, I'm a dumbass. Was using BlendLightingScenario rather than setting lightingScenario. I had the power all along.
     
    Last edited: May 30, 2023
  21. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    Hello, you can already split the baking in multiple steps currently by checking only some of the scenes in the Probe Volume tab of the lighting window. This is only possible on 23.1 and above though.
    Improvements such as splitting the bake per cell, or locally overriding the sample count are things we want to do but it's not clear when we'll have time
     
  22. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    This is all very good feedback, some of it is in progress, others we are trying to figure out how to do them but we understand the needs
     
  23. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    If you bake your scene with sun set as mixed, direct lighting on objects will not use baked probes, so hdrp will still use the shadowmap for direct sun light
     
  24. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    You can untick the bake check box (on the right of the image) on some scenes to not bake the lighting for those
    upload_2023-5-30_16-18-2.png

    They will still contribute to lighting so it will be correct, but that way you can reduce the amount of probes computed during a bake
     
    teutonicus and pbritton like this.
  25. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Just an FYI, I have heard this before even with the old probes and mixed directional light. However in URP, like so many other things in advertised Unity, it simply never worked. Meaning manually having to change all objects that are hit by the direct light to lightmap, and all others to light probe.
    There are so many things that simply don't work in Unity the way we are told they will. All of these things could be caught and corrected if Unity was forced to use its own tools to make a full feature game. Since that isn't happening, likely ever, I've just lost all hope in the Engine. I would try to fix the bugs myself, but alas, the source code is not shared to meager indy devs.
     
    rhodnius likes this.
  26. The64thGamer_

    The64thGamer_

    Joined:
    Aug 4, 2019
    Posts:
    14
    Is this true? I attempted to use it but didn't get any output from my AVP probes. Haven't found any documentation showing this is true either. It would be really amazing to get if it isn't implemented yet.
     
  27. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    If you think you found a bug please file a bug report
    Otherwise all HDRP and APV code are open source here https://github.com/Unity-Technologies/Graphics
     
  28. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    Yes it's true, it landed in 2022.2 and above
     
  29. Brindelmold

    Brindelmold

    Joined:
    Apr 28, 2018
    Posts:
    8
    Currently using the probes. In strongly lit scenarios, or near light sources, they work excellently.

    Where the light is more sparse though, they can end up getting a little bit weird: I've been getting a blotchy look in darker areas (using auto-exposure -4 to 6), but also in comparatively dark areas: in the daylight version of the scene, Bright.PNG CaptureBright-WithProbes.PNG Capture-Dark.PNG CaptureDark_Weird.PNG CaptureDark_WithProbes.PNG
     
  30. Brindelmold

    Brindelmold

    Joined:
    Apr 28, 2018
    Posts:
    8
    I've attached a couple more here to finish out the set: Capture-NoProbes.PNG Capture-WithProbes.PNG NoLightForTextureReference.PNG Splotchy-Bright.PNG . I'm not entirely sure what's happening here - I had similar problems with lightmaps when I turned up Indirect modifiers, but it's a very strange issue.
     
  31. The64thGamer_

    The64thGamer_

    Joined:
    Aug 4, 2019
    Posts:
    14
    I have the output of the Baked GI shader going directly to the right sphere, but its only showing up as this weird blue hue that doesn't change when moved around, and doesn't reflect something affected by probes like the left sphere. I've messed around with it for hours but no settings or material changes is showing that APV data is actually being output here.

     
  32. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    121
    It has to do with the light probe samples multiplier in your lighting settings, just bump it up to something like 16. (For some reason, this important detail is not documented anywhere?)
     
  33. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Hello, i have a large scene

    i set all meshes as static and created new probe volume and pressed generate lighting from probe settings
    it doesn’t bake at all, just stuck on 0% or keep increases time at 50%

    i want to bake APV and use them instead of baking light map with it, is it possible?
     
  34. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    I have the issue a ton. It will sometimes, very rarely and randomly work. Most of the time it just freezes.
     
  35. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    So how do you solve it, keep canceling and baking again? Or restart unity and bake again

    i think there is a stable unity version for apv

    Right now im using 2022.3.0 lts

    can any unity staff reply us please?
     
  36. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    It can be very slow if you have a lot of probes. First please make sure all you rendrers are set to receive gi from probes and not ligtmaps, then try reducing the number of probes or the sample count from the lighting pannel
     
  37. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    121
    I've found probe volumes to be much more stable in 2023.1, despite the editor being much less stable.
     
    Skokon likes this.
  38. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Thank you, can you tell us which unity version is most stable for apv?
     
  39. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    I tried 2023.2

    but its stuck on importing, no idea why is this happening
     
  40. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    Try increasing the probe distance.
     
  41. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    These are all great for reducing bake time, but that's not the problem. The problem is it just gets stuck imid-bake and stops. If I check my OS profiler, I can see it isn't using any resources and indeed requires a force quit. This shouldn't happen. Long bake times I can deal with. That's not the issue here.
     
  42. pbritton

    pbritton

    Joined:
    Nov 14, 2016
    Posts:
    159
    Starting with with lower bake times and moving to higher will give you an idea of the threshold when it becomes unresponsive. In addition to that, you would at least be able to verify that you can bake at the lower quality which would give you the clarity that it is setup and working. If for unknown reasons, you can't bake at the lower quality then there maybe other issues.
     
    bnmguy likes this.
  43. Stepan_33

    Stepan_33

    Joined:
    Nov 21, 2022
    Posts:
    26
    Can someone tell me how to use the API in a standard unity project, and what kind of rendering pipeline is needed, I have no idea, I installed unity 2023.2.0a17, HOW to enable the API????

    I tried all possible rendering pipelines but I couldn't turn it on API.:(
     
  44. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    Guys, it's seriously mind-blowing!

    using latest version of Unity, 2023.2.0a17

    First things first, the baking process in this version is ridiculously fast, I haven't had a single freeze during my entire time using it, not like the past versions (2022 lts)

    Now, here's the real game-changer. APV is a lifesaver for handling those massive scenes. I used to struggle with light baking on my RTX 3070, taking ages to get it done. But with APV, I finished baking in less than 10 minutes! It used to take me a whopping 17 hours! and it doesn't even complete it

    APV doesn't even need UVs! No more worrying about creating and unwrapping complex UV layouts

    Sure, there are some occasional light leaks, but don't sweat it. They're totally fixable.

    So, to sum it up, Unity 2023.2.0a17, with APV on board, has blown my mind. The speed, stability, and ability to handle large scenes are beyond what I expected. I'm telling you, this version is going to level up our projects and make development a breeze.

    I just had to share this excitement with all of you. Take my advice and dive into Unity 2023.2.0a17.

    Cheers.
     
  45. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    I know the latest alpha release enables setting SH sampling per pixel, per vertex, or mixed (which does L0 and L1 per pixel and blends L2 per vertex). The support was added to the URP shaders, but I don't see them enabled in Shader Graph shaders yet. Can I just manually set the keyword on those? Eg. EVALUATE_SH_VERTEX or EVALUATE_SH_MIXED? And could we theoretically change these settings per material/shader rather than project-wide?
     
    Last edited: Jun 7, 2023
  46. echu33

    echu33

    Joined:
    Oct 30, 2020
    Posts:
    62
    I've encounter constantly crash when baking a scene with probe volume set to "Scene", seems like a out of memory excetion.(test in both Unity 2023.1 beta and 2023.2 alpha). I'm using URP.

    The scene contains lots of meshes from several building structures.

    It seems like I can by pass the out of memory issue by setting the probe volume into "Local", then manually define the probe volume size.
     
  47. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    You can set it as manual and press fit to scene
     
    echu33 likes this.
  48. Skokon

    Skokon

    Joined:
    Jul 23, 2017
    Posts:
    74
    @adrien-de-tocqueville i found a bug in unity 2023.2.0a17

    If you close the scene view and restart unity then you go to the probe volume tab it says probe volumes aren't activated
     
  49. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    Indeed it doesn't work on ShaderGraphs, thanks for reporting we will fix that
    Regarding enabling it per material, currently it's not possible because the keyword get stripped during the build process, but i asked the URP team to evaluate it as it could make sense
     
  50. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    266
    Yes i believe that's a more general SRP issue. the SRP is not initialized until rendering happens :(
    But just openning back the scene/game view should initialize everything correctly
     
    Skokon likes this.