Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Urp settings errors

Discussion in '2022.2 Beta' started by oretakemitsu, Jun 21, 2022.

  1. oretakemitsu

    oretakemitsu

    Joined:
    Dec 18, 2021
    Posts:
    6
    2022.2.0a17

    urp 14.0.3

    CASE IN-7907

    errors occurred if Opaque Texture enabled in pipeline settings:

    upload_2022-6-22_1-26-52.png


    ArgumentNullException: Value cannot be null.
    Parameter name: value
    UnityEngine.MaterialPropertyBlock.SetTexture (System.Int32 nameID, UnityEngine.Texture value) (at <9d8790cb07b5448489717b720a1ca024>:0)
    UnityEngine.Rendering.Blitter.BlitTexture (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Vector4 scaleBias, UnityEngine.Material material, System.Int32 pass) (at Library/PackageCache/com.unity.render-pipelines.core@14.0.3/Runtime/Utilities/Blitter.cs:238)
    UnityEngine.Rendering.Blitter.BlitCameraTexture (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Rendering.RenderBufferLoadAction loadAction, UnityEngine.Rendering.RenderBufferStoreAction storeAction, UnityEngine.Material material, System.Int32 pass) (at Library/PackageCache/com.unity.render-pipelines.core@14.0.3/Runtime/Utilities/Blitter.cs:361)
    UnityEngine.Rendering.Universal.Internal.CopyColorPass.ExecutePass (UnityEngine.Rendering.Universal.Internal.CopyColorPass+PassData passData, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Rendering.CommandBuffer& cmd, System.Boolean useDrawProceduralBlit) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/Passes/CopyColorPass.cs:179)
    UnityEngine.Rendering.Universal.Internal.CopyColorPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/Passes/CopyColorPass.cs:149)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.ScriptableRenderPass renderPass, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/ScriptableRenderer.cs:1405)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteBlock (System.Int32 blockIndex, UnityEngine.Rendering.Universal.ScriptableRenderer+RenderBlocks& renderBlocks, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData, System.Boolean submit) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/ScriptableRenderer.cs:1370)
    UnityEngine.Rendering.Universal.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/ScriptableRenderer.cs:1153)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.CameraData& cameraData, System.Boolean anyPostProcessingEnabled) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/UniversalRenderPipeline.cs:472)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/UniversalRenderPipeline.cs:372)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/UniversalRenderPipeline.cs:320)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <9d8790cb07b5448489717b720a1ca024>:0)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, System.Collections.Generic.List`1[T] renderRequests, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <9d8790cb07b5448489717b720a1ca024>:0)
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)


    I created materials with shadergraph.
    Materials previewing has errors in Inspector (If I disabled OpaqueTexture in pipeline settings, nothing goes wrong):

    upload_2022-6-22_1-32-45.png

    I notice that theres the same errors if my cursor hovering over some labels in Inspector:

    upload_2022-6-22_1-37-23.png

    btw my Materials is fine in the scene.

    upload_2022-6-22_1-39-40.png
     
    Last edited: Aug 24, 2022
    MrDizzle26 likes this.
  2. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    431
    i also have a report for this problem still found in the latest a18
    case number IN-9379
     
    dacarrera likes this.
  3. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,341
    Thanks for this tip - the same error (Blitter.cs line 238) has been spamming my console in 2022.2 and 2023.1 along with flickering in the Scene window, transparent things seemingly drawing over themselves random numbers of times and other weirdness - even in brand new projects with nothing but simple assets imported.

    However, with Opaque texture disabled, I can select objects in the scene that have transparent materials without getting the errors ("Assertion Failed" in GUIUtility:processEvent and the Blitter.cs one).

    I'm doing this now to enable it for Play Mode/builds and disable it for Edit Mode.. added to a GameObject in the Hierarchy:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering;
    3. using UnityEngine.Rendering.Universal;
    4. [ExecuteAlways]
    5. public class URPOpaqueTextureToggler : MonoBehaviour
    6. {
    7.   private void Start()
    8.   {
    9.     UniversalRenderPipelineAsset urp = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline;
    10.     urp.supportsCameraOpaqueTexture = Application.isPlaying;
    11.     // Debug.Log(urp.name + " Opaque Texture " + (urp.supportsCameraOpaqueTexture ? "Enabled" : "Disabled"));
    12.   }
    13. }
     
    MrDizzle26 likes this.
  4. MrDizzle26

    MrDizzle26

    Joined:
    Feb 8, 2015
    Posts:
    32
    Also having this issue on 2022.2.0b3
     
  5. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    86
    Having this issue in 2022.2.10f, coming this call in a render pass:

    Code (CSharp):
    1. Blitter.BlitCameraTexture(cmd, _cameraColorTarget, _cameraColorTarget, _material, 0);
    I've checked and no arguments being passed are null.
     
  6. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    86
    upload_2023-3-14_17-52-40.png

    We do not have opaque texture enabled.
     
  7. ChebanovDD

    ChebanovDD

    Joined:
    Mar 27, 2022
    Posts:
    5
    Hi. Did you manage to solve the problem?
     
  8. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    86
    Yes, for context our issue is that we're using BlitCameraTexture with a material that has no source input, so the confusion arose from what to pass to the "source" argument. If we were to pass null there would also be an error, so we can't do that. We were passing in the same handle for both source and dest, which was fine on older versions of URP. So our tech artist's solution was to create a dummy texture that we can use instead:

    Code (CSharp):
    1.     public override void Create() {
    2.       _renderPass = new OutlinePass();
    3.       _dummyHandle = RTHandles.Alloc(1, 1);
    4.     }
    5.  
    6. // ...
    7.  
    8.       _renderPass.Setup(renderer.cameraColorTargetHandle, _dummyHandle, _material, PassSettings.RenderPassEvent);
    9.  
    10. // ...
    11.  
    12.       public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {
    13.         if (_material == null || _cameraColorTarget == null) {
    14.           return;
    15.         }
    16.  
    17.         CommandBuffer cmd = CommandBufferPool.Get();
    18.         using (new ProfilingScope(cmd, m_ProfilingSampler)) {
    19.           // TODO: ideally, blit with source texture null. (This causes an error.)
    20.           // Instead, use a dummy RTHandle.
    21.           Blitter.BlitCameraTexture(cmd, _dummySourceHandle, _cameraColorTarget, _material, 0);
    22.         }
    23.         context.ExecuteCommandBuffer(cmd);
     
  9. CaptainJP

    CaptainJP

    Unity Technologies

    Joined:
    Mar 25, 2022
    Posts:
    1
    My custom render feature was throwing that same error (on
    Blitter.BlitCamreaTexture
    ) any time the editor tried to draw a preview - so it wasn't a problem in builds or on full screen play mode, but it was pretty annoying to have to toggle off the render feature when working in edit mode.

    Adding this to the start of the render feature's Execute function fixed the issue for me:
    if (renderingData.cameraData.isPreviewCamera) return;