Вы находитесь на странице: 1из 1

// Contour Color Expose Banding=ps_2_0

// http://forum.doom9.org/showthread.php?t=157634
// (C) 2011 Jan-Willem Krans (janwillem32 <at> hotmail.com)
// This file is part of Video pixel shader pack.
// This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software F
oundation, version 2.
// This program is distributed in the hope that it will be useful, but WITHOUT A
NY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin S
treet, Fifth Floor, Boston, MA 02110-1301 USA.
// contour color expose banding
// This shader can be run as a screen space pixel shader.
// This shader requires compiling with ps_2_0, but higher is better, see http://
en.wikipedia.org/wiki/Pixel_shader to look up what PS version your video card su
pports.
// If possible, avoid compiling with the software emulation modes (ps_?_sw). Pix
el shaders require a lot of processing power to run in real-time software mode.
// Use this shader to add a color contoured effect to an image.
sampler s0;
float2 c1 : register(c1);
#define sp(a, b, c) float4 a = tex2D(s0, tex+c1*float2(b, c));
float4 main(float2 tex : TEXCOORD0) : COLOR
{
sp(s2, -1, -1) sp(s3, 0, -1) sp(s4, 1, -1) sp(s5, -1, 0) sp(s6, 1, 0) sp
(s7, -1, 1) sp(s8, 0, 1) sp(s9, 1, 1)// sample surrounding pixels
return smoothstep(.125, 0, abs(s2+s3+s4-s7-s8-s9)+abs(s2+s5+s7-s4-s6-s9)
+abs(s2+s3+s5-s6-s8-s9)+abs(s3+s4+s6-s5-s7-s8));// color contour output
}

Вам также может понравиться