I am working on a 3d racing game. Everything works so far, got a nice racing course, a player who camera follows smoothly in loopings and such, as well as three enemies who drive on the track as well. Now, I wanted to apply lights and shading to everything and I read a lot in this forum and tries so many things, but cant make it work properly.
This is the code in short (often speaks more than thousand words):
I tried to include the command:
after the pipeline, and rendered the object agains. I also tried the value of "-2" for toon shading and took some code from the examples file of glbasic:
however I cant get shadows working at all, and the lights arenot very bright. I tried Cullmode 1 and -1 as well as using bump mapping and ambient light. I cant even describe what i did and what failed. I am just an amateuer and hope someone can explaine properly how can i achieve the following things:
draw the objects (racing course, vehicles)
4 bright Spotlights in total for each vehicle.
shading
enclosed a little screenshot (with only 1 enemy, and without skybox) I reduced everything to the bare minimum for these testings:
This is the code in short (often speaks more than thousand words):
Code (glbasic) Select
WHILE TRUE
X_MAKE3D 1, 1000, 90
//Setting the camera
X_CAMERAUP Cam.front, Cam.side, Cam.up
X_CAMERA Cam.x, Cam.y, Cam.z, Cam.dx, Cam.dy,Cam.dz
//Light Rendering
FOREACH e IN Enemies[] //Three enemies in total, shall have a 90degree light at their front vector
X_SPOT_LT e.number, e.color,e.x, e.y, e.z, e.frontx, e.fronty, e.frontz, 90
NEXT
//Object Rendering
FOREACH o IN self.object[]; //All objects are rendered (Racing course, Enemies, Players etc..)
X_MOVEMENT o.x,o.y,o.z
X_SETTEXTURE o.tex,-1
X_DRAWOBJ o.obj ,0
NEXT
X_MAKE2D
SHOWSCREEN
WEND
I tried to include the command:
Code (glbasic) Select
X_SPOT_LT -3, color,x,y, z, 0,0, 0, 360
after the pipeline, and rendered the object agains. I also tried the value of "-2" for toon shading and took some code from the examples file of glbasic:
Code (glbasic) Select
X_LOADSHADER(13, "shader/toon.vert", "shader/toon.frag")
DIMDATA cheap[], .5, 1
DIMDATA nice[], .3, .6, .6, .6, .6, .6, .6, .7, 1, 1, 1, 1, 1, 1, 1, 1
X_SETCELSHADES nice[]
however I cant get shadows working at all, and the lights arenot very bright. I tried Cullmode 1 and -1 as well as using bump mapping and ambient light. I cant even describe what i did and what failed. I am just an amateuer and hope someone can explaine properly how can i achieve the following things:
draw the objects (racing course, vehicles)
4 bright Spotlights in total for each vehicle.
shading
enclosed a little screenshot (with only 1 enemy, and without skybox) I reduced everything to the bare minimum for these testings: