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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Texture2D procedural generation on mobile does not work

Discussion in 'General Graphics' started by Jymmy097, Feb 6, 2016.

  1. Jymmy097

    Jymmy097

    Joined:
    Jul 7, 2014
    Posts:
    67
    Hi everybody,

    I wrote a method that creates a procedural generated texture for a sprite.
    Everything works fine if the target platform is "PC standalone", but when I switch to "Android", no matters the colour I set in the array, which is used in combination with SetPixels(), the colour will always be violet/purple (128,128,255). But if I switch off Graphic Emulation (which is OpenGL ES 2.0 when the texture is purple) everything works fine again. The problem is that when I build the APK and I run it on a physical device, the texture is shown purple.

    Screenshots attached.
    Purple.png
    NormalBehaviour - NoEmulation -.png
    TextureFormat: RGBA32, ARGB32: no difference: problem persists. Texture dimensions: 5000x150.
    Could you please help me to solve this problem?

    Thanks a lot.

    Gianmarco.
     
  2. smd863

    smd863

    Joined:
    Jan 26, 2014
    Posts:
    292
    Have you tried using a smaller texture size? Lots of mobile devices have an upper limit of 4096, and I wouldn't be surprised if a limit of 2048 is fairly common. To create a texture with a dimension of 5000, you'd need support for textures of 8192 which is something I doubt you will find on many mobile devices.
     
    Last edited: Feb 6, 2016
  3. Jymmy097

    Jymmy097

    Joined:
    Jul 7, 2014
    Posts:
    67
    Thanks. In fact the problem was with the dimensions of the texture. Now everything works fine.

    Thanks a lot for your help.

    Jymmy097