CgTalk Maxscript Challenge 018: "Wear and Tear"


CgTalk Maxscript Challenge 018: “Wear and Tear”

DESCRIPTION: Write a tool that creates damage or wearing on an object. This could include:
[li]Worn edges[/li][li]Surface scratches[/li][li]Holes[/li][li]Chunks added/missing[/li][li]A map layer that adds dirt/scuffs/damage etc[/li][li]Errosion[/li][li]And so forth.[/li][/ul]Thanks to Pokoyfor the suggestion!

    [b]DEADLINE: 25/10/2007 [/b]

[li]Do NOT post your code until the deadline![/li][li]Code from scratch. Try not to use pre-exisitng functions or plugins.[/li][li]Show your script references, if any (eg. Looking at another script to assist you).[/li][li]You are encouraged to ask for help where needed, but try to do it on your own. The maxscript reference is an invaluable resource.[/li][li]Post your final script inside [/li]```
tags (located on your posting toolbar).
[li]Post all code into THIS thread.[/li][li]Post the max version you coded in, plus any maxscript extensions you used. (Thanks galagast!)[/li][li]Try to finish the challenge in a week. There is no definite time limit.[/li][/ul]NOTES: Sorry for the long absence. The usual excuse of a hectic work life applies here.


thanks erilaz :thumbsup:
looking forward to see the code wizards at work!


That’s a good one!
I always thought of doing somthing like this - but I never did.
This challenge motivates a lot. I think I will concentrate on surface scratches…


Out of interest, how many people are working on or thinking about working on this? I’d like to get an idea of what sorts of challenges are entertaining you so far. We seemed to get a great response and conversation from the project management one.


While the subject is relaly intresting and I’d love to see something come out of it, I think its just too much for maxscript. Half of the stuff on the list would require some heavy math to look good on most of the objects and maxscript is SLOW, VERY VERY SLOW on math.

I also think that this challenge is way over my skills at the moment, its really hard to analyze mesh so you can properly break with down with booleans and simulate erosion.


The best way to look at the challenges is “Given my current set of skills and knowledge of what maxscript can do, how can I make something interesting?”

The list above is merely guidelines, you can literally do anything related to the topic.

For example, right now I am making an edge-wearer that takes a selected set of edges and roughs them up a bit. It’s nothing fancy, it merely does a series of tesselations and chamfers with some noise.

I understand that some of the challenges are going to be difficult for people just starting out or even intermediates, but if they weren’t challenging it wouldn’t be a challenge! :slight_smile:

And yes, you’re right, a fully-fledged errosion simulation would kill maxscript. :smiley:


I’m giving this one a try, but I agree that the maths are a little outside my comfort zone. I doubt I’ll be able to make a functioning, reasonable product.

But I guess something’s better than nothing. :slight_smile:


I was thinking about this while commuting, and couldn’t you offload the math to dotNet?


Time is almost up people! How are we doing on this? Any progress? :slight_smile:


Okay, I misread the requirements and wrote something different, but it only too 30 minutes so and it may be useful so here it is anyway.

I may write something a bit more appropriate to the challenge soonish.

	fn ExplodeElements obj =
		convertTo obj editable_poly
		while (polyop.getNumFaces obj > 0) do
			polyop.detachFaces obj (polyop.getElementsUsingFace obj 1) delete:true asNode:true name:(uniqueName ( + "Part"))
		delete obj
	fn CrackUp obj depth detail chaos smoothing quads =
		local arrObjs = #()
		hide obj
		obj = copy obj
		unhide obj
		addModifier obj (cap_holes())
		for i = 1 to depth do
			s = geosphere radius:(length(obj.max-obj.min)/3.0) segs:detail
			s.pos = random obj.max obj.min
			n = noisemodifier()
			sm = smooth();
			addModifier s (n)
			addModifier s (sm)
			n.strength = (obj.max-obj.min)/3
			n.fractal = true
			n.roughness = chaos
			sm.autosmooth = true
			sm.threshold = smoothing
			ss = copy s
			obj1 = copy obj
			ProBoolean.CreateBooleanObjects obj1 #(s) 1 2 0
			ProBoolean.CreateBooleanObjects obj #(ss) 2 2 0
			ProBoolean.SetMakeQuad obj1 quads
			append arrObjs obj1
			convertto obj1 editable_poly
		ProBoolean.SetMakeQuad obj quads
		convertto obj editable_poly
		append arrObjs obj
		for obj in arrObjs do
			ExplodeElements obj
	for sel in selection do
		CrackUp sel 5 6 0.2 30 false

Written in Max2008(demo) should work in Max 9.

Just select some objects and execute.


Alright everyone, this is due today, I really want to see some solutions!


Do people want more time on this or shall I move on? :slight_smile:


since i suggested this to the challenge i take the responsibility and scream ‘please extend the deadline’!!! :slight_smile: i hope that some more scripters will join the challenge though…

i’m afraid i can’t say much on wahooneys attempt since i only have max 8 and the script didn’t work here :shrug:


This is pretty darn cool, and alot of fun to break models up with! If I was better I’d try the challenge myself


I know…the time of the challenge is finish.
But I would like to post my solution for worm edge.
It’s simple but work for me.

Just select the edges and run the script.

    undo on
    	$.edgeChamfer = 1
    	$.EditablePoly.buttonOp #chamfer
    	$.connectEdgeSegments = 2
    	$.EditablePoly.ConnectEdges ()
    	edg = (polyOp.getEdgeSelection $) as array
    	for e=1 to edg.count do
    		ver = polyop.getEdgeVerts $ edg[e]
    		for v=1 to 2 do
    			p=(polyop.getVert $ ver[v] )
    			polyop.setVert $ #{ver[v]} (p + (random -0.5 0.5))

The red number are relative from object scale. Change if necessary…


Hey Aline3d,
I havn’t tried it but it looks pretty cool!
The simpler - the better :slight_smile:

improvement suggestion:
Let the script do it for a whole object instead of selecting edges. Let the script find the edges itself by checking the angle of the faces normals. i.e. Let the user define an angle threshold.

Pity, that I’m full of work at the moment. Your script inspires me…



Very handy tool, thanks.


trés cool wahooney! this fits into one of the early challenges, split it up

< :



hey thats pretty cool i like the edge one it pretty useful


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.