Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

PostProcessing RenderTextureDesc width

Discussion in 'Scripting' started by gumboots, Feb 21, 2018.

  1. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    268
    Hi all,

    I am animating cameras in and out that use the PostProcessing stack. However I am receiving an error when the camera gets too small:

    Code (CSharp):
    1. ArgumentException: RenderTextureDesc width must be greater than zero.
    2. Parameter name: desc.width
    3. UnityEngine.RenderTexture.ValidateRenderTextureDesc (RenderTextureDescriptor desc) (at C:/buildslave/unity/build/Runtime/Export/Texture.cs:150)
    4. UnityEngine.RenderTexture.GetTemporary (RenderTextureDescriptor desc) (at C:/buildslave/unity/build/Runtime/Export/Texture.cs:130)
    5. UnityEngine.RenderTexture.GetTemporary (Int32 width, Int32 height, Int32 depthBuffer, RenderTextureFormat format, RenderTextureReadWrite readWrite, Int32 antiAliasing, RenderTextureMemoryless memorylessMode, VRTextureUsage vrUsage, Boolean useDynamicScale) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:1180)
    6. UnityEngine.RenderTexture.GetTemporary (Int32 width, Int32 height, Int32 depthBuffer, RenderTextureFormat format, RenderTextureReadWrite readWrite) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:1134)
    7. UnityEngine.PostProcessing.RenderTextureFactory.Get (Int32 width, Int32 height, Int32 depthBuffer, RenderTextureFormat format, RenderTextureReadWrite rw, FilterMode filterMode, TextureWrapMode wrapMode, System.String name) (at Assets/PostProcessing/Runtime/Utils/RenderTextureFactory.cs:30)
    8. UnityEngine.PostProcessing.BloomComponent.Prepare (UnityEngine.RenderTexture source, UnityEngine.Material uberMaterial, UnityEngine.Texture autoExposure) (at Assets/PostProcessing/Runtime/Components/BloomComponent.cs:86)
    9. UnityEngine.PostProcessing.PostProcessingBehaviour.OnRenderImage (UnityEngine.RenderTexture source, UnityEngine.RenderTexture destination) (at Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs:239)
    I have tried to set a minimum size for the camera (5 pixels), however the error is still thrown. I'm wondering if anyone might have a solution to this?

    Basically I don't want to turn off PostProcessing as that will be jarring as the camera shows/hides, so I'm wondering if there's a way to avoid it calling for a RenderTexture if it's too small. Or even the minimum size the screen can be? I've tried to dig through the code to find out why it's happening, but from what I can find it only ever goes to a quarter of the screen resolution, so making it 5 pixels should be plenty.

    Any help is greatly appreciated!
     
  2. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    268
    I'm actually still struggling with this, in case anyone has any ideas?
     
  3. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    623
    Same here. Maybe there's a way to turn off post processing for the scene view camera?
     
  4. MetaMythril

    MetaMythril

    Joined:
    May 5, 2010
    Posts:
    150
    Any info on this? I'm getting the same issue on 2018.2.7f1
     
  5. paradoxedone_unity

    paradoxedone_unity

    Joined:
    Mar 4, 2019
    Posts:
    2
    I was just having this issue as well. I went down the post processing stack and noticed the error resolved when I decreased the size of the "Radius" slider in the Bloom settings. Hope this helps.
     
  6. Norman_Reedus

    Norman_Reedus

    Joined:
    Oct 18, 2017
    Posts:
    3
    [QUOTE = "paradoxedone_unity, post: 4324888, member: 2780590"] У меня тоже была эта проблема. Я спустился вниз по стеку постобработки и заметил, что ошибка устранена, когда я уменьшил размер ползунка «Радиус» в настройках Bloom. Надеюсь, это поможет. [/ QUOTE]
    Ты оказался первым же помогающим запросом в гугле, теперь ты в истории)