<Luigi> unregistried
| Created on 27.01.2005 - 16:56 |  |
I have written (copied ) this program taking example from SMARTSHADER Cel Shade.pss. should work on all dx9 cards.
gpuPeteOGL2.vp:
!!ARBvp1.0 OPTION ARB_position_invariant; MOV result.texcoord[ 0 ],vertex.texcoord[ 0 ]; END
gpuPeteOGL2.fp:
!!ARBfp1.0
PARAM One = {1.0, 1.0, 1.0, 0.0}; PARAM OneAndAhalf = {1.5, 1.5, 1.5, 0.0}; PARAM half = {0.5, 0.5, 0.5, 0.0}; PARAM darkIntensity = {0.1, 0.1, 0.1, 0.0}; PARAM brightIntensity = {0.7, 0.7, 0.7, 0.0}; PARAM shrink = {.99, .99, .99, 0}; PARAM r = {1.0, 0.0, 0.0, 0.0}; PARAM g = {0.0, 1.0, 0.0, 0.0}; PARAM b = {0.0, 0.0, 1.0, 0.0};
TEMP pixel; TEMP overallColor; TEMP brightScale; TEMP brightColor; TEMP darkScale; TEMP darkColor; TEMP colorTemp;
# Read my pixel color & convert it to (0,1) TEX pixel, fragment.texcoord[0], texture[0], 2D; SUB pixel, pixel, half; MAD pixel, pixel, shrink, half;
# Compute bright color DP3 colorTemp, pixel, r; MOV brightScale, colorTemp; DP3 colorTemp, pixel, g; MAX brightScale, brightScale, colorTemp; DP3 colorTemp, pixel, b; MAX brightScale, brightScale, colorTemp; RCP brightScale, brightScale.x; MUL brightScale, brightScale, brightIntensity; MUL brightColor, brightScale, pixel;
# Compute dark color DP3 colorTemp, pixel, r; MOV darkScale, colorTemp; DP3 colorTemp, pixel, g; MAX darkScale, darkScale, colorTemp; DP3 colorTemp, pixel, b; MAX darkScale, darkScale, colorTemp; RCP darkScale, darkScale.x; MUL darkScale, darkScale, darkIntensity; MUL darkColor, darkScale, pixel;
# Choose bright or dark DP3 overallColor, pixel, One; SUB overallColor, overallColor, OneAndAhalf; CMP result.color, overallColor, darkColor, brightColor;
END
Ciao
|