Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depth of field is broken on Android, iOS, TVOS, Switch #783

Open
NuclearCookie opened this issue Mar 27, 2019 · 10 comments

Comments

Projects
None yet
4 participants
@NuclearCookie
Copy link

commented Mar 27, 2019

What happened?

I create a postprocessing volume with depth of field as shown in the next screenshot

image

On normal targets, the result looks like this:
image

on switch, it looks like this:
image

Post-processing stack version (v1, v2)?

Latest: 2.1.4, 2.1.5
The bug does not appear on 2.1.3

Unity version, operating system, target platform (standalone windows, mac, iOS, PS4...)?

Unity 2018.3.5f, 2018.3.9f, Windows, Targetplatform Switch

@NuclearCookie

This comment has been minimized.

Copy link
Author

commented Mar 27, 2019

The difference seems to be that the switch was previously using

var colorFormat = RenderTextureFormat.DefaultHDR; in DepthOfField.cs
but now it's using
var colorFormat = context.sourceFormat;.

This changes the colorFormat from DefaultHDR to RGB111110Float

@NuclearCookie

This comment has been minimized.

Copy link
Author

commented Mar 27, 2019

The change is caused by this function which does not return DefaultHDR on switch.

/// <summary>
        /// Gets the default HDR render texture format for the current target platform.
        /// </summary>
        public static RenderTextureFormat defaultHDRRenderTextureFormat
        {
            get
            {
#if UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR
                RenderTextureFormat format = RenderTextureFormat.RGB111110Float;
#if UNITY_EDITOR
                var target = EditorUserBuildSettings.activeBuildTarget;
                if (target != BuildTarget.Android && target != BuildTarget.iOS && target != BuildTarget.tvOS && target != BuildTarget.Switch)
                    return RenderTextureFormat.DefaultHDR;
#endif // UNITY_EDITOR
                if (format.IsSupported())
                    return format;
#endif // UNITY_ANDROID || UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_EDITOR
                return RenderTextureFormat.DefaultHDR;
            }
        }
@wowaaa

This comment has been minimized.

Copy link

commented Mar 29, 2019

I have exactly the same broken DoF effect targeting Android and within Editor on Unity 2018.3.6f1. Both 2.1.4 and 2.1.5 version has it since the context.sourceFormat change. And actually, the pointed up defaultHDRRenderTextureFormat was introduced a quite long time ago, so don't know if the expected behavior changed since then, or no-one has seen that because of the hardcoded RenderTextureFormat, if that is the origin of this issue.

@NuclearCookie NuclearCookie changed the title Depth of field is broken on Nintendo Switch Depth of field is broken on Android, iOS, TVOS, Switch Mar 29, 2019

@AtomicJoe1

This comment has been minimized.

Copy link

commented Apr 1, 2019

I can confirm this is happening to me on an Android Vulkan project both in editor and in build.
Changing line 164 in DepthOfField.cs to force a true HDR buffer fixes it:
var colorFormat = RenderTextureFormat.DefaultHDR;// context.sourceFormat;

@NuclearCookie

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

@Chman
When do you plan to fix this?

Or can you point is in the right direction of what's wrong here so the community can fix this?

@NuclearCookie

This comment has been minimized.

Copy link
Author

commented Apr 26, 2019

After 1 month, I reported this issue through the bug reporter:
https://fogbugz.unity3d.com/default.asp?1149314_65hrck39d9q67566

@NuclearCookie

This comment has been minimized.

@FMS-Cat

This comment has been minimized.

Copy link

commented May 10, 2019

FragBlur pass uses the alpha channel and FlagCombine attempts to use the channel,
Then it fails under B10G11R11 buffers...
We should not use alpha buffers on any PostProcessing Stack passes if the PPS API stays here

@NuclearCookie

This comment has been minimized.

Copy link
Author

commented May 14, 2019

Hopefully fixed in 997e0c1

@FMS-Cat

This comment has been minimized.

Copy link

commented May 16, 2019

yeah I think so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.