max size limit (memory access violation)

Blitz3D Forums/Blitz3D Programming/max size limit (memory access violation)

yoshark(Posted 2012) [#1]
I found this really cool model of a building that is extremely realistic....when I try to run the program though, blitz3d keeps telling me theres a memory access violation.

heres my code for the program to run...
[bbcode]
;giant building

Graphics3D 1280,960
SetBuffer BackBuffer()

;camera
camera=CreateCamera()
Cam_range=100000

;light
light=CreateLight()

;building
building=LoadMesh("giant building.3ds")
ScaleEntity building,.1,.1,.1

;pro run

While Not KeyDown(1)

If KeyDown(17)=True Then MoveEntity camera,0,0,5
If KeyDown(17)=True Then cam_range=cam_range+1
CameraRange camera,1,cam_range
If KeyDown(30)=True Then MoveEntity camera,-5,0,0
If KeyDown(31)=True Then MoveEntity camera,0,0,-5
If KeyDown(32)=True Then MoveEntity camera,5,0,0

UpdateWorld

RenderWorld

mxs#=mxs#+MouseXSpeed()/4
mys#=mys#+MouseYSpeed()/4

If mxs#<0 Then mxs#=360
If mxs#>360 Then mxs#=0
If mys#>80 Then mys#=80
If mys#<-80 Then mys#=-80

RotateEntity camera,mys#,-mxs#,0
MoveMouse 400,300

Flip

Wend
End
[/bbcode]

the file size of the building (a .3ds file) is 4.34 MB......anyone know what the maximum size of a mesh on blitz3d can be...the building also has 85,898 polygons and 173,932 vertices...please help...thanks


GNS(Posted 2012) [#2]
It's the number of vertices most likely. There's a hard limit of ~65535 verts per surface and going over that will cause a MAV. Loading the mesh as an animated mesh (LoadAnimMesh() rather than LoadMesh()) might work.


yoshark(Posted 2012) [#3]
worked perfictly,thanks so much for your help...can u create a collision between a loadanimmesh and a mesh...trying to create collision between player and building...

Last edited 2012


Yasha(Posted 2012) [#4]
Yes, you can. Anything that counts as an entity can have collisions applied to it.

However, an animated mesh loads as a hierarchy of sub-entities rather than just one big mesh (that's probably why this worked at all), meaning that most of the building will likely be children of a root pivot or something like that.

If you want the building to have polygon-collisions (seems the likely option), all you should need to do is pass True as the optional "recursive" flag to EntityType, and it will apply the collision type to the whole hierarchy - all of the automatically-loaded children - instead of just the root (since polygon collisions take their data from the mesh, you don't need to navigate the hierarchy yourself to do something like apply radii).


yoshark(Posted 2012) [#5]
k thanks....


GfK(Posted 2012) [#6]
An 85,000 poly building isn't exactly 'game ready'. You need much lower poly stuff.


Rroff(Posted 2012) [#7]
^^ Depends how large it is in terms of physical space and if your doing any kind of "zoning" for PVS or similiar culling. Most modern PCs will handle 100+K polygons in a scene fine tho so depends a bit on your target audience.