Search Unity

Question Exporting ShaderGraph to OpenGL ES2.0

Discussion in 'Android' started by yasin9292, Jan 3, 2021.

  1. yasin9292

    yasin9292

    Joined:
    Jan 3, 2021
    Posts:
    1
    Currently I'm working on an Android app and want use custom shader to improve the UX. After some searching I found out that I could use OpenGL libraries to compile and use custom shaders. It took me a couple of days but I managed to learn much about OpenGL and Graphics Pipeline and wrote a working code that spits out nice looking shaders. But the problem is writing shaders by hand is a very weary process and I don't know what to expect as result most of the time. Then I read that I could design shaders on shader editors and installed unity for it. I created a simple glowing shader on ShaderGraph and clicked "Compile and show code" after checking only the OpenGL ES2.0 option. I was planning to copy the compiled code into my android setting but seeing the compiled code shocked me. It produced 170k lines of code for crying out loud! So my questions are;

    1. What section of this code is actually useful? There are sections like "Keywords set in this variant: DIRLIGHTMAP_COMBINED FOG_EXP2" I don't remember adding any of these to my shadergraph. Can't I just copy a section of this code and paste to my shader compiler in the Android app?

    2. How would you add shader to android app? Would you use a method like I'm trying to or would you do something else? I didn't want to add heavy(assuming) unity libraries to my app just to use a simple shader. Am I right thinking that or are there any other feasible way executing this?

    It's my first post. I apologize if I'm breaking some forum rules that I'm not aware of.

    Thanks in advance.