Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by sirius_black9999 · Aug 04, 2016 at 12:44 PM · androidshadershaderspost-process-effecthlsl

Shaders don't work properly on android

Hello,

I am working on a way to create high resolution screenshots of a tilemap on android

in order to achieve this i am manually drawing the image using GetPixel/SetPixel, and subsequently i am feeding the resulting image through a shader to add certain details

This works just fine on PC, however on some android devices (samsung galaxy tab 2 to be precise) i've run into several issues

The first was that the image would render entirely black( http://imgur.com/JaAFqM3 ), entirely pink( http://imgur.com/2lgnMkA ), or transparent with a rectangle (black, pink, or blue) in the bottom-left corner(http://imgur.com/Et1Lndb , http://imgur.com/YnYT80p , http://imgur.com/giTmdJM ).

after about 2 full days of research on what was causing this i figured out it had to do with the fact that the shader used uint type uniform variables, which are apparently not supported in GLES 2

after fixing this, the image would REMAIN black as it was greater than 2048*2048, fixing that by splitting the image in half (which is what the code is designed to do anyway)

now after fixing that and disabling all of the working parts of the shader, it seemed to be returning the original image as expected, giving me the following output:

Left: http://imgur.com/egbHE6v
Right: http://imgur.com/mtxmHNV

however when i re-enabled the working parts of the shader and reducing the quality instead of splitting, the output became as such:

low-res: http://imgur.com/zdMFC8o
mid-res: http://imgur.com/7VWINg2

mid-res is a screenshot of the app window btw...

there is no code that works to actually read pixels from the screen in this process, so the only way i can see this happening is by the following code not working correctly:

             Graphics.Blit(megascreenshot[x, y], finalTex, mat);
             RenderTexture.active = finalTex;
             megascreenshot[x, y].ReadPixels(new Rect(0, 0, megascreenshot[x, y].width, megascreenshot[x, y].height), 0, 0);
             megascreenshot[x, y].Apply();
             RenderTexture.active = null;

and the second line being skipped (resulting in the screen being transfered to the texture instead of the renderTexture)

however there is NO output in the debug log

for reference, here's the expected output:

Left: http://imgur.com/2sidm4c
Right: http://imgur.com/BqsizC2
Low-res:http://imgur.com/AwyQd25
Mid-res:http://imgur.com/nHtTYCR

(this is the exact same shader code as is running on the tablet, although it actually looks like my changing uints to floats has broken rendering of the numbers)

full shader code: http://pastebin.com/TrzNjbmw

any help as to what might be going on would be much appreciated

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

115 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you port old shaders to hlsl so they work with the new post-processing stack? 1 Answer

Correct way to modify a Texture2d with a shader? 0 Answers

Broken HDRP Lit and Unlit Shaders 0 Answers

Making a Kuwahara Filter Post process Shader (I'm using HDRP) 0 Answers

purple(pink) screen on android 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges