I'm interested in your race track as I am trying something similar. Any chance of video demo?
Sh sh sh shadows . It's tricky but the 3D samples folder that demonstrates it. As object need to be drawn twice, it's cuts the processing time in half.
Normal spotlight
Draw objects
Turn on shadow spot light
Draw objects (again same)
Cast shadow spot light color
For each of a maximum of seven spotlights (num 0 - 7) there is a shadow light and repeated objects drawn (doubled), then another shadow spotlight.
Here's my shadow room low and hires tests:
https://www.youtube.com/watch?v=5k2FRHlL5tI
From 3D Samples folder:
..\Samples\3D\Shadows\Shadows.gbas
Sh sh sh shadows . It's tricky but the 3D samples folder that demonstrates it. As object need to be drawn twice, it's cuts the processing time in half.
Normal spotlight
Draw objects
Turn on shadow spot light
Draw objects (again same)
Cast shadow spot light color
For each of a maximum of seven spotlights (num 0 - 7) there is a shadow light and repeated objects drawn (doubled), then another shadow spotlight.
Here's my shadow room low and hires tests:
https://www.youtube.com/watch?v=5k2FRHlL5tI
From 3D Samples folder:
..\Samples\3D\Shadows\Shadows.gbas
Code (glbasic) Select
// --------------------------------- //
// Project: Shadows
// Start: Thursday, January 19, 2006
// IDE Version: 3.011
// konstante Werte / Constant values
LOCAL image, none, shadow, sphere, donut, cube, spot_ang, lmode, phi, lx
LOCAL ly, lz, i, psi, px, py, pz, j
none = -1
image = 0
donut = 0
cube = 1
sphere = 2
// Create Primitives
CreateTorus (donut, 10, 20, 36, 12, 2, 2, RGB(255,255,255))
CreateCube (cube, -1000, RGB(255, 255, 255))
// Grafiken laden / load graphics
LOADSPRITE "image.bmp", image
//LOADBUMPTEXTURE "bump.bmp", bump
LOCAL mx, my, b1, b2 // compiler warning
WHILE TRUE
// naja... / well...
mx = mx + MOUSEAXIS(0)
// MOUSESTATE mx, my, b1, b2
// 1000 ist weit genug hier / 1000 is far enough here
X_MAKE3D 1, 1700, 45
// ein Winkel für alles / one angle for everything
phi = GETTIMERALL() / 250
// eine Lichtposition / a light position
lx = SIN(-phi*3)*300
ly = 20 //(SIN(3*phi)-COS(4*phi))*100
lz = COS(-phi*3)*300
// Maus X=drehen / Mouse X=turn
X_CAMERA 400*COS(mx),120,400*SIN(mx), 0,0,0
// Licht als Punkt zeichnen / Draw light as dot
X_DOT lx,ly,lz,32,RGB(255,255,255)
// Texture setzen / Set texture
X_SETTEXTURE image, none
X_CULLMODE 1
X_SPOT_LT 0, RGB(255,255,255), lx,ly,lz, -lx,-ly,-lz, 360
// Würfel zeichnen / Draw Cube
X_DRAWOBJ cube, 0
// Donut zeichnen / Draw Donut
X_MOVEMENT 0,0,0
X_ROTATION 45, 1,0,0
X_DRAWOBJ donut,0
// Schatten einschalten / turn on Shadows
X_SPOT_LT -3, 0, lx,ly,lz, -lx,-ly,-lz, 360
// neuzechnen von schatten-werfenden Objekten
// re-draw shadow casting objects
X_MOVEMENT 0,0,0
X_ROTATION 45, 1,0,0
X_DRAWOBJ donut,0
// Schatten zeichnen / draw shadows
X_SPOT_LT -3, RGB(0,0,64), 0,0,0, 0,0,0, 0
// oder / or
// X_MAKE2D, SHOWSCREEN, X_MAKE3D
// zum Zurechtfinden / for navigation
X_DRAWAXES 0,0,0
X_MAKE2D
PRINT my, 0,0
SHOWSCREEN
WEND