I just converted that code using the code that M3PHiSTOPH3L3S posted last year. I just converted it to dx9. You can reference it here:
http://www.coniserver.net/ubbthreads/sho...e=0&fpart=5

Referencing other shaders is helping me to learn.