I just purchased this tool and it looks very promising.
I wanted to try it out with a UGUI sprite as per the documentation saying it has sprite support.
I created a default sprite template and I am able to effect change on my UGUI Image component. However I am confused on a point. How do I perform operations on the main texture instead of providing another texture. I would like my shader to take whatever the image it is on, and greyscale it. However to get grayscale to work I had to drag a texture into my shader(which now makes it not dynamic) and then greyscale from that into the final sprite template node you have at the start.
So basically how do I use the main texture as my source of color?
Sprite template
Re: Sprite template
As an example I was able to edit the shader after using your grayscale as a starting point to do this like so:
fixed4 frag(v2f IN ) : SV_Target
{
fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
float oldA = c.a;
c = (Luminance(c.rgba)).xxxx;
c.a = oldA;
c.rgb *= c.a;
return c;
}
However it would get lost if it regnerated
fixed4 frag(v2f IN ) : SV_Target
{
fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
float oldA = c.a;
c = (Luminance(c.rgba)).xxxx;
c.a = oldA;
c.rgb *= c.a;
return c;
}
However it would get lost if it regnerated
-
Amplify_RnD_Rick
- Posts: 40
- Joined: Wed Mar 01, 2017 6:33 pm
Re: Sprite template
Hey zigtom,
Thank you for reaching us and using ASE!
We have a node called Template Parameter which allows you to use shader properties or global variables that are already declared on the template.
In your case you'll create a Template Parameter node and it will have the Sprite Texture parameter selected by default, which is the one you want.
By having that parameter selected this node will behave like a Texture Object so you will need to connect it to a Texture Sample node in order to fetch its color value.
After that you can use our Grayscale node to grayscale the color value.
Here's a quick snippet on an example: We've placed a Lerp in there associated with a Float shader property just to allow you to define the amount of grayscale you want.
Please don't hesitate on reaching us if you need further clarification!
Thank you for reaching us and using ASE!
We have a node called Template Parameter which allows you to use shader properties or global variables that are already declared on the template.
In your case you'll create a Template Parameter node and it will have the Sprite Texture parameter selected by default, which is the one you want.
By having that parameter selected this node will behave like a Texture Object so you will need to connect it to a Texture Sample node in order to fetch its color value.
After that you can use our Grayscale node to grayscale the color value.
Here's a quick snippet on an example: We've placed a Lerp in there associated with a Float shader property just to allow you to define the amount of grayscale you want.
Please don't hesitate on reaching us if you need further clarification!
Re: Sprite template
Thanks so much. Thats exactly what I needed to know.
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Sprite template
No worries, glad we could be of assistance!
Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!
Feel free to get back in touch if you have further issues or questions, thanks!
Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!
Feel free to get back in touch if you have further issues or questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Sprite template
Done! Its the one from tomzigza
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Sprite template
Thank you for your review and rating, we work hard on a daily basis to provide quality products and support, so it truly means alot to us!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!