highpoly model wont load (crash)

Well, I’ve managed to reproduce the problem. It’s a stack overflow on a heavily recursive function, so it appears to be a Windows-only problem–only Windows has such a limited amount of stack space–which explains why I wasn’t able to reproduce it earlier.

Sigh. I’ll see about putting in a fix. In the meantime, you can work around it by putting the following in your Config.prc file:

egg-mesh 0

or simply by subdividing the terrain into a few smaller pieces.

David

so from this description I’m guessing there’s a limit for the number of faces per geom?

Set this true to convert triangles and higher-order polygons into triangle strips and triangle fans when an egg file is loaded or converted to bam. Set this false just to triangulate everything into independent triangles. 

I think this problem wasn’t present in older versions of the library. I remember loading meshes with millions of faces. Might help.

No, it’s not a limit on number of faces. Nor is it a bug in Panda, exactly. If anything, it’s a limit in Windows. As I said, it works perfectly on Panda on Mac OSX or Linux.

The problem is that the algorithm that examines the polygon mesh in the egg file and determines the best way to lay out triangle strips uses a programming technique called recursion, which isn’t as well-supported on Windows as it is on other operating systems. It works on Windows, most of the time, but for certain shapes and sizes of polygon mesh, it will exceed Windows’ built-in limit and crash.

It’s not even exactly related to the number of polygons. It’s the combination of the number and connectivity of the polygons. In particular, a single large, regular, rectangular mesh of quads–like the one in your terrain.egg file–is very likely to reach this Windows limit more quickly than other connected shapes. That’s why I said you could solve the problem by subdividing the mesh into smaller pieces.

I assure you this is code that hasn’t changed in over a decade. So it’s not a new problem; it’s just a newly-discovered one. You just happened to be the first one to try to load a large rectangular mesh from an egg file on Windows.

David

Well, I triangulated the model in Blender before export and

Does this help in figuring out the issue?

Are you saying it loads after triangulating? That’s not surprising, since as I explained, the crash is tied to the specific connectivity of the mesh, and triangulation changes it from a grid of quads to a grid of triangles.

But there’s no more need to research it further. I understand exactly what the problem is. It’s a stack overflow in a highly recursive function, as I’ve explained three times now. Solving the problem will be a little tricky, though, since it means rewriting the function to limit its recursion.

David

I know, I just thought you didn’t yet know exactly which function it was so I thought this could help.

Lucky me, I always triangulate before export, since the 3D triangulator doesn’t support holes, right ?

Right, the egg triangulator doesn’t support a polygon with a hole in it, though it does support an arbitrarily concave polygon (including a C-shaped polygon).

David