Random Rotate Maxscript Version 1.1

The script rotates the selected meshes in any (or any combination of, or all) axis. Just enable one or more of the axises, adjust minimum, maximum values to your liking, press the random rotate button. Check out the gallery for how to install and run the script.

Download Random Rotate

You can use “random rotate” with my “random scale” script for more randomness.

This slideshow requires JavaScript.

Random Material Assigner for Objects with Multiple MaterialIDs

Works on one or multiple object selections. Script detects the materialID count and creates a multi-sub material(s) for the selected object(s), and changes the diffuse channel with a random color. If there is only one materialID on the object, script simply creates a standart material.

Download Random Material Assigner for Objects with MaterialID

As this is a macroscript, after running it, you need to add it to a quad menu, or an icon on a toolbar, or to a menu. Script’s category is “emrahgunduz.com”.

This slideshow requires JavaScript.

Keep these in mind

  • Created materials are named after the object’ own name.
  • Materials in the multi-sub object will be “Standard”.
  • Changes diffuse channel color with a random one.
  • Works only with poly, mesh or patch object. There is no nurbs or basic object support.

Randomly Delete Objects With Maxscript

The script randomly deletes meshes from the selection. As the script depends on the random numbers created by 3dsmax, the percentage can be %0-1 off what you expected. Just select the meshes you want to randomly delete. Enter a percentage, click the Delete button.

Download Random Delete

This slideshow requires JavaScript.

Random Color Maxscript

I hate how wire coloring (default color max assigns to objects when they first created) works in max. After working a few hours, all objects start to appear in lots of colors which really distract me. So, a few months back, I wrote a script to color them in gray. For sharing, I changed the script, added a gui and some improvements.

Download Random Color

This one can randomly color the selected objects in RGB, or simply red, green, blue or a color of gray. If you need to color every object for ObjectID in post processing, you might need something like this.

This slideshow requires JavaScript.

Random Face Deletion / Selection with Maxscript

For sometime now, some of my friends asked me to write a script for random face selection for poly objects. Here is a simple code for doing exactly what it’s asked for:

sel = selection as array
count = 1

undo on
(
	if sel.count > 0 then
	(
		while count <= sel.count do
		(
			select sel[count]
			count += 1
			
			facenumber = polyop.getNumFaces $
			randomset = #()
			for i=1 to facenumber do
			(
				rand = random 0 100
				if rand < 50 do append randomset i
			)
			
			polyop.deleteFaces $ randomset delIsoVerts:true
		)
	)
)
select sel

It is not hard to write a simple random face select/delete script. This script will go through every selected poly object, and randomly delete some of the faces. I did not add any error checking in this, so if you select any object that’s not a poly, you’ll get an error. You can also disable the viewport update and enable after the faces get deleted. This will make the script run faster on high-poly count objects.

If you are experiencing errors before script deletes any faces, change the random range’s 0 to 1. For more randomness use a big number for the second part of the random statement. 100 seems OK. If you do not want to delete isolated vertices –vertices that do not belong to any faces-, just change delIsoVerts to false. For keeping the original object, just add an Edit Poly modifier and then run the script. By this way, removing the modifier might save you some production time.

Requested addition #1: And, this script will only randomly select faces, but not delete them :

sel = selection as array
count = 1

undo on
(
	if sel.count > 0 then
	(
		while count <= sel.count do
		(
			select sel[count]
			count += 1
			
			facenumber = polyop.getNumFaces $
			randomset = #()
			for i=1 to facenumber do
			(
				rand = random 0 100
				if rand < 50 do append randomset i
			)
			
			subobjectlevel = 4
			polyop.setFaceSelection $ randomset
		)
	)
)
select sel

Requested Addition #2: This one will assign a new material id that is not used on the mesh to the randomly selected polys.

sel = selection as array
count = 1
 
undo on
(
	if sel.count > 0 then
	(
		while count <= sel.count do
		(
			select sel[count]
			count += 1

			facenumber = polyop.getNumFaces $
			randomset = #()
			newID = 0
				for i=1 to facenumber do
				(
					if (polyop.getFaceMatID $ facenumber) > newID do newID = (polyop.getFaceMatID $ facenumber)+1
					rand = random 0 100
					if rand < 50 do append randomset i
				)

			polyop.setFaceMatID $ randomset newID
		)
	)
)
select sel

This slideshow requires JavaScript.