Sphere is defect

Hello,
I just toyed around with a Sphere as a Geometry. When it has more than about 67000+ vertices, it gets broken somehow.
I tried several combinations of z Samples and radial Samples, and it seems to be the product of those two numbers that must be below around 66000.
I analyzed it with wireframe state and that clearly shows that the mesh is clearly defect.

On my machine I get this:
[Java]Sphere s = new Sphere(180,360,1); //okay, all there
Sphere s = new Sphere(181,360,1); //okay, all there
Sphere s = new Sphere(182,360,1); //okay, all there
Sphere s = new Sphere(183,360,1); //okay, all there
Sphere s = new Sphere(184,360,1); //broken (some triangles are missing)
Sphere s = new Sphere(284,360,1); //extremely broken (one third is missing)
[/Java]

It might be true but nonetheless you present no more evidence than you saying its broken. Make a test case and explain what you think is wrong.

Its not a defect, its because it uses a short index buffer, so the maximum number of indices you can use is 65536. You exceed that, and so bad stuff happens

2 Likes

That does also explain the weird shape that I get with visual debugging.

Wonder if this might be also true in general? No more than 65536 indices in any one single mesh? Or can you switch to Integer buffers (max=2Gig…4Gig) ?

@Ogli said: That does also explain the weird shape that I get with visual debugging.

Wonder if this might be also true in general? No more than 65536 indices in any one single mesh? Or can you switch to Integer buffers (max=2Gig…4Gig) ?

This is only true for meshes that use Short index buffers. If you use regular Int index buffers then there is essentially no limit but now your index buffer takes twice the space.

Sphere rightly uses a Short index buffer because 99.999% of all Spheres will be less than 65536 points and anyone trying to do more doesn’t really want the sphere but wants something else that they should be coding themselves.

I think you will start hitting various GPU limitations if you go too large. To paraphrase things which was not said by Bill Gates - nobody should need more than 64k vertices in single mesh.

:wink: Nice one, abies.

@pspeed: Yes, of course. I would split the mesh in many smaller sub parts, just like I did once with jME2, back in the old days. You’re also right about the wasting of buffer space.

Thanks for the many replies and thoughts - I just thought some strange vodoo hit me and now it’s all clear!