Search Unity

Official Hybrid Renderer V2 (0.4.0)

Discussion in 'Graphics for ECS' started by SebastianAaltonen, Mar 16, 2020.

Thread Status:
Not open for further replies.
  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    881
    Is there any way to debug HR2 culling?

    For some reason, when I am switching from the Graphics.DrawMesh to HR2 rendering half of my planet is culled away on certain altitudes.
    upload_2021-5-17_20-45-26.png

    (As you can see individual quads were culled, the problem is not in camera clipping planes)

    While near the surface everything is ok.
    upload_2021-5-17_20-48-25.png

    It looks like the problem start appearing, when quads are 20-30 thousands units away. And it is always in one direction. In other direction culling works as expected.
    I am using a floating origin, so camera is always around the scene origin.
     
    Last edited: May 17, 2021
  2. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    Do you use real units or a miniature for the planet? KSP uses several cameras and miniatures, Kerbin is only 100 units in Size.
     
  3. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    881
    Solar System and all planets are in real scale in this game and use real units. And for distant objects I use HDRP Custom Passes.
    Using entities and Graphics.DrawMesh worked well so far. The only problem, that you are uploading to GPU a lot of data each frame this way.
     
  4. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    The HRV2 culling is included in the package code, in the file HybridV2Culling.cs. If you make a local copy of the package, you should be able to modify and debug it normally. Something I would try is hardcoding the HRV2 culling to make everything visible, to confirm if that fixes your issue (i.e. make sure the problem is in the HRV2 culling and not something else).
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    881
    I did it and it fixes the issue.
    upload_2021-5-18_13-54-23.png

    Will try to investigate and will let you know.
     
  6. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Please check the file FrustumPlanes.cs for the following line:
    Code (CSharp):
    1. p.Distances[i & 3] = 32786.0f; //float.MaxValue;
    If your version has that line, it is a likely source for your problem. Increasing this value to a large number such as 1e9f should fix the problem if that is the case.
     
  7. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    881
    Yes, that change fixed everything, thank you very much!
    Will this behaviour change in the future versions of HR2? If not it would be great to add this value somewhere to the project settings.
     
    Lukas_Kastern likes this.
  8. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    We have fixed this bug (by using a large value, I'm not sure why the 32k value was there to begin with), but unfortunately the fix landed after the latest release.
     
    iamarugin and Lukas_Kastern like this.
  9. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,135
    Hi everybody,

    We have added a dedicated sub-forum for discussions around graphics related topics in DOTS projects. Please use the new space to discuss the Hybrid Renderer V2 and create new threads where needed. We will be closing this thread for further comments. Thank you all for the lively discussions and feedback over the last year. We're looking forward to see how you will breath life into the new forum.
     
    Shodan0101 and charleshendry like this.
Thread Status:
Not open for further replies.