All shadow modes where working good, Additive, Modulative and TextureAdditive, then I added a sphere and unfortunately
TextureAdditive disappeared !!!
I don´t know what else to do, here´s the code, if somebody knows how to fix it please share, if someone finds this useful just keep it
Code: Select all
ScreenX = GetSystemMetrics_(#SM_CXSCREEN)
ScreenY = GetSystemMetrics_(#SM_CYSCREEN)
InitEngine3D(#PB_Engine3D_DebugLog)
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,ScreenX,ScreenY,"Cornell Box",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,ScreenX,ScreenY,1,0,0,#PB_Screen_WaitSynchronization)
KeyboardMode(#PB_Keyboard_AllowSystemKeys)
;Create Red Wall
CreateTexture(1,32,32)
StartDrawing(TextureOutput(1))
Box(0,0,32,32,RGB(205,0,0))
StopDrawing()
CreateMaterial(1,TextureID(1))
CreateCube(1,1)
CreateEntity(1,MeshID(1),MaterialID(1),-16,0,0)
ResizeEntity(1,1,33,32)
;Create Green Wall
CreateTexture(2,32,32)
StartDrawing(TextureOutput(2))
Box(0,0,32,32,RGB(0,205,0))
StopDrawing()
CreateMaterial(2,TextureID(2))
CreateCube(2,1)
CreateEntity(2,MeshID(2),MaterialID(2),16,0,0)
ResizeEntity(2,1,33,32)
;Create Back Wall
CreateTexture(3,32,32)
StartDrawing(TextureOutput(3))
Box(0,0,32,32,RGB(245,245,245))
StopDrawing()
CreateMaterial(3,TextureID(3))
CreateCube(3,1)
CreateEntity(3,MeshID(3),MaterialID(3),0,0,-16)
ResizeEntity(3,32,32,1)
;Create Ceiling
CreateTexture(4,32,32)
StartDrawing(TextureOutput(4))
Box(0,0,32,32,RGB(245,245,245))
StopDrawing()
CreateMaterial(4,TextureID(4))
CreateCube(4,1)
CreateEntity(4,MeshID(4),MaterialID(4),0,16,0)
ResizeEntity(4,31,1,32)
;Create Floor
CreateTexture(5,32,32)
StartDrawing(TextureOutput(5))
Box(0,0,32,32,RGB(245,245,245))
StopDrawing()
CreateMaterial(5,TextureID(5))
CreateCube(5,1)
CreateEntity(5,MeshID(5),MaterialID(5),0,-16,0)
ResizeEntity(5,31,1,32)
;Create Blue Box
CreateTexture(6,32,32)
StartDrawing(TextureOutput(6))
Box(0,0,32,32,RGB(0,0,245))
StopDrawing()
CreateMaterial(6,TextureID(6))
CreateCube(6,1)
CreateEntity(6,MeshID(6),MaterialID(6),-8,-10,-4)
ResizeEntity(6,6,12,6)
RotateEntity(6,0,30,0)
;Create Sphere
CreateTexture(7,32,32)
StartDrawing(TextureOutput(7))
Box(0,0,32,32,RGB(245,245,0))
StopDrawing()
CreateMaterial(7,TextureID(7))
CreateSphere(7,4,32,32)
CreateEntity(7,MeshID(7),MaterialID(7),8,-10,4)
;Create Light
AmbientColor(RGB(4,4,4))
CreateLight(0,RGB(245,245,205),0,13,0)
LightAttenuation(0,500,0.4)
;Create Camera
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,53,#PB_Absolute)
WorldShadows(#PB_Shadow_Additive,500,0,1024)
Repeat
WaitWindowEvent(1)
ShowCursor_(0)
ExamineKeyboard()
; Use arrow keys to rotate and fly in/out
If KeyboardPushed(#PB_Key_Left)
KeyX=-1
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX=1
Else
KeyX=0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY=-1
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY=1
Else
KeyY=0
EndIf
MoveCamera(0,KeyX,0,KeyY)
CameraLookAt(0,0,0,0)
RenderWorld()
FlipBuffers()
; When any system key combo is pressed, minimize to tray
If IsScreenActive()=0
ShowWindow_(WindowID(0),#SW_SHOWMINIMIZED)
ShowCursor_(1)
EndIf
Until KeyboardPushed(#PB_Key_Escape) Or WindowEvent() = #PB_Event_CloseWindow