Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

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

  1. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    118
    Any ETA when Dynamic APV comes? And is it comes to 2023.3?
     
  2. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    Unfortunately no, it's very unlikely that it will come for 23.3
     
  3. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    wait, is APV going to be dynamic? as in dynamic realtime re-lighting?
     
  4. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    This is something that we showcased at GDC this year during the APV talk at the very end
    It's support GI from dynamic lighting in static environments, so it's not full GI
     
    DragonmoN likes this.
  5. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    118
    Sadge. But if it can interact with dynamic models (such as character), it will solve so many headaches with various GI solutions
     
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    Ah. . . you mean the automatic lighting scenario blending part? i thought it going to be full dynamic GI
     
  7. Genebris

    Genebris

    Joined:
    Mar 18, 2013
    Posts:
    107
    Where does it say "automatic scenario blending"? It is dynamic GI where light can move but environment can not.
     
  8. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    Not sure where, either in this thread or in twitter. It was a day after the talk, Someone from the HDRP team explain that it's basically the scenario blending can be automatically connected to Sun Light Direction, it still a precomputed GI but we don't have to deal with scenario blending manually.
     
  9. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    118
    I don't see any others solutions than storing lightmap data and blend it in runtime, it's even more convenient with light probes and with native Unity UI it will make it even better
     
  10. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    577
  11. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    48
    Is this a bug right?.

    upload_2023-9-14_17-0-21.png

    My shadow Max Distance is short 15, using one cascade count.

    I'm using Lighting Mode = Shadow Mask.

    So dynamic objects follow this rule: "Baked shadows from static GameObjects using Light Probes, beyond the Shadow Distance."

    With classic light probes, everything is right, but using AVP the direct lighting is hitting directly, not taking into account the light probes.

    Regards
    Eduardo
     
  12. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    132
    It depends on your settings. What is the geometry bias you have set? Are you using view bias? Please provide us with your setup.
     
  13. muzaffermertaksu

    muzaffermertaksu

    Joined:
    Oct 26, 2018
    Posts:
    2
    Hi. I am unable to bake any scenes with probe volumes. I tried with 22lts-23lts-23.1 versions. I checked all tutorials available. Tried many scenarios. It says it's baking but nothing happens afterwards. What i am missing?
     
  14. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    48
    Be sure that you turn on the effect in the HDRP Global Settings

    upload_2023-9-15_8-2-38.png
     
  15. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    48
    Check different values and nothing. I think that it's not a parameters issue.


    upload_2023-9-15_8-3-8.png
     
  16. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    Shadow mask is not supported with APV. It is not the right solution to the problem as you need to have pretty high res data for shadows mask to work correctly
    Instead the recommended way is to use a long range for the last cascade of the shadow map.
    Using cached shadow maps may help regarding the performance, especially because you can set different update frequency for each cascade (eg. close cascades are every frame, far cascades are every few frames).

    More info in the doc: https://docs.unity3d.com/Packages/c...anual/Shadows-in-HDRP.html#shadow-update-mode
     
  17. eduroam

    eduroam

    Joined:
    Jul 2, 2015
    Posts:
    48
    Thanks for the reply. I will test what you mentioned.

    But actually, the Shadow Masks with short distance shadow + lightmaps have been working very well even in low-end hardware devices.

    Regards.
     
  18. idontcareforunity

    idontcareforunity

    Joined:
    Feb 21, 2019
    Posts:
    3
    I want some meshes not to be lit by probe volumes or reduce the effect of probe volumes.
    Is there any way to change the effect of probe volumes depending on the layers or meshes?
     
  19. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
  20. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    62
    Hey,
    Is there a way to avoid APVs in UNITY_SERVER builds? Currently, it's built and deployed to all our servers and also loaded at runtime. We're on 2022 LTS
    Thanks.
     
  21. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    If you have a custom hdrp asset for your server build, you can disable apv so that data is not included in the build
     
  22. idontcareforunity

    idontcareforunity

    Joined:
    Feb 21, 2019
    Posts:
    3
  23. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    80
    Shadowmask support seems like a UI issue, since I assume it relies on the lighmap settings from meshrenderers, which are only enabled for lightmapped objects. Is there any other reason shadowmasks aren't compatible?
     
  24. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    577
    Probably because Shadow masks baked static marked gameobjects and realtime for unmarked. The system may conflict with APV
     
  25. AlejandroDaJ

    AlejandroDaJ

    Joined:
    May 30, 2014
    Posts:
    5
    I'm also really curious about his point 1. I'm getting similar errors with a much smaller and more modest terrain, 4km x 4km. I've found I can mitigate it somewhat by strategically lowering the number of, say, trees that have Contribute GI/Light Probes turned on... but if I have to do that, then APV's don't actually decouple light complexity from scene complexity, do they?
     
  26. Kabinet13

    Kabinet13

    Joined:
    Jun 13, 2019
    Posts:
    80
    They do decouple the lighting from scene complexity, but there's no real way to decouple the baking process from scene complexity unfortunately. One of the biggest things APV is in need of right now is a proper incremental bake system. The workaround for now is to split your terrain into many smaller terrain pieces in many different scenes, and then bake each scene one by one in a baking set. This setup does let your iterate while only baking part of the scene, but way better tooling for this is needed.

    (Ideally a bake by cell system)
     
  27. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    Hello, first a good news: improvements to virtual offset have landed in 23.2.0b11 (available very soon i guess)
    Previously the system was using physics raycast on colliders to detect intersections, while it's now relying on raytracing which is both more precise and faster (and it doesn't need raytracing compatible hardware).
    I hope it's gonna help with some of the problems you encountered, please share feedback if you have any!

    Regarding issues with large terrain. Indeed as Kabinet13 said the decoupling is at runtime, baking currently requires all scene to be loaded.
    I am currently working on making a bake by cell system, i'll update here once it's done :)
     
  28. bossa_quick

    bossa_quick

    Joined:
    Feb 5, 2020
    Posts:
    4
    Surely the actual baking part of APV has to have some knowledge of the format and is written into editor source code somewhere? Else would this imply you could build a runtime lightmapper?
     
  29. teutonicus

    teutonicus

    Joined:
    Jul 4, 2012
    Posts:
    67
    Thank you for sharing!
     
  30. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    APV uses
    UnityEditor.Experimental.Lightmapping.SetAdditionalBakedProbes
    , but this API dates from before APV, so technically APV doesn't require any editor source code change
    But the new baking system i talked about in the previous message will not use this API anymore, so there may be some possibilities for runtime fun
     
    Kabinet13 likes this.
  31. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,127
    Great stuff, I look forward to testing it. Been a while since I opened unity, gonna be fun testing again.
    Hopefully it makes a noticeable difference in reducing light leaks and detecting things correctly.
     
    HIBIKI_entertainment likes this.
  32. Oblord

    Oblord

    Joined:
    May 7, 2015
    Posts:
    4
    Is there a code reference for APV blending to mimic real-time GI?
     
    wilgieseler and Jack_Martison like this.
  33. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    Oblord likes this.
  34. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,785
    I still don't understand why Sky Occlusion still not implemented and still under consideration, it should fix this kind of issue isn't
     
    ontrigger likes this.
  35. GTA_6

    GTA_6

    Joined:
    Jun 19, 2023
    Posts:
    10
    Hey! Will this feature "HDRP Streaming Data from Disk", make it possible to bake very large scenes? My graphics card always runs out of memory and unity would crash, does this directly store baked data onto disk?
     
    rsklnkv likes this.
  36. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    62
    Hey,

    We're on 2022.3.5 and I just found that this 2 lines takes 5ms:
    m_ToBeLoadedCells.QuickSort();
    m_LoadedCells.QuickSort();

    If I comment them out, I'm getting 5ms back and everything seems to work fine.
    Why those arrays need to be sorted?
    Is it fine to disable sorting?
    Is there a chance that you'll add option to disable sorting in an upcoming 2022 lts patch release?
     
    Last edited: Oct 9, 2023
  37. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    When you have to many cells to fit in memory, they are sorted by distance to the camera so that only the closest ones are loaded.
    This was optimized in 2023 versions but not backported, i'll see if we can do something if it doesn't require too much changes.
     
  38. rsklnkv

    rsklnkv

    Joined:
    Sep 8, 2012
    Posts:
    62
    I wonder why sorting code can take THAT much, I mean 5ms in unacceptable.
    And we're placing probe volumes only in important places, they are not covering a whole map
     
  39. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,034
    Are you always using quick-sort ?
    I'm guessing this collections are almost sorted right ? - should you not use different algorithm for this ?
     
    rsklnkv likes this.
  40. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    I must admit that 5ms is weird, and we are sorting cells, not probes so that would mean you have a huge ammount of them
    But it's not necessary to sort the whole list every frame so i'd rather investigate that than optimizing the sort itself
     
    rsklnkv likes this.
  41. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,127
    I tried the new virtual offset, and to be completely honest, didn't notice a big difference in terms of light leaking or accurate virtual offset differences.

    But I couldn't properly test it with the APV debugger and virtual offset debugger because the latest alpha is all sorts of broken with invisible UIs.

    I'll give it a try again for sure, once the editor UI thing is sorted
     
  42. wechat_os_Qy09rqS0abUEO5YlB08Uz3TEI

    wechat_os_Qy09rqS0abUEO5YlB08Uz3TEI

    Joined:
    Dec 18, 2018
    Posts:
    1
    Does URP 15 not support APV switching? I tried to call the mixed method, but the editor gave me this error message. If yes, I'd like to know what the correct code case looks like.
    Code (CSharp):
    1. public class APVSwitch : MonoBehaviour
    2. {
    3.     const string scenario1 = "Day";
    4.     const string scenario2 = "Night";
    5.     // Start is called before the first frame update
    6.     void Update()
    7.     {
    8.         if (Application.isPlaying && ProbeReferenceVolume.instance.isInitialized)
    9.         {
    10.             ProbeReferenceVolume.instance.SetNumberOfCellsLoadedPerFrame(100);
    11.             ProbeReferenceVolume.instance.lightingScenario = scenario1;
    12.             ProbeReferenceVolume.instance.BlendLightingScenario(scenario2, 0.5f);
    13.         }
    14.     }
    15.  
    16. }
    upload_2023-10-20_19-27-49.png
     

    Attached Files:

  43. JackyMooc

    JackyMooc

    Joined:
    May 18, 2022
    Posts:
    1
    Any ETA for scenario blending landing in URP?
     
  44. wilgieseler

    wilgieseler

    Joined:
    Oct 17, 2013
    Posts:
    75
    Can someone clarify which lightmapping settings apply to APVs? For example, is "Max Bounces" respected? Obviously the Lightmap Resolution and such isn't relevant.

    Also, it seems like it could enable a lot of functionality if there was a way to have a "Lighting Scenario Override Volume". For example, you could have a Day and Night scenario. And then within that you could specify for a particular room in a larger open-world game I want a Lights On and Lights Off scenario that simply overrides a particular brick or whatever. That would end up being four possible scenarios but you would only have to bake the delta of a small area. Or maybe the planned precomputed-realtime solution would serve the same purpose? Naively it seems like something like this would be relatively straightforward to implement.
     
    AlejandroDaJ and Kabinet13 like this.
  45. Neonage

    Neonage

    Joined:
    May 22, 2020
    Posts:
    239
    Can't bake APV in URP on integrated Vega 7 graphics (R5 4600G), in a basic scene - driver instantly crashes (tried in 2023.1.13 and 2023.3.0a10)
     
  46. wilgieseler

    wilgieseler

    Joined:
    Oct 17, 2013
    Posts:
    75
    I could use some help trying to debug something I'm seeing. I have two scenes that use APVs with the same settings, same set of prefabs, same lights, skybox, etc. However, one scene has very "splotchy" lighting and the probe debugger seems to show the probes themselves are unevenly colored. What could cause this?

    Scene A (bad result) Screenshot 2023-11-04 at 12.00.22 AM.png Screenshot 2023-11-04 at 12.00.35 AM.png

    Scene B (good result)
    Screenshot 2023-11-04 at 12.02.26 AM.png Screenshot 2023-11-04 at 12.02.41 AM.png
     
  47. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    577

    If it's the same project different scene names but different results, see if flipping the bake order changes too.

    Equally you can also see if creating a new scene (but the same) is different or expected again.

    The results may indicate something project or scene specific
     
  48. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    it's available starting from 2023.3.0a11 on URP
     
  49. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    Maybe those two scenes have different sample count in the scene tab of the lighting window
     
  50. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    204
    The relevant settings are obviously the one related to sample count, max bounces is also used, and although the name is not very intuitive "lightmap resolution" is also used for the meta pass (as the tooltip says, it drives the resolution of albedo and emission textures using during baking)
     
    wilgieseler likes this.