Notifications
Clear all

[Closed] Cobwebs – download

This was a fun little script I wrote over the weekend. I figured I would share so far what I have. There is definitely room for improvement. I’d love to get some feedback on the script and see what other options people would like.

The main feature that I’m working on figuring out is how to web it in a radial fashion so if anyone has further thoughts or r&d on that I’d like to chat.

Check it out.

Cobwebs

137 Replies

Now i see what random function do.
Works nice.
One suggestion:
Add also “Enabled in Renderer” and “Enabled in Viewport”
with “Thickness” option.

Yeah those are definitely good options to add. I figured I’d add them in the next revision.
Thanks for the help again on the random function.

It stop the the splines from creating two end points at the same position in space, as a result creating a dot.

Aside from that its just a matter of figuring out a radial ordering of the verts and then I’ll be able to create a more accurate webbing.

Alright so check this out.
Create a shape with a bunch of splines. Each spline consisting of 3 knots and the select and run the script.
It will create a spline in a radial fashion.
I’m on to something here.

Next update may be sooner than expected.


center = [0, 0, 0]

fn angularSort pt1 pt2 = (
	in coordSys (transMatrix center)
	(
		local ang1 = atan2 pt1.y pt1.x
		local ang2 = atan2 pt2.y pt2.x
		ang1 - ang2
	)
)
		
fn fnSortPoints arr = (
	local count = arr.count

	
	for itm in arr do center += itm
    center /= count
 
    origin = point pos:center

    qsort arr angularSort
 
    for i = 1 to count do format "%
" arr[i]
	delete origin
)

theShape = $Line006

knotsArr = for idx = 1 to (numSplines theShape) collect
(
	getKnotPoint theShape idx 2
)

fnSortPoints knotsArr

numEnds = knotsArr.count
if numEnds >= 2 do
(
	local sp = splineShape()
	idx = addnewSpline sp
	for i = 1 to (numEnds) do
	(
		
		ptA = knotsArr[i]		
		addKnot sp idx #corner #line ptA
	)
	updateShape sp
	sp.wirecolor = yellow
	forceCompleteRedraw()
	select sp
)

To be sure. Works well for me. L o o k:cool:

Also would be cool if add options for dewdrops:lightbulb
Sorry but i send you only the visual ideas.

That would be super simple to do
what kind of due drops would you like to see on the object itself?
More so what kind of controls would you like with that?

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Nothing special, just spheres with path constraint.
Sphere segs value need to be low (due to the performance) and user latter can increase this value.
Spheres radius at the start and end of path(0% and 100%) need to be small and at 50% big.
Like in nature.

I see a bug on ur site

Maxscript > Run Maxscript > Welder.ms

Fixed!
Thanks for the heads up.

Alright so I’m going to add an additional option to allow for the limting of strands created over distances.
With that being said. Right now I have a loop which goes through splines and creates sub strands within the given distance constraints.

How can I add to my while loop that if it cycles through all of the available options and finds none compatible that it stops, because right now it continues to endlessly loop if your min and max is to much.

Hope that makes sense.

To test just make a shape with several splines all which consist of at least 2 knots.
Thanks again guys.

John


disMin = 10
disMax = 50

fn fnRandomLimited arr usedIdx =
(
	numItms = arr.count
	usedItm = arr[usedIdx]
	num = arr[usedIdx]
	
	while num == arr[usedIdx] AND distance num usedItm <= disMin OR distance num usedItm >= disMax do
	(
		num = arr[random 1 numItms]
	)
	print (distance num usedItm)
	return num
)
clearlistener()

sp = $
midPts = #()
midPts = for idx = 1 to (numSplines sp) collect (getKnotPoint sp idx 2)

sp = splineShape()
for i = 1 to midPts.count do
(
	idx = addnewSpline sp
	
	ptA = midPts[i]
	ptB = fnRandomLimited midPts i
	addKnot sp idx #smooth #curve ptA
	addKnot sp idx #smooth #curve ptB
)
updateShape sp
select sp

I must say I really enjoy your feedback gazybara and the fact that you take the time to do nice renders and some visuals to help get the point across.

Special thanks for all the help.
I appreciate it.

Page 1 / 12