[Closed] SDK Object Plugin class
Hi, I have written a small Object plugin using the SimpleObject2 Class. When its a low poly objects, its fine, but when the Object has too many Polys, it gets stuck on the Transforming Vertices for a while before rendering. So is this due to the Class I am using ? Do I need to use a different class instead to get better results with high Poly Objects ?? Thanks
how much is “too many”?
is this due to the Class I am using ?
it’s very unlikely. this is due probably to your mesh creation algorithm
Its starts to hang on the Tranform vertices the more polys you have in the object, but I would say it gets a bit too long after about 500, 000 polys.
Ahhh ok, I will try and change the way I build my meshes then. I am using Paramblocks to hold some data used within the BuildMesh function, would that slow it down ?
do you put anything into a Paramblock during doing the BuildMesh? don’t do it!
“Transforming vertices” = your BuildMesh function.
Some questions:
-did you build in Release mode? Debug mode runs much, much slower
-how complex is your BuildMesh function? What kind of mesh are you building? 500,000 isn’t very many polygons.
Some options:
-Cache various parameters. For example, if you need to read from a paramblock, don’t do it inside of a loop. Cache your values outside of loops.
-Profile/time various parts of your BuildMesh function to find where the bottleneck is
-Multithread your BuildMesh function (the easiest way to do this is to set how many faces/verts your final mesh will have, then give each thread a chunk of the mesh to process).
I’m only getting data from the paramblocks, not saving it.
Yep, it is in Release Mode, so that shouldn’t be an issue.
I wouldn’t say its over complex at all. I’ve even gone back to my first copy off it and its still doing it
After testing it, the real issue I’m having is with Instances. As 500, 000 polys does it in no time, but if I start put instances in, the slower and slower it gets the more I have.
E.G a scene with 8 Objects with my plugin ( each different poly count, but highest is 500, 000 on one object but most are about 25, 000) with around 250 instances per object. Its stays on the Transforming verts for about 2 minutes before it can render.
I have started timing the BuildMesh function and the Object with 500, 000 polys takes 0.17 seconds to do …
With the Multithreading, will the MaxSDK::PerformanceTools::ThreadTools work ? or do I need to do something else ?
Thanks for all your help !!
.17 seconds for 500,000 polys sounds about right. I wouldn’t even bother multithreading if that’s the time you’re getting.
So you’re saying in your scene you have 8×250 instances of your object? 2 minutes of pre-calc using Scanline renderer isn’t surprising then. Have you tried other renderers? VRay handles instances pretty efficiently, for example.
Ahh thats ok then. Yeah, my issue is with the instances then. Well I am using the VRay renderer atm xD so not sure whats going on …