- Home /
how can i modify this shader for transparency?
i would like to modify the following shader to support an alpha channel
Shader "Unlit/simpleshader"
{
Properties{
_MainTex("Texture", 2D) = "white" {}
}
SubShader{
Tags{ "Queue" = "Geometry" }
Pass{
BindChannels{
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SetTexture[_MainTex]{
Combine texture * primary
}
}
}
}
currently i am using it to display rgb points on a mesh, but the alpha channel does not work.
thanks
Answer by Zarenityx · Jul 18, 2018 at 01:01 AM
What you're looking for is Blending. You'll probably want either
Blend SrcAlpha OneMinusSrcAlpha
or
Blend One One
although there are a number of blending options.
Also: I wouldn't recommend using the fixed function pipeline. I don't know exactly what hardware you are targeting, but I can almost guarantee that using fixed-function won't be faster. A lot of modern hardware (and really anything in the past decade) will be using a vert/frag shader program internally anyway. Unless you are targeting some archaic platform, you'll be better off writing some HLSL.
thanks, it works.
now, i have another problem: https://answers.unity.com/questions/1530600/how-to-quickly-disable-vertices-from-rendering-in.html
i want to quickly turn rendering on/off on specific vertices in a mesh. do you know how to do this?
Your answer
Follow this Question
Related Questions
Unlit Shader with alpha mask 2 Answers
Unlit Alpha Shader not working with Simple Water 0 Answers
how to make simple unlit shader for rgba points? 0 Answers
How do I add transparency to a cg vertex lit shader 2 Answers
Unlit, Transparent and Slice Shader 2 Answers