VRwithAndrew / VR-XRSceneLoader

Template project for XR Scene Loader series.
MIT License
12 stars 3 forks source link

ScreenFader throws an error on Metal #1

Open skibitsky opened 4 years ago

skibitsky commented 4 years ago

Hey,

Your ScreenFader shader returns the following error when running on Metal, which is the default option in Unity Editor for macOS:

Metal: Error creating pipeline state (Custom/ScreenFade): fragment shader color output does not have enough components for the pixel format (MTLPixelFormatBGRA8Unorm_sRGB)
(null)

It can be fixed by changing frag function to this:

fixed4 frag(VertexToFragment i) : SV_Target
{
    fixed4 color = tex2D(_MainTex, i.uv);
    fixed4 lerpedColor = lerp(color.rgba, _FadeColor.rgba, _Intensity);
    return lerpedColor;
}
skibitsky commented 4 years ago

Also shader doesn't work on Oculus Quest in Single Pass rendering.

Fixed version: https://gist.github.com/skibitsky/21de9a2d4187e263b02d20d63de0d646