Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug [IN-31235] _TexelSize not working in 2023.1b2

Discussion in '2023.1 Beta' started by castor76, Feb 7, 2023.

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    _TexelSize property is not working in 2023.1b2, when the same shader used in 2021.3 and 2022.2 seems to work perfectly fine.

    Anyone else with the same issue?

    This seems to be critical issue for graphics side. So it should be looked at ASAP. It will break so many shaders.
     
    mahdi_jeddi likes this.
  2. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    The bug report is still not even being looked at... Sad. Hopefully soon. This is very critical issue for any shader development.
     
  3. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    What's the bug report number?
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    IN-31235

    also happens in b3
     
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Last edited: Mar 22, 2023
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hi!
    Looks like you can try disabling the SRP batcher as a workaround.
     
  7. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @aleksandrk Hi If you are talking about settings in URP asset

    upload_2023-3-24_0-20-30.png

    My setting for SRP batcher is already disabled.

    And in no way doing anything to do with SRP batching option solves this issue. Is that a known issue?
     
    Last edited: Mar 25, 2023
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    We have to get this fixed before leaving Beta, in no way this kind of bug be in the final release...
     
    wwWwwwW1 likes this.
  9. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Still not fixed for B10
     
  10. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Still not fixed for B11
     
  11. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    639
    Sorry for the delay. We have fixed this issue and trying to land the fix and backport asap. Will post an update to this thread as soon as the they land. Apologies for the inconvenience caused.
     
    mahdi_jeddi likes this.
  12. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @Venkify Any idea when this fix be ready for which version of the Unity yet?
     
  13. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    639
    The fix is being verified by QA, hopefully will be landing early next week. Will keep this thread posted, Thanks.
     
  14. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    639
    @castor76 The fix has landed on 2023.2 and will be available in 2023.2.0a17
    and the backport for 2023.1 is in the process of being merged. Will post an update as soon as it lands. Thanks for the patience.
     
    castor76 likes this.
  15. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Oh man.. the wait is too painful. Been more than 4months now..
     
  16. xtytyx

    xtytyx

    Joined:
    Dec 29, 2017
    Posts:
    24
    I can confirm the issue is still there in 2023.2.0a17, either the issue is still there or there is a similar issue where the value is not the same as 2022.2.
    Did the fix version get pushed to a different one?
    Or is the fix only intended to work with SRP Batcher disabled?
     
    Last edited: Jun 5, 2023
  17. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    That's pretty quick for Unity actually.
     
  18. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    639
    Please either disable SRP-Batcher or just make the shader non-SRP-Batcher compatible (exposing a property and setting it through MBP for example) should fix the issue. If this is not the case, kindly post your test scene.

    Backport should be landing this week hopefully. Will post an update. Sorry for the delay.
     
  19. xtytyx

    xtytyx

    Joined:
    Dec 29, 2017
    Posts:
    24
    Ok just want to make sure, that it is the intended behaviour that with SRP batcher working, Texelsize will not work.
    Is that the intended behaviour?
    Will that always be the intended behaviour?
    Also appreciate the clarification!
     
  20. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    639
    @castor76
    Backport 2023.1 should be available in 2023.1.0f1 .

    As mentioned above, SRP-Batcher does not have to be disabled, just ensure that the specific shader is not SRP-Compatible. For example :


    Shader "Sprites/Rect"
    {
    Properties
    {
    [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
    _Color("Tint", Color) = (1,1,1,1)
    }

    SubShader
    {
    Tags
    {
    "Queue" = "Transparent"
    "IgnoreProjector" = "True"
    "RenderType" = "Transparent"
    }

    Cull Off
    ZWrite Off
    Blend One OneMinusSrcAlpha

    Pass
    {
    CGPROGRAM

    #pragma vertex SpriteVert
    #pragma fragment frag
    #include "UnitySprites.cginc"

    // This disables SRP-Batching for this Shader.
    float4 _MainTex_TexelSize;

    fixed4 frag(v2f IN) : SV_Target
    {
    fixed4 c = SampleSpriteTexture(IN.texcoord);
    fixed2 l = _MainTex_TexelSize.xy * 8.0f;

    if (IN.texcoord.x < l.x || (1.0 - IN.texcoord.x) < l.x)
    return IN.color;
    if (IN.texcoord.y < l.y || (1.0 - IN.texcoord.y) < l.y)
    return IN.color;

    return fixed4(0,0,0,0);
    }
    ENDCG
    }
    }
    }


    A simple demo enclosed :
     

    Attached Files:

  21. xtytyx

    xtytyx

    Joined:
    Dec 29, 2017
    Posts:
    24
    Yes but i guess my point was more that:
    Is it intentional that any time srp batcher is working for a shader, that shader will never be able to use texelsize?
    Is this a known limitation of including a shader in the srp batcher?
    and will it always be that way?
    thank you for your response, i am sorry i was not clear the first time!
     
  22. xtytyx

    xtytyx

    Joined:
    Dec 29, 2017
    Posts:
    24
    I have managed to fix the issue manually.
    I set the texelSize manually as i am using a sprite atlas for all sprites my renderer uses, so I was able to just use the texelsize provided manually instead of the one provided by unity.
    This means I can use SRP batch functionality while still using texelsize.
    This also created a large performance boost. I was able to srp batch all my shaders this way without sacrificing functionality.
     
  23. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    Yeah, is there some architectural limitation to why SRP Batcher can't play well with texelSize? Seems like a weird-ass limitation and SRP batcher is supposed to be modern and clean and cool and whatever.