MaterialBlendingMode and Shadows
Posted: Wed Feb 13, 2013 6:53 am
When using MaterialBlendingMode (while using #PB_Material_AlphaBlend as the mode)
the World Shadows will not appear on that material.
So I'm wondering if there is a workaround or if someone can point out how to make this work.
the World Shadows will not appear on that material.
So I'm wondering if there is a workaround or if someone can point out how to make this work.
Code: Select all
;**********PRESS ESC TO EXIT*************
#CameraSpeed = 10
#CameraMove = 1
If InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
ExamineDesktops()
DeskWid=DesktopWidth(0)
DeskHei=DesktopHeight(0)
OpenWindow(0, 0, 0, DeskWid, DeskHei, "Test", #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, DeskWid, DeskHei, 0, 0, 0)
Define.f KeyX, KeyY, MouseX, MouseY
CreateTexture(0, 32, 32)
StartDrawing(TextureOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels | #PB_2DDrawing_AlphaBlend)
Box(0, 0, 32, 32 ,RGBA(0,150,150,100))
StopDrawing()
CreateTexture(1, 256, 256)
StartDrawing(TextureOutput(1))
DrawingMode(#PB_2DDrawing_AllChannels | #PB_2DDrawing_AlphaBlend)
Box(0, 0, 256, 256, RGBA(0, 250, 0, 255))
Box(4, 4, 248, 248, RGBA(255, 0, 0, 100))
Circle(127, 127, 50, RGBA(0, 180, 0, 155))
StopDrawing()
CreateMaterial(0, TextureID(0))
CreateMaterial(1, TextureID(1))
MaterialBlendingMode(0, #PB_Material_AlphaBlend)
MaterialBlendingMode(1, #PB_Material_AlphaBlend)
;MaterialSpecularColor(0,RGB(255, 255, 255))
SetMaterialColor(0, #PB_Material_SpecularColor, RGB(255,255,255))
MaterialShininess(0,10)
CreateLight(0, RGB(50, 50, 50), 500, 200 , 1000)
;LightColor(0, RGB(250, 200, 200), #PB_Light_SpecularColor)
SetLightColor(0, #PB_Light_SpecularColor, RGB(250,200,200))
CreatePlane(2, 5000, 5000, 1, 1, 1, 1)
CreateEntity(2,MeshID(2),MaterialID(1), 0, -190, 0)
CreateCube(1,200)
CreateEntity(1, MeshID(1), MaterialID(0),0,0,0)
CreateCube(3,200)
CreateEntity(3, MeshID(3), MaterialID(0),-200,-500,-200)
WorldShadows(#PB_Shadow_Modulative, 1000, RGB(50,50,50))
CreateCamera(0, 0, 0, 100, 100)
;CameraLocate(0, -200, 200, 850)
MoveCamera(0, -200, 200, 850 , #PB_Absolute)
CameraLookAt(0,0,0,0)
Repeat
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraMove * 0.05
MouseY = -MouseDeltaY() * #CameraMove * 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
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End


