Applying pixel shader effect not to the entire texture
Simple question: how to use the "pixel shader" not to an entire texture (screen) but just a part of it. (part square)
A pixel shader is only applied to pixel in the geometry that you're rendering. Usually with post-processing, where you want the shader to be applied to the entire screen, you render a full-screen quad (usually using transformed vertices). If you modify the coordinates of the vertices you're rendering, you can have the shader applied to any shape you want.
In any case, one can always use a "mask" texture to determine where specific code is executed in any given shader. You could for instance apply a certain section of code to only areas where the alpha channel of a texture is greater than 0.5.
This can be explicitly done using if() blocks, or implicitly using lerp.
This can be explicitly done using if() blocks, or implicitly using lerp.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement