3D how use lights?

C

cambalinho

Guest
i have found 1 problem with d3d_draw_block() because the repeats aren't compatible with texture size. so i use the d3d_draw_wall() for fix that compatible.
now i'm trying using the light(on Draw GUI End event):
Code:
d3d_set_lighting(true);
d3d_light_enable(1,false);
d3d_light_define_point(1, x+cos(direction*pi/180),y-sin(direction*pi/180),rotatez,1000,c_white);
//d3d_light_define_direction(1,x,y,-1,c_white);
d3d_light_enable(1,true);
but i see some problems:
1 - some wall faces still be black;
2 - i must use '1000' for see the floor?

what i'm doing wrong?
 
C

cambalinho

Guest
finaly i found the problems:

1 - the z of the light must be more above the floor, or we can't see the floor correctly;
2 - when we use d3d_draw_wall() or d3d_draw_floor(), be carefull about the X1, Y1, Z1 and X2, Y2, Z2 coordenates. because sometimes we can change the order;
3 - like i said on 1, the distance between the light and wall is very important or, when it's close to the wall, the wall will be dark instead white.
Code:
d3d_light_define_point(0,x,y,200,2500,c_white);
d3d_light_enable(0,true);
PS: test the Z and light range(inclued X and Y wall distance) for you see the diference.

my camara\player object have the light, the position light it's the camara\player position.
but i need sugestion: if the light moves with camara, how can i avoid that the light go to close to the wall?
 
Top