Closed daltonbr closed 4 years ago
Just got it to work with GraphicsFormat.R8G8B8A8_SRGB
Don't know if it's the ideal one, although not crashing anymore.
eyeRenderTextureDesc = new RenderTextureDescriptor()
{
dimension = TextureDimension.Tex2D,
width = Screen.width / 2,
height = Screen.height,
depthBufferBits = 16,
volumeDepth = 1,
msaaSamples = 1,
vrUsage = VRTextureUsage.OneEye,
graphicsFormat = GraphicsFormat.R8G8B8A8_SRGB
};
I looped over all supported textures for RenderTextures
private void TestGraphicsFormat()
{
foreach (GraphicsFormat format in (GraphicsFormat[]) Enum.GetValues(typeof(GraphicsFormat)))
{
Debug.Log($"[Test Format] {format:G}: {SystemInfo.IsFormatSupported(format, FormatUsage.Render)}");
}
}
In Unity 2018.4, RenderTextureDescriptor doesn't have this property graphicsFormat
, however, RenderTexture
has a constructor overload with a graphic format parameter.
And in both Unity 2018 and Unity 2019, GraphicsFormat
is under experimental namespace.
So there are 2 approches to fix it:
Also, SystemInfo.GetCompatibleFormat is only available in unity 2019.
Thanks for the detailed info. I will just add preprocessor directives then!
Reopen this ticket, i'm going to do it on my side, it would be an issue when using unity 2019.
It's happening in the Editor for Unity 2019.3.15f1 (on Windows / DX11 and OSX / Metal)
Got this Argument Exception in
CardboardMainCamera.cs
when trying to construct that RenderTexture.I see that the
graphicsFormat
is set toNone
by default, maybe that wasn't a problem in 2018.4. I've tried to set a few other formats in there, but couldn't get it to work.Thanks for this great initiative!