save the picture as "einsteinmonroe.bmp" . texturing a plane with it, and looking to the picture from the side, when we press the backward arrow until the area between the mustaches and the mouth gets fuzzy, we see monroe smiling , like this
but the effect is better when we go gradually from einstein to monroe by walking away like pressing the back arrow in this program, also works by looking from the front.
Code: Select all
#CameraSpeed = 0.1
Enumeration
#texture
#material
#plane
#camera
EndEnumeration
Quit.b = #False
ExamineDesktops()
If OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), "use arrow keys and mouse to rotate/move the camera ... A/Z for up and down ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindowedScreen(WindowID(0), 0, 0, DesktopWidth(0), DesktopHeight(0)-5, 0, 0, 0)
SetFrameRate(60)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(".", #PB_3DArchive_FileSystem)
CreateMaterial(#material, LoadTexture(#texture, "einsteinmonroe.bmp"))
MaterialCullingMode(#material, #PB_Material_NoCulling)
CreatePlane(#plane, 10*209.5/207, 10, 1, 1, 1, 1)
CreateEntity (#plane, MeshID(#plane), MaterialID(#material))
RotateEntity(#plane,90,0,180)
CreateLight(0,RGB(255,255,255),-100,40,30)
AmbientColor(RGB(100,100,100))
CreateCamera(#camera, 0, 0, 100, 100)
MoveCamera(#camera, 5.745074749 , -0.7322137356 , 1.8539280891)
CameraLookAt(#camera, 0, -2.5, 0)
EndIf
SkyDome("clouds.jpg", 100) ;for blue color background
Repeat
Event = WindowEvent()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 1
MouseY = -MouseDeltaY() * #CameraSpeed * 1
EndIf
ShowCursor_(0)
; use arrow keys to rotate and move in/out
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX.f = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX.f = #CameraSpeed
Else
KeyX.f = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY.f = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY.f = #CameraSpeed
Else
KeyY.f = 0
EndIf
If KeyboardPushed(#PB_Key_Z)
MoveCamera (#camera, KeyX, -0.2, KeyY)
ElseIf KeyboardPushed(#PB_Key_A)
MoveCamera (#camera, KeyX, -(-0.2), KeyY)
EndIf
RotateCamera(#camera, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (#camera, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape)
Quit = #True
EndIf
Until Quit = #True Or Event = #PB_Event_CloseWindow