Shadow Problem
Posted: Thu Jan 17, 2013 1:11 pm
making a box model in milkshape, then exporting it to Ogre Mesh, the resulting file box.mesh show a shadow in the attached code. but using OgreAssimpConverter to convert it to Mesh "OgreAssimpConverter box.obj" will give a file box_obj.mesh and this does not show a shadow. looking at the both *.mesh files in notepad the first one have this info [MeshSerializer_v1.40] , and the second one [MeshSerializer_v1.8]
so what is the problem
attached the modified from the Example\3D\WorldShadows.pb
the files box.obj , box.mesh , box_obj.mesh attached here
http://www.mediafire.com/?ab5upriifgo46za
copy it to Examples\3D\Data\Models
WorldShadows.pb copy it to Examples\3D folder (added one box in the place of the sphere):
so what is the problem
attached the modified from the Example\3D\WorldShadows.pb
the files box.obj , box.mesh , box_obj.mesh attached here
http://www.mediafire.com/?ab5upriifgo46za
copy it to Examples\3D\Data\Models
WorldShadows.pb copy it to Examples\3D folder (added one box in the place of the sphere):
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - ShadowColor
;
; (c) 2012 - Fantaisie Software
;
; ------------------------------------------------------------
;
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
Define DebugBody
#CameraSpeed = 1
If InitEngine3D()
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts",#PB_3DArchive_FileSystem)
Add3DArchive("Data/Packs/desert.zip", #PB_3DArchive_Zip)
Add3DArchive("Data/Models", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
KeyboardMode(#PB_Keyboard_International)
WorldShadows(#PB_Shadow_Modulative, -1, RGB(0, 0, 255))
;Materials
;
CreateMaterial(1, LoadTexture(1, "Wood.jpg"))
CreateMaterial(2, LoadTexture(2, "Dirt.jpg"))
; Ground
;
CreatePlane(0, 100, 100, 10, 10, 15, 15)
CreateEntity(0, MeshID(0), MaterialID(2))
EntityRenderMode(0, 0)
; Meshes
;
CreateCube(1, 2)
CreateSphere(2, 2)
CreateCylinder(3, 1, 4)
LoadMesh(4, "box.mesh") ; cast a shadow
;LoadMesh(4, "box_obj.mesh") ;does not cast a shadow
CreateEntity(4, MeshID(4), MaterialID(1), 0, 1, 0)
ScaleEntity(4,15,15,15)
; Entities
;
CreateEntity(1, MeshID(1), MaterialID(1), -5, 1, -5)
CreateEntity(2, MeshID(2), MaterialID(1), 0, 8, 0)
CreateEntity(3, MeshID(3), MaterialID(1), 5, 2, 5)
; Camera
;
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 10, 20, #PB_Absolute)
;SkyBox
;
SkyBox("desert07.jpg")
; Light
;
CreateLight(0, RGB(255, 255, 255), 300, 90, -300)
AmbientColor(RGB(20, 20, 20))
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
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
MoveCamera (0, KeyX, 0, KeyY)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
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