emboss, ebook
[ Pobierz całość w formacie PDF ]
// (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 Foundation, version 2.// This program is distributed in the hope that it will be useful, but WITHOUT ANY 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.// emboss// This shader can be run as a screen space pixel shader.// If possible, avoid compiling with the software emulation modes (ps_?_sw). Pixel shaders require a lot of processing power to run in real-time software mode.// Use this shader to add an embossed effect to an image.sampler s0;float2 c1 : register(c1);#define sp(a, b) tex2D(s0, tex+c1*float2(a, b))float4 main(float2 tex : TEXCOORD0) : COLOR{return dot(1/3., sp(1, 0)+sp(0, 1)+sp(1, 1)-sp(-1, -1)-sp(0, -1)-sp(-1, 0))+.5;// measure the contrast diagonally, normalize the contrast to grayscale and output}
[ Pobierz całość w formacie PDF ]