- Home /
In ShaderLab, how could you get the colour of the texture you're rendering to?
Started learning shaders lately, still haven't quite wrapped my head around them. Have been failing to find if or how I could know the colour of the texture I'm rendering to. As an example, if I wanted to write a shader so that my textures only ever overwrote the target texture if it was fully blue, I would do something like this:
half4 frag (v2f i) : COLOR{
half4 texcol= tex2D (_MainTex, i.uv);
half4 targetcol= //This is what I'm trying to find
half4 finalColor= texcol;
if(targetcol.b<0.8){
finalColor.a=0;
}
return finalColor;
}
Again, not sure if this is possible, not sure when to go looking. A link to the right documentation would be good enough!
Comment
Your answer
Follow this Question
Related Questions
viewDir changes with o.Normal 1 Answer
Disabling a Pass or Subshader Programmatically 0 Answers
Two shaders for one model 3 Answers
Shaderlab texture blender 0 Answers
Why does fmod(x,1.0) not work in Unity4, but fmod(x,1.0001) does? 0 Answers