Search Unity

Bug Apple Silicon M2 - Mesh edit / ProBuilder and Post Processing causes Glow

Discussion in 'macOS' started by Der_Knob, May 31, 2023.

  1. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Hey,

    I'm just hunting down a strange bug, only appearing on M2 (and properly also on M1), but not on any other Platform.

    My setup:
    • LTS 2021.3.2x (tested different versions)
    • Build-In RP
    • Post Processing with Bloom on Camera
    Only on the Apple Silicon hardware and with enabled Bloom, I got a strange behavior with altered meshes.
    There are two ways, I have changed meshes.

    1) ProBuilder
    I have bought assets from the asset store and changed it a little bit with "ProBuilderize". For example the PitStop in my game, I removed the static flags
    2) I use a script to edit the vehicle mesh on runtime - including revert changes

    The result is a "glow" effect. For the ProBuilder model, it is instance. For the vehicle mesh, once it is changed (but it gets more, the more changes I make to it)

    The result looks like this:




    I already removed EVERYTHING from my vehicle except the Mesh - it is definitely coming from the edited mesh. Same for ProBuilder, if I revert to the not edited version, it is fine.

    Anyone any idea?
     
  2. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Hey,
    Am I the only one with that issue?

    Maybe I can create a short POC and share, if that would help? But my main issue is, that I don't have an Apple Silicon Mac myself... so it will take some time.
     
  3. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Ok, I created a POC - or tried.
    New project, adding Post Process package and bloom to the camera. Imported some assets and modified them... but it's not happening.

    Need to dig deeper into it.
     
  4. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Finally I got an Apple Silicon to test.

    The problem also relates somehow to "Ambient occlusion". I got a shader as code and one I got one as Shader Graph. For both, the default value is 1. I found out, that if I set it to 0, it's gone. Not a solution, but is that supposed to be connected?

    Is that a bug, which I should report?
     
    Last edited: Jul 5, 2023
  5. Der_Knob

    Der_Knob

    Joined:
    Feb 5, 2018
    Posts:
    34
    Hey,

    found a solution. Basically, it had two issues.

    #1 Mesh Modification while runtime
    I changed the mesh on collisons (damage to the vehicles). Then I called:

    Code (CSharp):
    1. meshfilters[i].mesh.RecalculateNormals();
    2. meshfilters[i].mesh.RecalculateBounds();
    That was casing the glow over time. For me, it was not important to call any of the functions, so I removed it now. Works for my use case as expected. So I assume, that those internal calculations add something that triggers bloom.

    #2 ProBuilderize
    I used ProBuilderize multiple times, but only one mesh had issues (PitStop). Also the biggest one of those (not sure if that is the problem, the complexity.
    I played around with the "ProBuilderize"-Settings and manged to get it working. But I'm not sure what made it work.


    Maybe that helps someone else...