- Home /
Get access to previous pass from CG
I wanted to use the built-in shader passes, (SPECULAR/BASE, custom stuff, etc.) and then continue to process the pixels in another pass, say blurring or some other effect. I can do something sort of like this in shaderlab with SetTexture[ combine previous texture ] which clearly accesses the result of the previous SetTexture operation. Is there a way to do that for passes? I would imagine there's some _Previous sampler2D or such that gets written to but I couldn't find anything like that in the docs. I'd like to do:
SubShader {
UsePass "SPECULAR/BASE"
Pass {
CGINCLUDE // do something with result of previous pass ENDCG } }
Answer by dr-electro · May 16, 2012 at 05:21 PM
Check out the Blend command:
http://unity3d.com/support/documentation/Components/SL-Blend.html
Answer by ScroodgeM · Jul 20, 2012 at 07:21 AM
did you try this?
http://docs.unity3d.com/Documentation/Components/SL-GrabPass.html
remember that it's much more expensive then make all calculations in a single pass