Problem using Convex Decomposiition (V-HCAD and HCAD)

Report crashes, strange behaviour, or apparent bugs
Post Reply
PvtSchneewitchen
Posts: 9
Joined: 12 Jul 2019, 09:37

Problem using Convex Decomposiition (V-HCAD and HCAD)

Post by PvtSchneewitchen » 10 Jan 2020, 08:23

Hi guys,

i have encountered a problem using the two methods of convex decomposition (HACD and V-HACD). Anytime i use V-HACD, the result of all next HACD-Decompisitions are corrupted.

I have different kind of meshes that i load into my scene. Depending on the kind of mesh it is better to use either HACD or V-HACD. Here is my example code:

Code: Select all

	
	if(nObjectType == 1)then
		--V-HACD
		sim.addStatusbarMessage("simUtils: Convex decomposition of Bin...")
		local tIntParams = {0, 0, 0, 0, 0, 100000, 20, 4, 4, 64}
		local tFloatParams = {0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.05, 0.05, 0.001, 0.0001}
		nDecomposedHandle= sim.convexDecompose(nObjectHandle, 129, tIntParams, tFloatParams)
	elseif(nObjectType == 2)then
		--HACD
		sim.addStatusbarMessage("simUtils: Convex decomposition of Workpiece...")
		local tIntParams = {1, 650, 400, 4, 0, 0, 0, 0, 0, 0}
		local tFloatParams = {0.01, 30.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
		nDecomposedHandle= sim.convexDecompose(nObjectHandle, 25, tIntParams, tFloatParams)
	else
		error("simUtils: Wrong object type for decomposition")
	end
Now if i load an object with type 2 that is decomposed with HACD it works and looks like that:
Image

If i load object type 1 decomposed with V-HACD and then again the same object type 2 the result looks like that:
Image
Also the computation time is much longer for the second HACD-Decomposition.

I suggest that if i once use V-HACD, all following decompositions are done with V-HACD too, no matter which parameters i pass to the function.


Am i doing something wrong with the function calls or is this really a bug?

coppelia
Site Admin
Posts: 7691
Joined: 14 Dec 2012, 00:25

Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Post by coppelia » 13 Jan 2020, 08:46

Hello,

indeed, there is a bug! A not-so-satisfactory workaround would be to first handle all shapes that require the HACD algorithm, then all shapes that require the V-HACD algorithm... but once your have invoked the V-HACD algorithm from the API, there is no way back to the HACD algorithm except for enabling it via the GUI again.
Or... you wait for the V.4.0.0.rev4 release, out probably by the end of the day.

Cheers

PvtSchneewitchen
Posts: 9
Joined: 12 Jul 2019, 09:37

Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Post by PvtSchneewitchen » 13 Jan 2020, 11:01

coppelia wrote:
13 Jan 2020, 08:46
Hello,

indeed, there is a bug! A not-so-satisfactory workaround would be to first handle all shapes that require the HACD algorithm, then all shapes that require the V-HACD algorithm... but once your have invoked the V-HACD algorithm from the API, there is no way back to the HACD algorithm except for enabling it via the GUI again.
Or... you wait for the V.4.0.0.rev4 release, out probably by the end of the day.

Cheers
Thanks for the answer. Unfortunatetly your workaround isn't possible for me because i have a GUI where the User can load the objects in the order he wants. But if you say the rev4 is out soon, it's ok for me to wait.

coppelia
Site Admin
Posts: 7691
Joined: 14 Dec 2012, 00:25

Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Post by coppelia » 13 Jan 2020, 17:19

Ok, rev4 is online!

PvtSchneewitchen
Posts: 9
Joined: 12 Jul 2019, 09:37

Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Post by PvtSchneewitchen » 14 Jan 2020, 09:54

Nice. Tried it out with rev4. Now it Works!

Thanks for the help,
Cheers

Post Reply