Search code examples
c#unity-game-enginehololensmrtk

MRTK Standard Shader - Border Light Shading Off


Question

I am trying to give a colored 3D Cube which has a specific Color a differently colored border for my Hololens 2 application. I now found out that i can use the Mixed Reality Toolkit/Standard Shader with the Border Light option to color the edges of an object in white or black.

When starting Unity and looking in the scene view the cube looks correct:

Cube with white Border Parameters o Shader

Problem

When I start my application, the edges of the cube are incorrect in the scene/game view. The higher I make the border width, the more wrong the border is drawn (see images).

Incorrect border of Cube Incorrect border of Cube (higher width)

I tried to change the size of the cube, but that didn't help. When i restart unity it works again until i press play - then it always gets rendered wrong. I have no idea what setting could be wrong? I assume it has something to do with the camera, but all other parameters of the shader look correct.

I am using Unity 2022.3.8f1 and MRTK 2.8.3.0


Solution

  • As @ZuochengWang-MSFT described, the problem is due to the Unity version I used. In Unity 2022.3.8f1, certain shader functions such as Border Light and Rounded Corner do not work correctly (see image).

    MaterialGallery with wrong shaders

    In the version Unity 2021.3.30.f1 everything works correctly!