Dustyroom / flat-kit-doc

Documentation of the Flat Kit asset.
https://flatkit.dustyroom.com
Apache License 2.0
2 stars 1 forks source link

Stylized Surface With Outline renders incorrectly on Android #72

Closed forcepusher closed 2 years ago

forcepusher commented 2 years ago

Describe the bug When using Stylized Surface With Outline shader, the Outline Depth Offset setting is inverted on Android, while using Built-in RP.

To Reproduce Steps to reproduce the behavior:

  1. Import "[Render Pipeline] Built-In".
  2. Open "Mugs - Scene1 - OneColorVariousParameters" scene.
  3. Build for Android and see Mug14 with the outline. Observe that it looks fine. image
  4. Select Mug14 in the Editor and set Outline Depth Offset to 0.01.
  5. Build on Android and see Mug14 outline. Observe that it looks all weird. image

Unity details:

Build platform:

Additional context Adding this script to Mug14 solves the problem, but I'd like a proper fix.

using UnityEngine;

public class OutlineDepthOffsetInverter : MonoBehaviour
{
    private void Awake()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        Renderer renderer = GetComponent<Renderer>();
        var propertyBlock = new MaterialPropertyBlock();
        renderer.GetPropertyBlock(propertyBlock);
        propertyBlock.SetFloat("_OutlineDepthOffset", -propertyBlock.GetFloat("_OutlineDepthOffset"));
        renderer.SetPropertyBlock(propertyBlock);
#endif
    }
}
dustyroom-studio commented 2 years ago

Thanks for reporting this, we will look into it.

dustyroom-studio commented 2 years ago

Hi @forcepusher, this issue should be fixed in Flat Kit 2.6.7 or later. Thanks again for reporting!