FoxMcCloud
Newcomer
I'm trying to implement Masaki Kawase's camera post-processing shader used on the Xbox. The source code for it is provided in one slide but its operation isn't explained, and the source code is in xps_1_1, I'm assuming a register combiner variant for the NV2A. If I want to convert this to Cg or GLSL, where do I start? xps_1_1 docs don't seem to be publicly available. Here's the entire program:
xps.1.1
// c4.rgb : gray scale coefficients
def c4, 0.30f, 0.59f, 0.11f, 0.0f
// blend factor for three images
def c5, 0.0f, 0.0f, 0.0f, 0.5f
def c6, 0.0f, 0.0f, 0.0f, 0.333333333f
tex t0 // frame buffer
tex t1 // frame buffer
tex t2 // frame buffer
tex t3 // glare
// Soften frame buffer edges
lrp r0, c5.a, t1, t2
lrp r0, c6.a, t0, r0
// Add glare
mad r0, t3, c0, r0
// Calculate luminance
dp3 r1, r0, c4
// Emphasize contrast
mul_x2 v0, r0, r0
lrp r0, r1, r0, v0
// Modulate color
mul_x2 r0, r0, c3
// Fadeout
xfc c2.a, c2, r0, ZERO, ZERO, ZERO, r0.a
xps.1.1
// c4.rgb : gray scale coefficients
def c4, 0.30f, 0.59f, 0.11f, 0.0f
// blend factor for three images
def c5, 0.0f, 0.0f, 0.0f, 0.5f
def c6, 0.0f, 0.0f, 0.0f, 0.333333333f
tex t0 // frame buffer
tex t1 // frame buffer
tex t2 // frame buffer
tex t3 // glare
// Soften frame buffer edges
lrp r0, c5.a, t1, t2
lrp r0, c6.a, t0, r0
// Add glare
mad r0, t3, c0, r0
// Calculate luminance
dp3 r1, r0, c4
// Emphasize contrast
mul_x2 v0, r0, r0
lrp r0, r1, r0, v0
// Modulate color
mul_x2 r0, r0, c3
// Fadeout
xfc c2.a, c2, r0, ZERO, ZERO, ZERO, r0.a