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.

[RELEASED] Impostors - Runtime Optimization

Discussion in 'Assets and Asset Store' started by MUGIK, Oct 11, 2019.

?

What dependencies you are ok with using in your project?

  1. Unity 2019.4+

    42 vote(s)
    82.4%
  2. Jobs (+ Collection and Mathematics)

    42 vote(s)
    82.4%
  3. Burst (+ Mathematics)

    43 vote(s)
    84.3%
Multiple votes are allowed.
  1. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    30
    I see in the description of the Impostors asset this information:
    "- For now, Impostors work only with no moving objects."
    Does it mean that it is not possible to move objects with ImpostorLODGroup to any new position? The periodical updates of player (and the whole world) to position (0,0,0) should happen very rarely so it would be nice to have exposed any function to reevaluate positions of all impostors (on demand, when it is needed).
     
  2. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Currently, there are no such plans just because you are the first and the only one requesting this integration. I don't want to sound rude but that's not enough to spend development time on this while there are other more important improvements. Also, ECS is still an experimental package.

    The core of the Impostors package is the DOTS part of the code where all calculation and mesh generation occurs. MonoBehaviour part is only a wrapper to conveniently configure and transfer required data to the system. If you are willing to I could help you with some tips for writing your own adaptation of the Impostors package that fits your needs.

    One more thing to consider, Impostors work in conjunction with unity's LODGroup component and I don't know if there is a replacement for that functionality in ECS. LODGroup is responsible for rendering and culling objects before they turn into impostors, so maybe you will also need to implement this part.

    I don't know your full situation, there might be some other gotchas. If you are interested we could discuss this further in PM.
     
  3. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Ahh sorry, that's outdated statement in the documentation.
    On ImpostorLODGroup there is a setting called IsStatic. If you turn this off then system will update the position every frame. Try this first to verify that it works with World Streamer 2
     
  4. arczi79

    arczi79

    Joined:
    May 10, 2021
    Posts:
    30
    It works.... I am only a little confused with that part: "system will update the position every frame". Is there any better way to handle that? Probably I will need to update position every few minutes (in a worse scenario, at best maybe only a few times in the scene/level) so the update every frame sounds like big overkill for my "scenario".
     
  5. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Got you.
    You could try to call ImpostorLODGroup.UpdateSettings() on all active impostors. But this could be quite expensive if you have more than 1000 objects.

    I will look for a more optimal way of doing this.
     
  6. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    17
    hello.
    I am using Imposters v1.0.5 and Unity 2021.3.6 URP.

    Imposters not working when
    Code (CSharp):
    1. ImposterRenderingType == Scheduled
    in UniversalRenderPipelineProxy.cs

    MainCameraImposter.jpg

    But when I set
    Code (CSharp):
    1. ImposterRenderingType == Immediately
    it works fine.

    Can only Immediately be used in URP?
     
  7. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Hi
    Scheduled should work fine in URP.
    Make sure that you use UpdateImpostorsTexturesFeature from the appropriate Renderer Data
     
  8. ysundawa

    ysundawa

    Joined:
    Mar 2, 2020
    Posts:
    29
    Hello,

    I got some compiling error with 2020.3.34f1.
    please let me know where to start digging to fix this error?

    Thanks...

    upload_2022-7-23_6-33-52.png
     
  9. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Hello
    Let me guess, you updated Impostors to the latest version? If so, then this is what caused the compilation error because of legacy scripts that should be deleted. You can delete these scripts.

    Or, you can reinstall the Impostors package completely. To do so just delete Impostors folder from the project view. You will get a lot of compilation errors, but that's ok. Then just import the latest version of Impostors package. All references to scripts should remain and after this step your project should function properly.
    Strongly recommend backup your project before this process, just in case something went wrong.
     
  10. AnotherWorldCo

    AnotherWorldCo

    Joined:
    May 31, 2018
    Posts:
    2
    Hi. Can i apply anti-aliasing to an impostor? (URP, MSAA, Oculus Quest 2)
     
  11. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    What do you mean by that? MSAA applies globally to everything rendered by the camera, including impostors.
     
  12. AnotherWorldCo

    AnotherWorldCo

    Joined:
    May 31, 2018
    Posts:
    2
    But the impostor edges and inside the texture is very aliased compared to 3d object. Is it expected behavior? upload_2022-8-4_21-25-9.png upload_2022-8-4_21-26-25.png
     
  13. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    Yes. Impostors are meant to be used at a distance, where such details won't be noticeable.
     
  14. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    142
    I recently updated Impostors and now there's a notice about Graphics Jobs enabled makes a bug in impostors. I was wondering what bug is this?

    Also, I am finding that the Metal bug that I posted about a long time ago maybe has something to do with the system incorrectly rendering impostors swapped with each other.

    For example, I have two impostors: Streetlamp and Car.

    Sometimes, I will see the Car impostor flicker where the Streetlamp would be. This leads me to think the flickering is due to using multiple impostors and the system incorrectly assigning the positions for rendering.
     
  15. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    384
    For some reason enabled Graphics Jobs setting messes up shader variables related to lightning and impostors are rendered without lightning in the build. This does not happen in the editor.

    I read again our previous conversation, and I realize that the problem might be with the impostor shader. It does a lot in the vertex shader where this flickering might occur due to floating precision or platform-specific data conversion.
    I would highly appreciate some video of the flickering when camera doesn't change position and only rotates. You can send it in DM if you wish to.
     
    sameng likes this.
unityunity