[3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

All bugs related to the 3D engine
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

[3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

Post by falsam »

This code crashed when TileCountX and TileCountZ > 255

Code: Select all

InitEngine3D() 
InitSprite() 

OpenWindow(0, 0, 0, 640, 480, "Plane example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 640, 480, 0, 0, 0)

; Light
CreateLight(#PB_Any, RGB(25, 25, 180), -5, 10, 5, #PB_Light_Point)

; Camera
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 2, 1, 3, #PB_Absolute | #PB_Local)
CameraLookAt(0, 0, 0, 0)

; Create the plane and attach it to the scene
CreatePlane(0, 10000, 10000, 1000, 1000, 0, 0)
CreateEntity(0, MeshID(0), #PB_Material_None)

Repeat
  RenderWorld()
  FlipBuffers()
Until WaitWindowEvent(1) = #PB_Event_CloseWindow
[Edit] CreatePlane(#Mesh, TileSizeX, TileSizeZ, TileCountX, TileCountZ, TextureRepeatCountX, TextureRepeatCountZ)
Last edited by falsam on Tue Mar 28, 2017 12:44 pm, edited 1 time in total.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: [3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

Post by IdeasVacuum »

Hi falsam

I don't understand your snippet - it does not have a Tile Count?

I do get a crash though:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: ...sers\Chris\AppData\Local\Temp\PureBasic_Compilation0.exe
abnormal program termination
Edit: Ah, I see it now - TileCountX/Z are parameters of CreatePlane(). Crashes regardless of TileSizeX/Z.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: [3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

Post by Samuel »

The mesh is exceeding 65536 indices (16 bit limit) which is why it's crashing. You'll need to break the plane into multiple meshes.
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: [3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

Post by falsam »

Thanks Samuel.

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: [3D] [PB 5.60] Plane TileCountX and TileCountZ limit Max

Post by IdeasVacuum »

Hi Samuel

256 * 256 = 65536

Code: Select all

CreatePlane(0, 2, 2, 256, 256, 0, 0) ; = Crash
255 * 255 = 65025

I know I'm not comparing apples with apples but 65,025 tiles in a mesh is not that many in a typical CAD System that has to process, for example, scanned data (.STL file).

If the workaround is to define the plane with multiple meshes, can they then be joined so that the plane can be manipulated/deformed as one entity?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply