PDA

View Full Version : Translating ps 1.1 to NV tex shaders+reg comb



Coluna
04-07-2006, 01:50 PM
Hello;
Im trying to create a cell shader that use per pixel math when fetching the shading-texture ...i found a good one, but is in ps 1.1...can anybody help me to translate it?
Please, can anybody help me to translate this DX PS1.1 to NV tex shader + reg combiner code?

ps.1.1 ; painter pixel shader

def c0, 0.0f, 0.0f, 0.0f, 0.75f ; light scale
def c1, 0.0f, 0.0f, 0.0f, 1.0f ; black

tex t0 ; grab the normalized normal
; normalizing cube map is in t0
texm3x2pad t1, t0_bx2 ; dot with light a for u value
texm3x2tex t2, t0_bx2 ; dot with light b for v value
; 2d shade texture is in stage t2
tex t3 ; regular texture data

mov r0, C_MATERIAL_DIFFUSE ; load constant color in
cnd r0, r0.a, r0, t3 ; if alpha, use color
; else, use texture
mul r1.rgb, r0, t2 ; modulate with shading

mul r0.rgb, C_LIGHT_COLOR, c0.a ; scale down light value
mul_x2 r0.rgb, r0, r1 ; modulate x2 with light colorThis code was taken from here (http://www.gamedev.net/reference/programming/features/cartoon/page2.asp)
Thanks!

CrazyButcher
04-07-2006, 03:04 PM
nvidia had a tool that can do this
http://developer.nvidia.com/object/nvparse.html

Coluna
04-07-2006, 03:39 PM
Thanks !

Coluna
04-10-2006, 11:24 AM
I couldnt link the library to my project...it gaves me a lot f linker errors...does anybody has a DLL version for C++? I know there is one for delphi...