SOLVED How to natively create an object with tons of triangles for a test purpose.

Hey guys,

I'm developing an ObjectData plugin with C++ on Windows10, Cinema 4D R23.

I'm getting a crash when I insert my plugin in a subdivision surface and crank up the subdivision editor field to 6. The crash is in Cinema 4D but the culprit is probably my implementation. Just in case I wanted to test this with some native Cinema4D object to see if I can reproduce it, but I'm having a hard time to simply create a PolygonObject with say 100k polygons.

What would be the easiest way to generate such an object? I think I can also reproduce it with less polygons so it doesn't have to be 100k, could be less.

Warm regards,
Georgi.

@mastergog Create a cube, crank up the segmentation to 1000x1000x1000 (doesn't get higher). That's 6 MPolys. Copy a few times, "connect + delete", voila.

If you dare.

@Cairyn hey man thanks for the suggestion!

Actually my object data plugin is no longer crashing, but enters an infinite loop trying to allocate the memory it needs until it sends "Not enough memory" message and tries again. I only have 16GB ram.
This behavior is reproducible with a simple cube with segmentation to 100x100x100, inserted in a subdivision surface object with subdivision editor field set to 6.
I'm not sure if it's a bug guys, but it seems to require a reboot to fix.

Regards,
Georgi.

@mastergog hmm, subdivision of 6? That's 2 to the power of 6 particions, so 64 per original poly.
If you start with a 100 segmentation, you get 6400 per axis, so roughly 41 million polys per side, or 245 million for a six sided cube. And more or less 245 million points (as polys happily share points).
A point is a vector using 8 byte Float64 per axis, so 24 byte all in all. A poly is four indices of points, each a 4 byte Int32. (There are so many Vectors and Floats in the docs that I'm not really sure, but I guess some Maxonian will correct me...) All in all 5.9 billion bytes for the points, and 3.9 billion for the polys.

That might fit into the 16GB RAM, but that memory may be fragmented, and I don't think a point/poly array accounts for that, so finding a continuous slab of memory large enough takes quite some paging/swapping/remapping action on the OS side, and may even fail.

Not sure that qualifies as a bug.

(Why do you want to blast your RAM with objects of that size? What's the ObjectData plugin going to do?)

hi,

doesn't look like a bug to me. With 32g it's doable but take some time and go up to 100% of the ram. (that could maybe be optimized)
Definitely can't go to 7 as the max point number per object is 500 millions.

@Cairyn hit the right numbers even if it's 1001006*4^6 polygons. (for each subdivision, you have 4 times the polygon count)

Add the fact that the subdivision need memory to calculate, it will eat a lot of ram. 6 subdivision is a lot, specially on a high polygon count object.

What kind of object are you creating ?

Cheers
Manuel

@m_magalhaes said in How to natively create an object with tons of triangles for a test purpose.:

@Cairyn hit the right numbers even if it's 100 * 100 * 6 * 4 ^ 6 polygons. (for each subdivision, you have 4 times the polygon count)

I should've been more clear in my first sentence... I calculated per dimension, so it's 2 times per axis per subdivision, so it's 6 sides * 100 * 2^6 * 100 * 2^6 = 6 * 6400 * 6400, so the ultimate point/polygon counts are (approximately) correct. It's ultimately the same as your calculation though as 2^6 * 2^6 = 4096 = 4^6. (With another square factor, that cube would not even fit into 32GB 😊 )

Hey guys, thanks for the explanations.

My only concern is that I can't really do anything besides closing Cinema4D to cancel the operation. Just for reference my plugin is a fluid volume that needs to be visualized in the viewport. This is not an expected workload, stumbled on it by chance, but so can one of the users.

Anyway we can close this thread if it's not a bug.

Regards,
Georgi.