Author Topic: Dot3 directional bumpmapping  (Read 1620 times)

0 Members and 1 Guest are viewing this topic.

Dot3 directional bumpmapping
I found this in the Armada 2 directory, maybe the codemonkeys can use this.

Code: [Select]

; This shader does the per-vertex dot3 work.
; It transforms the light vector by the basis vectors
; passed into the shader.
; The basis vectors only need to change if the model's
; shape changes.
; The output vector is stored in the diffuse channel
; (use the menu to look at the generated light vector)
;
;#define v0 v0
;#define V_NORMAL v1
;#define V_TEXTURE v2
;#define V_S v3
;#define V_T v4
;#define V_SxT v5
;#define r3 r3
;
vs.1.0

; Transform position to clip space and output it
dp4 oPos.x, v0, c[2]
dp4 oPos.y, v0, c[3]
dp4 oPos.z, v0, c[4]
dp4 oPos.w, v0, c[5]

; transform light by basis vectors to put it
; into texture space
dp3 r3.x, v3.xyz, c[6]
dp3 r3.y, v4.xyz, c[6]
dp3 r3.z, v5.xyz, c[6]

; Normalize the light vector
dp3 r3.w, r3, r3
rsq r3.w, r3.w
mul r3, r3, r3.w

; Scale to 0-1
add r3, r3, c[0]
mul oD0, r3, c[1]

; Set alpha to 1
mov oD0.w, c[0].w

; output tex coords
mov oT0, v2
« Last Edit: January 23, 2005, 12:16:21 pm by 2136 »
My Sytem

Wer das liest ist doof!

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Dot3 directional bumpmapping
wow great a vertex shader, if only we had a place in the code to put that...
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

  

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Dot3 directional bumpmapping
It's up to you to change that. *hint-hint*
Freelance Modeler | Amateur Artist