Blitz poly limits

Blitz3D Forums/Blitz3D Programming/Blitz poly limits

*(Posted 2005) [#1]
I used the following code:
Graphics3D 640,480,16
SetBuffer BackBuffer()

Type SurfType
	Field Surface
End Type

Global Mesh = CreateMesh()
Global Surf = 0
Global camera = CreateCamera()
Global VertCount = 0
Global PolyCount = 0
Global SurfaceCount =1

SurfData.SurfType = New SurfType
SurfData\Surface = CreateSurface( Mesh )
Surf = SurfData\Surface

SurfaceCount = CountSurfaces( Mesh )

Global ActPoly=0, ActVert=0

;so cam isnt facing mesh
MoveEntity Camera, 0, 0, -100
TurnEntity Camera, 0, 180, 0

While Not KeyDown(1)
	If KeyDown(1)=1 Then End
	If CountVertices( Surf )>50000						;limit checks
		ActPoly = ActPoly + CountTriangles( Surf )
		ActVert = ActVert + CountVertices( Surf )
		SurfData.SurfType = New SurfType
		SurfData\Surface = CreateSurface( Mesh )
		Surf = SurfData\Surface
		SurfaceCount = CountSurfaces( Mesh )
	EndIf
	If CountTriangles( Surf )>18000						;limit checks
		ActPoly = ActPoly + CountTriangles( Surf )
		ActVert = ActVert + CountVertices( Surf )
		SurfData.SurfType = New SurfType
		SurfData\Surface = CreateSurface( Mesh )
		Surf = SurfData\Surface
		SurfaceCount = CountSurfaces( Mesh )
	EndIf
	For b=0 To 15
		V1= AddVertex( Surf, Rnd( -50, 50 ), Rnd( -50, 50 ), Rnd( -50, 50 ) )
		V2= AddVertex( Surf, Rnd( -50, 50 ), Rnd( -50, 50 ), Rnd( -50, 50 ) )
		V3= AddVertex( Surf, Rnd( -50, 50 ), Rnd( -50, 50 ), Rnd( -50, 50 ) )
		AddTriangle( Surf, V1, V2, V3 )
		VertCount = VertCount +3
		PolyCount = PolyCount +1
	Next
	UpdateWorld
	RenderWorld
	Text 10, 10, "Vertex:"+VertCount
	Text 10, 26, "Polygons:"+PolyCount
	Text 10, 42, "Surfaces:"+SurfaceCount
	Text 10, 80, "Actual Polygons:"+ActPoly
	Text 10, 96, "Actual Vertices:"+ActVert
	Flip
Wend
End


to test the poly limits and vertex limits on Blitz as im making a simple editor for Hunted so I can do lighting etc internally within the Hunted game.

The limits I have come up with are:
~18200 polygons per surface
~54600 vertices per surface

anything over it causes a memory access violation in debug on hitting RenderWorld. Thats why the limiters are in the code above. You can have any number of surfaces, polygons or vertices within the mesh although having to many may slow down ya projects.


John Blackledge(Posted 2005) [#2]
Good info, Edzup, thanks.

I'm going to hang on to your post for when clients ask 'What's the problem with our model?'


*(Posted 2005) [#3]
Maybe mark could add the information and source to the FAQ as it gets asked for quite a lot, its always helpful to know :D