Search Unity

ETC1 + Alpha Feature

Discussion in '2D' started by LingoDev2, Aug 26, 2015.

  1. LingoDev2

    LingoDev2

    Joined:
    Feb 17, 2015
    Posts:
    1
    Hi there, i'm trying to use this new option, however, as soon as i tick the checkbox of the compressed sprite, it fallbacks again to ETC2.
    ETC(default) is overriding in Build Settings aswell.

    upload_2015-8-26_13-28-2.png
     
  2. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    I am seeing this issue also, and confirm it is present in 5.2.0f3 that has just been released ...
     
  3. dippnsk

    dippnsk

    Joined:
    Feb 12, 2015
    Posts:
    8
    Yes. Is this feature even works? I've spent all day trying different approaches in packing asset bundles with different settings, but result is the same - all textures in ETC2.

    Log messages looks like this:
    Built-in Texture2D: SpriteAtlasTexture-map-2048x2048-fmt47

    fmt47 is TextureFormat.ETC2_RGBA8.
     
  4. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    The preview window (in the screenshot above) shows the state of the original texture.
    ETC1 applies to the Atlas that is generated by Unity, and this can be seen using the SpritePacker window.

    Example texture setup to use ETC1 compression (Packing tag, Override for Android, Compress using ETC1)
    Screen Shot 2015-09-10 at 11.03.08 am.png

    Sprite Packer view of generated atlas (no alpha in the atlas) + Compressed with ETC 4 bits
    Screen Shot 2015-09-10 at 11.03.42 am.png

    In game view of Texture using ETC1 compression
    In game (texture compressed with ETC1).png
     
  5. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
  6. dippnsk

    dippnsk

    Joined:
    Feb 12, 2015
    Posts:
    8
    sandboxed,

    Hi. Have you really tried this on a real Android device? Because what I see is this ugly non-alpha ETC compressed texture.

    When Texture Compression is set to "Don't override", atlas get compressed to ETC2, NOT ETC1. I assuming this by looking at Editor.log:
    - Packing atlas (spp2) of 1 sprites. Settings: Format: RGBA Compressed ETC2 8 bits

    When Texture Compression is set to "ETC (default)" atlas get compressed to ETC1, but no any alpha atlases is built, and the size of non-alpha atlas is the same as the texture, so no any alpha get pushed to this atlas somewhere "near".
     
    Last edited: Sep 10, 2015
  7. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    >> Have you really tried this on a real Android device
    Yes. I have it working on my HtcOneM8 as I post this reply. Maybe you have hit a case that we didn't cover during testing. Could you submit a bug with a sample project?


    ETC1 will kick in only if
    1) The build is Android and TextureOverride is set to ETC (default)
    2) The texture is part of an atlas
    3) The override option for enabling ETC1 is checked.

    I checked the source of the log you mentioned, and its generated during the initial stages of sprite packing. The format is overridden based on setting of textures sometime after the log was issued. This log is hence misleading, and should be fixed.
     
  8. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    The documentation at http://docs.unity3d.com/Manual/class-TextureImporterAndroid.html does not say to set the build texture override to ETC (default), it could do with updating.

    Also it seems misleading in that first screenshot, where it says "RGBA Compressed ETC2 8bits (Atlas)" at the bottom, when the atlas format is in fact ETC1 + Alpha texture.

    The sprite packer's Alpha/RGB toggle button (the little rainbow thing at the top) does not work in this case either, the Alpha appears all white.

    The tickbox for compress using ETC1 also disappears if you switch the texture to Advanced mode.

    These have been logged as case 725748.
     
    Last edited: Sep 10, 2015
  9. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Thanks for logging the bug. I'll look into it soon.
     
  10. dippnsk

    dippnsk

    Joined:
    Feb 12, 2015
    Posts:
    8
    Hello! I think I know what's the problem. I try to use this method with UI elements and it's failed because in UI shader no any alpha ETC1 support, but in Sprite-Default shader I see this _AlphaTex field and all supporting stuff.

    Sprites are part of UI and I think we all agree that UI shader also need support for ETC1+Alpha compression.

    Is this possible? Can we see it in a patch update? If not and this is absolutely impossible, you should fix documentation so that it will say about SpriteRenderer only and not about sprites in general.
     
    Last edited: Sep 18, 2015
  11. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Yes. The UI elements do not work well with ETC1. We have a bug on it.
     
  12. cory_munky

    cory_munky

    Joined:
    Dec 10, 2014
    Posts:
    66
    Hey sandboxed,

    My results do not match your results. Any guess what I'm doing wrong?

    I'm using 5.3.0f4. All of the sprites in the loadingdoors atlas that have alpha are checked for "Compress using ETC1". The MunkySpritePacker is just the example code with "entry.settings.allowsAlphaSplitting = ti.GetAllowsAlphaSplitting();" included.

    I want 2 ETC 1 textures, but I'm still getting ETC2 in the atlas and on device.

     
  13. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Did you set the texture override in the build settings to use ETC1?

    If it still doesn't solve the problem, then please report a bug, with a sample project. I'll be happy to look into it.
     
  14. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
  15. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
  16. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    Looking at the default sprite shader, it has [PerRendererData] on _MainTex in the properties block, but not for _AlphaTex (which doesn't even appear in the properties block, only in the shader code itself).

    Is there any reason for this? Presumably each _AlphaTex variant needs to be passed in via the MaterialPropertyBlock like the main texture does ?
     
  17. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Ideally the _AlphaTex is not something that the user should set. The entire ETC1 + Alpha feature is handled by Unity in a transparent way to the user. Hence the _AlphaTex was not included in the properties block.

    However, we did run into issues with UI Images, and hence exposed the AlphaTex via the sprite api to aid a workaround while we fix the thing internally. But this still doesn't require _AlphaTex to be appearing in the inspector window, and should be set via code.
     
  18. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    Understood.

    Did anything else change with how alphaed sprites are rendered in Unity 5.3 upwards?

    I ask as on upgrading from 5.2.1 to 5.3.1, the sprites I have using the ETC1 alpha split no longer render correctly (I made no other changes) - they have solid blocks around them, i.e. the alpha texture is being ignored.

    These are straight SpriteRenderer's, not UIImages.

    Is there something new that needs to be setup to make them work or should I log a bug - it is very easily reproducible.
     
  19. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    I download the unity5.3 UI source code project and rebuild UnityEngine.UI.dll when i modified the Image Component override material property(use the modified UIDefault shader) and sprite property (set _AlphaTex),partial code like these: defaultmaterial.shader = shader.Find("UI-DefaultAlpha"); defaultmaterial.SetTexture("_AlphaTex",sprite.associatedAlphaSplitTexture);but it just did not work on unity5.3p2 ,the background is black,There should be something wrong with the sprite.associatedAlphaSplitTexture generated.Because this work fine on unity5.3f1.
     
  20. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    On unity5.3f1 I found that modified UI Image component nested use has problem when set sprite.associatedAlphaSplitTexture via code (sprite.associatedAlphaSplitTexture != null).Which release unity version would fixe Image component problem when using ETC 4 bits split Alpha channel?(sorry,please forgive my poor english)
     
  21. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    Hi, facing the same issue I have vote for. But how to workarround. I have an heavy UI game with many atlas. I want to create a build with ETC1 + alpha with atlas for UI image for older devices.
    I will create a ETC2 build for newest supporting opengl es 3.0.

    How to create and setup shader for UI Image etc1?
     
  22. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    @sandboxed : it's true we can access the associatedAlphaSplitTexture for a given sprite, but actually setting this alpha texture on a UI image poses some challenges:

    Because the UI.Image class does not inherit from Renderer, there also does not seem a way to setup a MaterialPropertyBlock for each image instance. Does this mean a new material needs to be created (and assigned to the UI image) for each possible variant of alpha split texture ?
     
  23. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Yes ... We have a bug on this and also a potential fix that is under review.
    Problem was detected in the way we build our builtin resources which is why the Sprites-Default material is messed up when dealing with ETC1 compressed textures.
    This problem is however not affecting any shaders that are a part of the project itself. So if you have a local copy of Sprites-Default.shader and a material created out of it, the ETC1 sprites will render correctly.

    5.3.x is infected with this bug :(
     
  24. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    @xjqxzyr - This solution should work for you too.

    You can use the Sprite.associatedAlphaSplitTexture to workaround the problem with UI.Image and ETC1 textures.
    Here is how you can approach the problem.

    1) Create shader for UI image (preferably copy the UI-Defaults.shader from https://unity3d.com/get-unity/download/archive)

    2) Edit the shader and add a [PerRendererData] in the property block for _AlphaTex
    Code (csharp):
    1. [PerRendererData] _AlphaTex ("Sprite Texture", 2D) = "white" {}
    3) Add the _AlphaTex sampler2D somewhere in the shader -- like just under the _MainTex.

    4) In the fragment shader function (frag () in UI-Default.shader), lookup the texture in the _AlphaTex and extract the Red channel.
    Code (csharp):
    1.  
    2. fixed4 frag(v2f IN) : SV_Target
    3. {
    4.   ...
    5.        half alpha = tex2D(_AlphaTex, IN.texcoord).r;
    6.        color.a = alpha;
    7.   ...
    8. }
    9.  
    5) Make sure that the shader has no compile errors in Unity console.
    6) Create a material out of this shader
    7) Assign this material to the UI Image element.

    Hit play and the UI elements is expected to work correctly now with ETC1 compressed textures.
     
  25. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    First,Thanks for your replay. But it seems does not work properly when RGB and RGBA(compressed by split alphaTexture) textures exist at the same time. It seems to be like these:
    if(AlphaEnable)
    {
    color.a *= tex2D(_AlphaTex,IN.texcoord).r;
    }
    There have another problem I meet, The FrameDebugger display that the generated _AlphaTex is white 20160126132648.jpg
     
  26. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    The correct state should like this: upload_2016-1-26_13-32-26.png
     
    Last edited: Jan 26, 2016
  27. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    The sprite packer seems does not work properly if i use the editor script set the sprite tag and reimport .the atlas does not regenerate(unity 5.3.1 p2)
     
  28. Twistplay

    Twistplay

    Joined:
    Dec 6, 2012
    Posts:
    36
    @sandboxed: in your solution above, I don't think any of those steps actually assign _AlphaTex from a script, and nothing actually seems to read from associateAlphaSplitTexture ?

    Shouldn't there be another step that does something like:

    material.SetTexture("_AlphaTex", sprite.associatedAlphaSplitTexture);

    ?

    Though as I mentioned earlier, this needs a new material for each different alpha texture.
     
  29. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    Code (csharp):
    1.  
    2.         //UGUI Graphic.cs modified like this:
    3.         protected virtual void UpdateMaterial()
    4.         {
    5.             if (!IsActive())
    6.                 return;
    7.  
    8.             canvasRenderer.materialCount = 1;
    9.             if (alphaTexture != null)
    10.             {
    11.                 materialForRendering.SetTexture ("_AlphaTex", alphaTexture);
    12.                 materialForRendering.SetFloat ("AlphaEnable",1f);
    13.             }
    14.  
    15.             canvasRenderer.SetMaterial(materialForRendering, 0);    // I tested found that needs  a new material for each different alpha texture .The other problem is the associatedSplitTexture format is fm4 but ETC should be fm34 )
    16.             canvasRenderer.SetTexture(mainTexture);
    17.         }
    18.  
    19.  
    20.         static public Material defaultGraphicMaterial
    21.         {
    22.             get
    23.             {
    24.                 if (s_DefaultUI == null)
    25.                     s_DefaultUI = Canvas.GetDefaultCanvasMaterial();
    26.  
    27.                 if (s_defaultShader == null)
    28.                 {
    29.                     s_defaultShader = Shader.Find ("UI/DefaultAlpha");
    30.                     s_DefaultUI.shader = s_defaultShader;
    31.                 }
    32.                 return s_DefaultUI;
    33.             }
    34.         }
    35.  
    36.         // UIImage changed like this:
    37.         public override Texture alphaTexture
    38.         {
    39.             get
    40.             {
    41.                 if(m_Sprite != null)
    42.                 {
    43.                     return m_Sprite.associatedAlphaSplitTexture;  // this code does not work (just a                          white texture so i use mine)
    44.                 }
    45.                 return null;
    46.             }
    47.         }
    48.  
    Code (csharp):
    1.  
    2. Shader "UI/DefaultAlpha"
    3. {
    4.     Properties
    5.     {
    6.         [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
    7.         [PerRendererData] _AlphaTex("Sprite Texture", 2D) = "white" {}
    8.         _Color ("Tint", Color) = (1,1,1,1)
    9.        
    10.         _StencilComp ("Stencil Comparison", Float) = 8
    11.         _Stencil ("Stencil ID", Float) = 0
    12.         _StencilOp ("Stencil Operation", Float) = 0
    13.         _StencilWriteMask ("Stencil Write Mask", Float) = 255
    14.         _StencilReadMask ("Stencil Read Mask", Float) = 255
    15.  
    16.         _ColorMask ("Color Mask", Float) = 15
    17.  
    18.         [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
    19.     }
    20.  
    21.     SubShader
    22.     {
    23.         Tags
    24.         {
    25.             "Queue"="Transparent"
    26.             "IgnoreProjector"="True"
    27.             "RenderType"="Transparent"
    28.             "PreviewType"="Plane"
    29.             "CanUseSpriteAtlas"="True"
    30.         }
    31.        
    32.         Stencil
    33.         {
    34.             Ref [_Stencil]
    35.             Comp [_StencilComp]
    36.             Pass [_StencilOp]
    37.             ReadMask [_StencilReadMask]
    38.             WriteMask [_StencilWriteMask]
    39.         }
    40.  
    41.         Cull Off
    42.         Lighting Off
    43.         ZWrite Off
    44.         ZTest [unity_GUIZTestMode]
    45.         Blend SrcAlpha OneMinusSrcAlpha
    46.         ColorMask [_ColorMask]
    47.  
    48.         Pass
    49.         {
    50.         CGPROGRAM
    51.             #pragma vertex vert
    52.             #pragma fragment frag
    53.  
    54.             #include "UnityCG.cginc"
    55.             #include "UnityUI.cginc"
    56.  
    57.             #pragma multi_compile __ UNITY_UI_ALPHACLIP
    58.            
    59.             struct appdata_t
    60.             {
    61.                 float4 vertex   : POSITION;
    62.                 float4 color    : COLOR;
    63.                 float2 texcoord : TEXCOORD0;
    64.             };
    65.  
    66.             struct v2f
    67.             {
    68.                 float4 vertex   : SV_POSITION;
    69.                 fixed4 color    : COLOR;
    70.                 half2 texcoord  : TEXCOORD0;
    71.                 float4 worldPosition : TEXCOORD1;
    72.             };
    73.            
    74.             fixed4 _Color;
    75.             fixed4 _TextureSampleAdd;
    76.             float4 _ClipRect;
    77.  
    78.  
    79.             v2f vert(appdata_t IN)
    80.             {
    81.                 v2f OUT;
    82.                 OUT.worldPosition = IN.vertex;
    83.                 OUT.vertex = mul(UNITY_MATRIX_MVP, OUT.worldPosition);
    84.  
    85.                 OUT.texcoord = IN.texcoord;
    86.                
    87.                 #ifdef UNITY_HALF_TEXEL_OFFSET
    88.                 OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
    89.                 #endif
    90.                
    91.                 OUT.color = IN.color * _Color;
    92.                 return OUT;
    93.             }
    94.  
    95.             sampler2D _MainTex;
    96.             sampler2D _AlphaTex;
    97.             float AlphaEnable;
    98.  
    99.             fixed4 frag(v2f IN) : SV_Target
    100.             {
    101.                 half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
    102.                
    103.                 if(AlphaEnable)
    104.                 {
    105.                  color.a *= tex2D(_AlphaTex,IN.texcoord).r;
    106.                 }
    107.  
    108.                 color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
    109.                
    110.                 #ifdef UNITY_UI_ALPHACLIP
    111.                 clip (color.a - 0.001);
    112.                 #endif
    113.  
    114.                 return color;
    115.             }
    116.         ENDCG
    117.         }
    118.     }
    119. }
    120.  
    121.  
    I modified the UI Graphic source code,use myself alpha texture(the generated associatedAlphaSplitTexture is white) ,but the big problem is the sprite packer generated alphaTexture and the mainTexture uv is different,so i use uv1 transfer into the shader
     
    Last edited: Jan 27, 2016
  30. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
  31. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    May you explain [PerRenderData]' specific usages? There are no specific document descriptions.Does it have any relationship with the MaterialPropertyblock? "Use it in situations where you want to draw multiple objects with the same material, but slightly different properties."?
     
  32. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Your quote of the attribute is correct.
    The [PerRenderData] will allow the property to be varied per renderer using a material block.
     
  33. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Yes ... script should set the texture as you have pointed out; and this should be done per object.
    So each object should have this _AlphaTex setup script that will do its dirty work in Start ().

    My bad, I missed it in the steps.
     
  34. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    @xjqxzyr When posting code on the forum, wrap it in
    [ Code]
    [ /Code] << without the space
     
  35. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21

    But CanvasrRender does not have extend from Render component.I don't know how to use one material render multiobjects by canvasrender way(Graphics.DrawMesh does have this property), I tried the way that you provided(set _AlphaTex )but the performance suffered a lot(each different texture use one different material).May you show me the right code (or correct solution)?
     
    Last edited: Jan 27, 2016
  36. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    Hi,
    I have give a try and lear how to configure a shader. I have modify UI default shader with a alpha tex. But indeed we need to assign the atlas texture alpha to this UI Image. Add a custom script is out of question with a heavy UI 2D game.

    I have installed unity 5.3.2f1 but issue is always here. any fix comes in next build?
     
  37. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    @xjqxzyr do you found a work around? I am near to build a release and no solution for me except make several build with different compression (ATC, ETC2, PVRTC, ASTC).
     
  38. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    I meet a big problem when i want to use image(and atlas compress)with ETC1 format.There dose not have a rigth way to set alphaTexture and a MainTex to a canvasRender at the same time,there could apear flicker problems.If you unity guys fixed this problem,There could be another problem you could meet,spritepacker just do not packer textures under Resources folder.And you can not load a sprite dynamicly out of resource folder.I could say NGUI has a good managerment about ui textures.
     
  39. UVMarko

    UVMarko

    Joined:
    Sep 22, 2013
    Posts:
    15
    I am having a similar problem, I did find a weird workaround that worked for me on my project.
    I tried to compress a texture with an alpha channel into ETC1 by checking the ETC1 checkbox override.
    In the editor it appeared as an ETC2 texture and When I compiled to the device which only supports ETC1, I noticed that a 2048x2048 texture (from the resource folder) was taking 16mb (using a snapshot from the memory profiler) and not 4mb a ETC1 texture should. but another texture that had mipmap checked did get compressed to ETC1 and was taking up 5.3mb on the device. so I checked the mipmap option on the texture that didn't compress and it actually did compress it this time although in the editor it was still displaying as ETC2.
    I tried to reproduce this on a new Project but for some reason it doesn't work and UT will not compress ETC1 textures for textures with alpha channel with or without mipmap checked.
    I don't understand what is different between the two projects, in the build settings they are both set as ETC1(default) override. in the Player setting i set both projects to work only with openGLes2.
    Anyway, try to check mipmap for the texture and it might work on the device.

    all tests were made using Unity 5.2.4.f1
     
  40. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
  41. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    @sandboxed would you tell us the specific support date?
     
  42. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    I have search in beta releases notes and this issue will not be fixed.
     
  43. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    This feature is very important for Android game. Any dates?
     
  44. sandboxed

    sandboxed

    Unity Technologies

    Joined:
    Apr 6, 2015
    Posts:
    95
    Hey guys ... sorry for the delayed replies.
    Spoke internally about the status, and we are looking into it.
     
  45. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
  46. shokin

    shokin

    Joined:
    Oct 22, 2015
    Posts:
    5
    hi, I add an extra component for support etc+alpha.
    But if use Image component and myImage as the same time, the alpha texture will affect another Image Component.


    How to do let the myImage shader don't affect the Image component.

    As Code:

    image.materialForRendering.shader = Shader.Find ("UI/MyDefault");
    image.materialForRendering.SetTexture("_MainTex", srcTex);
    image.materialForRendering.SetTexture ("_Alpha2Tex", aplitAlpha.AlphaTexture);



    Thanks!!!
     
  47. shokin

    shokin

    Joined:
    Oct 22, 2015
    Posts:
    5
    hi, I add an extra component for support etc+alpha.
    But if use Image component and myImage as the same time, the alpha texture will affect another Image Component.

    How to do let the myImage shader don't affect the Image component.

    As Code:

    image.materialForRendering.shader = Shader.Find ("UI/MyDefault");
    image.materialForRendering.SetTexture("_MainTex", srcTex);
    image.materialForRendering.SetTexture ("_Alpha2Tex", aplitAlpha.AlphaTexture);


    Thanks!!!
     
  48. shokin

    shokin

    Joined:
    Oct 22, 2015
    Posts:
    5
    hi,
    I add an extra component for support etc+alpha.
    But if use Image component and myImage as the same time, the alpha texture will affect another Image Component.
    The alpha texture can affect another sprite ?

    How to do let the myImage shader don't affect another sprite ?

    Thanks !
     
  49. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214
    You try to render with Sprite Packer atlas Image?
     
  50. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    214