Search Unity

[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+

    77 vote(s)
    84.6%
  2. Jobs (+ Collection and Mathematics)

    78 vote(s)
    85.7%
  3. Burst (+ Mathematics)

    79 vote(s)
    86.8%
Multiple votes are allowed.
  1. JamesKalin

    JamesKalin

    Joined:
    Aug 27, 2014
    Posts:
    7
    I'm not a Unity expert so installing Impostors and then configuring everything to work with URP is not something I know how to do. Perhaps you have a video or written instructions for how to install Impostors and configure URP for Unity 2021.3.12f1? I will much appreciate your help with this!
     
  2. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi
    There is a guide in the documentation on how to setup Impostors for URP:
    https://docs.google.com/document/d/...ZOhYBylGPXxyEgcDY/edit#heading=h.33jglbxuxwpz

    Let me know if you have issues with it.
     
  3. JamesKalin

    JamesKalin

    Joined:
    Aug 27, 2014
    Posts:
    7
    Thanks! I think I did the setup correctly, with the only difference being I couldn't find the ForwardRender file so used High Fidelity_PipelineAsset_ForwardRenderer instead. I checked and the Main Camera Impostors "Camera Impostors Manager (Script)" already had the Render Pipeline Proxy as "Main Camera Impostors (Universal Render Pipeline Proxy). I trust this will work.
     
    MUGIK likes this.
  4. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Hi,
    The asset looks very promising:
    1. does it support game objects that have multiple children with their own meshes ?
    2. does it support generating an imposter for a faraway unity terrain ?

    Thanks
     
  5. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi
    Yes, it works similarly to Unity's LODGroup

    No, terrain cannot be converted into imposter
     
    Ali_V_Quest likes this.
  6. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    Thanks Mugik,

    i really love it, glad that i purchased it!
    it seems to work really well, even on deffered, super fast.

    as it will be an important part of my current tech stack, i have many detail questions (which i was not able to find myself in documentation or at first glance in your code).

    do you prefer me to write them here in the thread (numbered bullet points) or rather have me contact you privately, e.g. via forum direction message, or email adress or ... ?

    greetings from switzerland :)
     
  7. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Glad to hear that!

    Up to you. Most likely I will need to see some gameplay footage to better understand your situation. Both direct messages and emails are fine.
     
  8. roc_hgh

    roc_hgh

    Joined:
    Dec 7, 2022
    Posts:
    2
    there is somthing wrong on mac/ios platform,it looks like the UV of the texture is error,the mac and the iphone have the same problem, but windows and android devices is ok。
    20221207130647.png
    impostors version:1.0.6
    unity3d version:2021.3.15f1
    platform mac/ios
     
  9. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    built-in or universal render pipeline?
     
  10. roc_hgh

    roc_hgh

    Joined:
    Dec 7, 2022
    Posts:
    2
    universal render pipeline 12.1.7
     
  11. tricos

    tricos

    Joined:
    Jun 29, 2019
    Posts:
    1
    Can you please implement multi-object editing?
    There seems to be no way to select multiple objects (i.e. all trees in the scene). The thing I'd like to do is change the impostor overrides - having at least that option for multiple objects would be preferable.
     
  12. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    ImpostorLODGroup aims to replicate the behavior of unity's LODGroup component. What is possible with LODGroup should be possible with ImpostorLODGroup.

    What do you mean by "impostor overrides"?
     
  13. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    Tricos, some tips: have all trees in your scene as prefabs, then change what you need on the original prefab to modify the whole scene.

    then lets asume you have a real game scene with 20 tree prefabs, rendered as hundreds of trees.
    then do not ENTER the prefab in unity editor, to edit that 1 prefab, but select it, in fact multiselect (shift+left click) multiple prefabs, and then all components that are identical of type should be multiple editable.

    this does not work for you with ImpostorLODGroup?
     
    MUGIK likes this.
  14. bananadev_

    bananadev_

    Joined:
    Nov 6, 2018
    Posts:
    7
    Hey, is it possible to add fog support, (I'm using different coloured fog in my game and it ruins the illusion of imposters in URP)
     
  15. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi
    Impostors should work with the default unity fog.
    In case you are using a custom fog solution, then you need to adapt Impostors' shader to support it.
    Shaders are stored inside
    Impostors/Runtime/Resources/Shaders
    folder.
     
  16. TheST4R

    TheST4R

    Joined:
    Apr 22, 2019
    Posts:
    4
    My project is a URP 2021.3.0f1, would i be able to use it?
     
  17. MagiJedi

    MagiJedi

    Joined:
    Apr 17, 2020
    Posts:
    32
    Hello,

    I've gone through the directions, but I'm getting stuck at the Update Imposters Texture Feature part. As you can see, it's added and enabled, but it doesn't show when expanding the ForwardRenderer I'm using or using the picker window.

    This is on 2022.2.2.

    upload_2023-1-18_11-19-46.png
     
  18. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Try pressing Ctrl+S. This helps for me
     
    MagiJedi likes this.
  19. MagiJedi

    MagiJedi

    Joined:
    Apr 17, 2020
    Posts:
    32
    Hello. Wonderful asset! I'd like to add a +1 for Entities support - Entities Graphics in particular. Thanks!
     
    MUGIK likes this.
  20. Fanttum

    Fanttum

    Joined:
    May 18, 2014
    Posts:
    40
    I just got your asset to help optimize a scene however I've run into some issues with some custom shaders.
    Been using Unity jp's toon shader, which you can find documentation here, and when testing the imposters using the shader it seems just to make the whole imposter a solid color. Which I've found out to be the outline, even if the outline is turned off. Not quite sure how either works yet, but am at a dead end trying to find a workaround.
    Here is a gif of a test where I set the outline to a pure white to show the bug in progress.
    ezgif.com-gif-maker.gif
     
  21. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi
    The thing is that Impostors assumes that all shaders have ForwardBase pass at index 0. Most likely shader with outline has outline pass prior to ForwardBase.
    You need to modify ImpostorLODGroup.cs at line ~449:
    Code (CSharp):
    1. builder.AddRenderInstruction(new DrawRendererInstruction(
    2.     renderer,
    3.     sharedMaterials[submeshIndex],
    4.     submeshIndex,
    5.     shaderPass: 0, // the number you need to figure out for your specific shader
    6.     builder.PropertyBlock
    7. ));
    Let me know if this helps
     
    Last edited: Feb 4, 2023
    Fanttum likes this.
  22. Fanttum

    Fanttum

    Joined:
    May 18, 2014
    Posts:
    40
    Thanks! Changed to "shaderPass: 1," and now working as intended.
     
  23. dougj11

    dougj11

    Joined:
    Aug 13, 2020
    Posts:
    1
    Hi, a kind of newbie. I am using URP unity 2021.3... did instructions for URP but had to make new renderer for forward rendering. Got the LOD group set up. getting imposterLODgroup has no assigned renderers. confused by this error.
     
  24. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    I must warn you that it might break using a different shader. All default shaders are using index 0
     
  25. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    You need to specify renderers for both LODGroup and ImpostorLODGroup.
    You can look at the example prefabs for reference:
    upload_2023-2-5_11-57-58.png

    Renderers specified in ImpostorLODGroup don't have to match renderers in Unity's LODGroup. Look at ImpostorLODGroup as an additional level of detail before culling object.
     

    Attached Files:

  26. Hypnotoad0

    Hypnotoad0

    Joined:
    Jun 22, 2013
    Posts:
    47
    Hey. The asset seems great so far. The problem I have with it is that the color is wildly incorrect. The front chair is a mesh and the background one is an imposter. They should have a similar color. What can I do to make the change less jarring?

    This is URP. I'm using a custom shader with combined textures for the chair - maybe that's the problem?

    upload_2023-2-17_15-35-35.png
     
  27. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi. I think the problem is related to lights in your scene, and this is expected behavior. Impostors react only to ambient light and single directional light. Which means they ignore point/spot lights.
    Impostors are meant to be used for distant objects, the most common scenario is rendering distant trees/props/buildings in an outdoor scene. This requires only ambient and directional light to render properly.

    Your scene has a complex light setup that cannot be handled by Impostors. One possible solution is to make chair static and bake lightmap. Impostors package supports baked lightning.
     
    Last edited: Feb 18, 2023
  28. Hypnotoad0

    Hypnotoad0

    Joined:
    Jun 22, 2013
    Posts:
    47
    The lights are all static, there is only ambient lighting and a lightmap, not a single realtime light (because of Quest 2's poor hardware). I would expect the impostor to have the same color as the baked chair it's made from, I don't understand why its grey.

    The chair is just my first attempt at using the asset, I am aware of the limitations of using impostors.

    Great work btw, if I manage to get the colors right, then it's going to be a performance game changer for me
     
  29. getle13

    getle13

    Joined:
    Aug 27, 2022
    Posts:
    1
    Hi I am getting this error.

    Assets\Impostors\Runtime\URP\UpdateImpostorsTexturesFeature.cs(38,17): error CS0012: The type 'RTHandle' is defined in an assembly that is not referenced. You must add a reference to assembly 'Unity.RenderPipelines.Core.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    unity version 2022.2.7f1
    latest URP
     
  30. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi
    Just checked Unity 2022.2.7 and I'm not getting that error. Please, make sure you are installing the latest version of the Impostors package. You can check this through Package Manager window.
    upload_2023-2-23_13-5-14.png

    If you are using the latest version then check that Impostors assembly definition contains a reference to Unity.RenderPipeline.Core.Runtime. Otherwise, add this reference and hit apply at the bottom.
    upload_2023-2-23_13-7-47.png
     
  31. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,466
    I am getting a flashing/blinking on the terrain when my player moves around. I am implementing a basic FPS like movement. I have tested it and it does seem to be coming from the Imposters asset. I am getting a performance boost which is great, but this flashing needs to be eliminated somehow. Any suggestions?
     
  32. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi,
    Let me know your Unity and render pipeline versions.
    Terrain uses default unity shader?
     
  33. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,466
    I am using URP, Unity 2021.3.10 and the material on my terrain is using the URP/Terrain/Lit shader

    Edit: Apparently, baking the lighting fixed it all. I was testing this out in a sample project so i hadn't done that yet.
     
    Last edited: Mar 8, 2023
  34. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Please, choose the Immediate impostors rendering type as a temporary workaround
    upload_2023-3-10_18-53-36.png

    Do you have baked or mixed lights in the scene?
     
  35. KitBarry1809

    KitBarry1809

    Joined:
    Jun 27, 2018
    Posts:
    34
    I have a question: how well do these imposters cope with multiple cameras rendering from the same scene ? Eg, will it handle Tilt-5's multiple player set up where you can have up to 4 people viewing the game on the same computer from different directions. Will these impostors billboard correctly to each player's camera, or only to the main camera and look wonky to the other player cameras ? Can I set which camera they billboard to, or is it only ever the main camera ?
     
  36. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Impostors package supports multiple camera setups out of the box. Generated imposters are unique for each camera/player.
    And currently, system is designed in a way it's just impossible to "reuse" billboard texture for other cameras.
     
  37. ErikSutton

    ErikSutton

    Joined:
    Apr 25, 2019
    Posts:
    6
    Hi! I've recently picked up this package to hopefully gain some framerates on our low-end devices! I'm currently testing this out, and running into the issue of LOD group "Object Size" being modified at the start of runtime. Currently, we are overriding this value (since we're a side scroller and need a very specific cutoff point for the entire group). Is there a way to disable this automatic bounds calculation happening? When I disable the Imposter LOD Group component, it no longer automatically sets this on start at runtime.
     
  38. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi!
    Just repeating my answer from discord:)

    Yes, ImpostorLODGroup, when enables, calls RecalculateBounds() method on unity's LODGroup component to retrieve the exact values that Unity's internal systems use to calculate required LOD index for each camera. I believe you can omit this recalculation call, but you need to be sure that LODGroup component is populated with the right values when ImpostorLODGroup's OnEnable() is called.

    To disable recalculation go to ImpostorLODGroup.cs and comment out line 280
    lodGroup.RecalculateBounds();


    Let me know whether this help
     
    sirleto likes this.
  39. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Hi Mugik,

    I'm responding to your reply to my review on the asset store.

    I'll take a look at splitting up my cities if you think this is a better approach. I was worried the overhead of creating maybe 100 or so Impostor instances may not be as good as a single one, but I'll try when I get to it. I do have an idea on how to fix the ground penetration by pushing the impostor plane vertices towards the camera in the shader for a distance of about half the overall bounding box of the impostor'ed source objects. I've done this for other z-fighting issues with good results.

    I'm not really in a bug fixing/optimization stage, so none of these issues are a big concern at the moment and I rather spend my time elsewhere, but since you asked:

    Regarding the shadows, objects that create a lot of self shadowing change considerably in their look when the impostor switch occurs. It's not that big of a deal, but it's noticeable. Same with objects that leave large ground shadows, esp. large trees. I was hoping at some point to look into making at least the impostor polygon create a ground shadow to minimize the impact.

    The only somewhat truly concerning issue is the behavior when changing to a lower quality level. I'm using the default quality levels except the LOD settings (bias and max level) are the same for all 3. When moving away or around the object at a distance where the impostor is visible, the moment the impostor texture is updated it shows a texture from another impostor instance as I move. For example looking at the same city it switches to a castle or a temple or whatever else is in the scene. This does not happen in High Fidelity mode. I have not spend any time looking into that yet.

    Thanks, and keep up the good work! I've had a billboard system like this in the back of my mind for a while, but I could have never done such a great job with it.
     
  40. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Hi! Thanks for replying!

    ImpostorLODGroup component has a setting called Z Offset that does exactly that. By default it's set to 0.5 which is exactly half of the overall bounding box. But when bounds of the group are too large this can't help much with ground penetration.

    May I know shadow distance you are using?

    Once in a while I receive such complaints but were never able to reproduce this issue. I would be very thankful if you could describe in more detail lower quality level settings you are using. What Unity and RenderPipeline version is used? Does this happen in the impostors_example scene? If you are willing to you can make a repro project as described here.
     
  41. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    The built-in Z Offset does not quite work as required. When I set it to a higher value, which fixes the clipping, the impostor is shrunk considerably and does not match the original size.

    The shadow distance is 30km, I need shadows for the mountains in the distance. My (preliminary) cascade split is 500/2000/4000/12000. Note that I use stacked cameras for near/far rendering.

    Here is a short video to illustrate all the issues, I hope you can access it. This is a temple test which has significant self shadowing due to the architecture. First half of the video the impostor works fine (highest quality setting). At the half point of the video I switch to the lowest quality setting and the impostor freaks out.

    Impostor.mp4

    I'm using Unity 2022.2.11, URP. It does not happen with the example scene. There is a lot going on here, stacked cameras, Enviro 3, MicroSplat, etc. The quality settings are default for this version of Unity. The UpdateImpostorsTexturesFeature has been added to all 3 quality levels.
    I'll play around with it more and if I can make it happen in a test project or if I can find the culprit, I'll let you know.
     
  42. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    Good you mentioned this. The same behavior also should be with the balanced renderer, am I right?
    The thing is that UniversalRenderPipelineProxy needs a reference to UpdateImpostorsTexturesFeature on the currently active UniversalRenderPipelineAsset.
    Unfortunately, URP doesn't provide API to access RenderFeature from the renderer asset, and this is the reason why default implementation of UrpProxy is so naive and assumes that project uses only one renderer.

    In your case, solution would be to implement a custom proxy that derives from RenderPipelineProxyBase class.
    Just copy the entire UniversalRenderPipelineProxy and implement handling of renderPipelineAsset changes.
     
  43. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    Yes, both lower quality levels exhibit the problem. Thanks, I'll let you know when I got a chance to try out your suggestion.
     
    sirleto likes this.
  44. Matthias1231

    Matthias1231

    Joined:
    Aug 20, 2012
    Posts:
    62
    This worked, thank you! :) Hopefully we can find a solution without the reflection hack someday.... SRPLife:rolleyes:
     
    sirleto likes this.
  45. BaoBao55

    BaoBao55

    Joined:
    Apr 8, 2016
    Posts:
    13
    When I use Impostors, there are many weird wrinkle image randomly showing up like this.
    Do you have any suggestions to fix it?
     

    Attached Files:

  46. FaberVi

    FaberVi

    Joined:
    Nov 11, 2014
    Posts:
    146
    With Unity version 2023.1.0f1, I have the following error:

    Assets\Impostors\Runtime\URP\UpdateImpostorsTexturesFeature.cs(38,17): error CS0619: 'ScriptableRenderPass.ConfigureTarget(RenderTargetIdentifier)' is obsolete: 'Use RTHandle for colorAttachment'
     
  47. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
    For some reason, I didn't receive notifications from the forum lately...
    Just want everyone else here to know: BaoBao contacted me on discord and thanks to his issue report I was able to find a bug that was breaking Impostors on Apple devices. Now it is fixed in version 2.0.0 which went live just an hour ago. Once again, a huge thanks to BaoBao and all of you for your feedback.

    I tend not to support non-LTS versions, but this issue seems like easy to fix. Currently installing this version of Unity...
     
  48. AlexeyOA

    AlexeyOA

    Joined:
    Nov 18, 2015
    Posts:
    9
  49. MUGIK

    MUGIK

    Joined:
    Jul 2, 2015
    Posts:
    481
  50. AlexeyOA

    AlexeyOA

    Joined:
    Nov 18, 2015
    Posts:
    9
    Ver. 1.0.3