hi there!
I'm writing on the bump/normal-system for my game. (atm bump the levels)
i use Fredborgs DotMyBot example, and have a 'il question....
First of all the code
Everything works fine over here, but i don't know how i could turn/rotate the dot3_light.... it only shines in one direction, no matter in witch direction the cam looks - but i want it to shine in the direction the camera (or better, it's pivot) looks.
with the whole TFormNrmal, TFormPoit etc Stuff i'm not that good friend, you know ;)
maybe fredborg read this, and know a solution?
'have fun'
I'm writing on the bump/normal-system for my game. (atm bump the levels)
i use Fredborgs DotMyBot example, and have a 'il question....
First of all the code
Function UpdateBumpNormals(mesh,light,lighttype=0) n_surf = CountSurfaces(mesh) For s = 1 To n_surf surf = GetSurface(mesh,s) n_vert = CountVertices(surf)-1 For v = 0 To n_vert red2# = 0.0 grn2# = 0.0 blu2# = 0.0 For d3l.Dot3Light = Each Dot3Light If d3l\typ = 1 ; Directional light TFormVector 0,0,1,d3l\ent,0 nx# = TFormedX() ny# = TFormedY() nz# = TFormedZ() TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0 red# = TFormedX() grn# = TFormedY() blu# = TFormedZ() ElseIf d3l\typ = 2 ; Point light TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0 nx# = -TFormedX() ny# = -TFormedY() nz# = -TFormedZ() TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),mesh,0 red# = TFormedX()-EntityX(d3l\ent,True) grn# = TFormedY()-EntityY(d3l\ent,True) blu# = TFormedZ()-EntityZ(d3l\ent,True) d# = Sqr(red*red + grn*grn + blu*blu) red = red/d grn = grn/d blu = blu/d Else RuntimeError "Do it yourself, will ya?" End If dot# = (red*nx + grn*ny + blu*nz) If dot<0.0 Then dot = 0.0 red# = ((1.0+(red*dot))*127.5)*d3l\mul grn# = ((1.0+(grn*dot))*127.5)*d3l\mul blu# = ((1.0+(blu*dot))*127.5)*d3l\mul If red<0 Then red = 0 If grn<0 Then grn = 0 If blu<0 Then blu = 0 red2# = red2+red grn2# = grn2+grn blu2# = blu2+blu Next VertexColor surf,v,red2,grn2,blu2 Next Next End Function
Everything works fine over here, but i don't know how i could turn/rotate the dot3_light.... it only shines in one direction, no matter in witch direction the cam looks - but i want it to shine in the direction the camera (or better, it's pivot) looks.
with the whole TFormNrmal, TFormPoit etc Stuff i'm not that good friend, you know ;)
maybe fredborg read this, and know a solution?
'have fun'