I experience major texture flickering (also called Z-fighting) when the camera is about 150000 world units away from two entities.
The first entity is located behind the second entity but the texture of the first entity flickers through the second entity.
Example code:
Code: Select all
EnableExplicit
Enumeration
#Window
#Camera
#Texture1
#Texture2
#Material1
#Material2
#Cube1
#Cube2
EndEnumeration
#CameraSpeed = 1000
Define KeyX
Define KeyY
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
Add3DArchive("Textures", #PB_3DArchive_FileSystem)
If OpenWindow(#Window, 0, 0, 1920, 1080, "Test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window))
EndIf
CreateCamera(#Camera, 0, 0, 100, 100)
CameraRange(#Camera, 0, 1000000)
CreateMaterial(#Material1, LoadTexture(#Texture1, "a.jpg"))
CreateMaterial(#Material2, LoadTexture(#Texture2, "b.jpg"))
CreateCube(#Cube1, 10000)
CreateEntity(#Material1, MeshID(#Cube1), MaterialID(#Material1), 0, 0, 0)
CreateCube(#Cube2, 10000)
CreateEntity(#Material2, MeshID(#Cube2), MaterialID(#Material2), 0, 0, 20000)
Repeat
ExamineMouse()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_A)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_D)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_W)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_S)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
RotateCamera(#Camera, -MouseDeltaY() * 0.05, -MouseDeltaX() * 0.05, 0, #PB_Relative)
MoveCamera(#Camera, KeyX, 0, KeyY)
WindowEvent()
RenderWorld()
If StartDrawing(ScreenOutput())
DrawText(10, 10, Str(CameraX(#Camera)) + " x " + Str(CameraY(#Camera)) + " x " + Str(CameraZ(#Camera)))
StopDrawing()
EndIf
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape)
I can reproduce the issue on both, Windows and Linux, with the latest PureBasic version 5.73. On Windows, I've tested it with DirectX and OpenGL.
Screenshots: https://imgur.com/a/nAX1ufP