My main interest is 3D, mainly for realtme architectural visualisation.
I have been fussing around quit a bit now with the 3d functionality, at first I thought it couldn't do very much

So, in my quest of finding ou wht's possible and what not, I messed around quite some time trying to get some shadows on my terrain, but nothing worked. Lastly I have found this thread and fortunately found this thread. My luck

But a few questions remain...
1. Is it possible to have shadows on terrains? I couldn't manage to do it.
2. AmbientColor doesn't do anything, neither the last shadow.pb nor in my terrain script, which btw. is simply a poked version of the terrain of the examples. I added other meshes from xsi, lights and '''shadows'''
But even tere no go with AmbientColor. MaterialAmbientColor on the other hand works fine.
3. Where do I have to put WorldShadows? I first had it after the skydome (before the repeat proc) and it would slow the window to a crawl. At fullscreen it behaved normaly. Then I moved WorldShadows at the top, directly under If Screen3DRequester() and it even worked in a window (besides the shadows of course

Heres my xsitestterrain if you would like to have a look. You ca simply change the mesh/texture/animation to the standard values Robot.mesh/...
if you want to test it
Thx;
; ------------------------------------------------------------
;
; PureBasic - Terrain
;
; (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 5
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data\" , #PB_3DArchive_FileSystem)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
WorldShadows(#PB_Shadow_Additive)
AmbientColor(RGB(128,128,128))
CreateMaterial (0, LoadTexture(0, "Terrain_Texture.jpg"))
AddMaterialLayer(0, LoadTexture(1, "Terrain_Detail.jpg"), 1)
CreateTerrain("Terrain.png", MaterialID(0), 1, 1, 1, 4)
LoadMesh (0, "test1.mesh")
CreateMaterial(1, LoadTexture(1, "jaiqua_red20.jpg"))
MaterialAmbientColor(1,RGB(100,100,100))
CreateEntity(0, MeshID(0), MaterialID(1), 128,0,128 )
CreateEntity(1, MeshID(0), MaterialID(1), 120, 0, 128)
CreateEntity(2, MeshID(0), MaterialID(1), 136, 0, 128)
EntityRenderMode(0,#PB_Entity_CastShadow)
EntityRenderMode(1,#PB_Entity_CastShadow)
EntityRenderMode(2,#PB_Entity_CastShadow)
AnimateEntity(0, "Jaiqua_walk_Preset_Clip")
CreateLight(0, RGB(0,0,255), 120, 20, 120) ; Blue light
CreateLight(1, RGB(255,0,0), 140, 20, 130) ; Red light
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0, 128, 25, 128)
SkyDome("Clouds.jpg",10)
Repeat
Screen3DEvents()
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
If ExamineMouse()
MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
EndIf
Height.f = TerrainHeight(CameraX(0), CameraZ(0))
EntityLocate (0, EntityX(0), TerrainHeight(EntityX(0),EntityZ(0)),EntityZ(0))
EntityLocate (1, EntityX(1), TerrainHeight(EntityX(1),EntityZ(1)),EntityZ(1))
EntityLocate (2, EntityX(2), TerrainHeight(EntityX(2),EntityZ(2)),EntityZ(2))
RotateCamera(0, MouseX, MouseY, RollZ)
MoveCamera (0, KeyX, -CameraY(0)+Height+8, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
