Voronoi shatter gibt es einige, möchte man jedoch sein Objekt in Würfel zerlegen wird es schon etwas dünner mit dem Angebot. Hier ein Art, wie man das ganze mit maxscript umsetzten kann (GUI wird noch folgen):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | orgObj = selection[1] -- process slices fn process orgObj = ( if (orgObj != undefined) then ( -- copy original for processing, set pivot and reset all transformations obj = copy orgObj obj.pivot = obj.center obj.pivot.z = obj.min.z resetXForm obj convertToMesh obj objDim = obj.max - obj.min -- size of the quad pieces in scene units PlaneDistance = 8 -- calculate how many cuts in every dimension planeCountX = (objDim.x / PlaneDistance) as integer planeCountY = (objDim.y / PlaneDistance) as integer planeCountZ = (objDim.z / PlaneDistance) as integer --check if count come to the "soft" limit sum = planeCountX * planeCountY * planeCountZ if ( sum > 4000) do ( if queryBox ("Warning: You want to cut \"" + sum as string + "\" pieces. Are you sure that you want to continue?") then ( ) else ( delete obj return false ) ) --set the cut plane matrixes planeSumX = for x = 1 to planeCountX - 1 collect (matrix3 [0,0,-1] [0,1,0] [1,0,0] [(objDim.x / planeCountX * x + obj.min.x - obj.pos.x), (obj.max.y + obj.min.y) / 2, (obj.max.z + obj.min.z) / 2]) planeSumY = for y = 1 to planeCountY - 1 collect (matrix3 [1,0,0] [0,0,1] [0,-1,0] [(obj.max.x + obj.min.x) / 2, (objDim.y / planeCountY * y + obj.min.y - obj.pos.y), (obj.max.z + obj.min.z) / 2]) planeSumZ = for z = 1 to planeCountZ - 1 collect (matrix3 [0,1,0] [-1,0,0] [0,0,1] [(obj.max.x + obj.min.x) / 2, (obj.max.y + obj.min.y) / 2, (objDim.z / planeCountZ * z + obj.min.z - obj.pos.z)]) -- cut object in the x direction objArray1 = #() for a = 1 to planeSumX.count do ( ob1 = copy obj addModifier ob1 (sliceModifier name:"cutPlane1" slice_type:2) ob1.cutPlane1.slice_plane.transform = planeSumX[a] addModifier ob1 (sliceModifier name:"cutPlane2" slice_type:3) if (a-1 > 0) do (ob1.cutPlane2.slice_plane.transform = planeSumX[a-1]) addModifier ob1 (cap_holes()) convertToMesh ob1 join objArray1 #(ob1) ) addModifier obj (sliceModifier name:"cutPlane3" slice_type:3) obj.cutPlane3.slice_plane.transform = planeSumX[planeSumX.count] addModifier obj (cap_holes()) convertToMesh obj join objArray1 #(obj) -- cut objects in y direction objArray2 = #() for b = 1 to objArray1.count do ( for c = 1 to planeSumY.count do ( ob2 = copy objArray1[b] addModifier ob2 (sliceModifier name:"cutPlane1" slice_type:3) if (c+1 <= planeSumY.count) do (ob2.cutPlane1.slice_plane.transform = planeSumY[c+1]) addModifier ob2 (sliceModifier name:"cutPlane2" slice_type:2) ob2.cutPlane2.slice_plane.transform = planeSumY[c] addModifier ob2 (cap_holes()) convertToMesh ob2 join objArray2 #(ob2) ) addModifier objArray1[b] (sliceModifier name:"cutPlane3" slice_type:3) objArray1[b].cutPlane3.slice_plane.transform = planeSumY[1] addModifier objArray1[b] (cap_holes()) convertToMesh objArray1[b] join objArray2 #(objArray1[b]) ) -- cut objects in y direction --objArray3 = #() for i = 1 to objArray2.count do ( for j = 1 to planeSumZ.count do ( ob3 = copy objArray2[i] addModifier ob3 (sliceModifier name:"cutPlane1" slice_type:2) ob3.cutPlane1.slice_plane.transform = planeSumZ[j] addModifier ob3 (sliceModifier name:"cutPlane2" slice_type:3) if (j-1 > 0) do (ob3.cutPlane2.slice_plane.transform = planeSumZ[j-1]) addModifier ob3 (cap_holes()) convertToMesh ob3 ob3.pivot = ob3.center --join objArray3 #(ob3) ) addModifier objArray2[i] (sliceModifier name:"cutPlane3" slice_type:3) objArray2[i].cutPlane3.slice_plane.transform = planeSumZ[planeSumZ.count] addModifier objArray2[i] (cap_holes()) convertToMesh objArray2[i] objArray2[i].pivot = objArray2[i].center --join objArray3 #(objArray2[i]) ) -- clear variables and clean script cache objArray1 = #() objArray2 = #() --objArray3 = #() enableSceneRedraw() CompleteRedraw() gc() ) else ( messageBox "Please select one object first!" ) ) -- fn end process orgObj |
Im Script die Länge der Würfelseite angeben (PlaneDistance), Objekt auswählen und Script ausführen.