This is not a standard "toon shader", the effect you obtain is similar to GIMP/Pthotoshop's "Cartoon" filter (it is applied on a rendertarget, or a texture).
While I got a few to work, I can't seem to make heads or tails of this one:
Code: Select all
ps.1.1
def c0, 0.3, 0.59, 0.11, 0
tex t0 // sample the source image
tex t1 // sample offset by (-1, -1)
tex t2 // sample offset by (1, 1)
dp3 r0.rgba, t1, c0 // greyscale sample #1 in r0.a
dp3 r1.rgba, t2, c0 // greyscale sample #2 in r1.a
sub_x4 r0.a, r0, r1 // diagonal edge detect difference
mul_x4_sat r0.a, r0, r0 // square edge difference to get absolute value
mul r0.rgb, r0, 1-r0.a // output color * edge detect
+ mov r0.a, t0.a // output alpha
I'm trying to use it for a preprocessing class (process textures when loading with various effects).
PS: I get a white output, but no errors regarding the shader itself.