Alright here we go!
Updates
- works with selecting multiple objects making a cobweb between all of them
- gravity options for choosing direction
- gravity strength variation randomizing
- new updated iteration mode for sub strands allows for building sub strands on sub strands
- added distance limiting max/min
- seeding for varied results
things to come…
- Radial spline creation option
- Sub strand offsets
- dew drops
Denis…
Thanks for the idea of doing it backwards. You’ll see in my latest version that i check the length of the spline after each one is created and if it is long enough it is left alone otherwise it is delete.
In the next one I’ll change it to check the distance before it creates the spline and then if it meets the requirements to go ahead and create it, otherwise move on.
Thanks again.
it looks cool but not as a web… sorry. i remember some article about how to generate a web. i will try to find it. best!
Yeah. I agree. It reminds me of those nest you find in trees that are filled with slugs.
As for webs those have a radial sprial effect on the sub strands. I’m going to add the spiral effect tomorrow and see how much that brings to it. It should be pretty straight forward to implement. If you happen to find that article let me know. I’ll see what I can do. I’m going to make the radial sorting an option invade people want to use it to creation cables or something instead.
We will see.
I look forward to seeing your test renders!
This concept is my little contribution to your script
Nothing special, but do the job. Need some adjusments. Just run the code and you’ll see
what is the problem.
(
local targ1 = dummy name:"Targ1" pos:[-100,50,100]
local targ2 = dummy name:"Targ2" pos:[100,-50,100]
--create webline
fn createWebLine &webline targ1pos targ2pos sinking:0.3 =
(
dist = (distance targ1pos targ2pos)/2.0
dir = normalize (targ2pos-targ1pos)
midKnotpos = targ1pos + dir * dist
midKnotpos.z -= (dist*sinking)
posArr = #(targ1pos, midKnotpos, targ2pos)
webline = splineShape name:"WebLine" wirecolor:gray
addNewSpline webline
for k in 1 to 3 do (addKnot webline 1 #smooth #curve posArr[k])
updateshape webline
)
createWebLine &webline targ1.center targ2.center
--calculate drops radius and gadient wirecolor
fn updownRadius cnt: inc: =
(
local negativeVal = false
local radArr = #()
half = if mod cnt 2 != 0 then (negativeVal = true ; (cnt-1)/2) else (cnt/2)
--calculate radius
radArr = for r in 1 to 50 by (50/half) collect (r*inc)
revRadArr = for i in radArr.count to 1 by -1 collect radArr[i]
-- wirecolor
gradArr = for g in 1 to half collect (255.0/half)*(g-1)
revGradArr = for m in gradArr.count to 1 by -1 collect gradArr[m]
if negativeVal == true then
(
input1 = (radArr[radArr.count] - radArr[radArr.count-1]) + radArr[radArr.count]
input2 = (gradArr[gradArr.count] - gradArr[gradArr.count-1]) + gradArr[gradArr.count]
radArr = join (append radArr input1) revRadArr
gradArr = join (append gradArr input1) revGradArr
)
else
(
radArr = join radArr revRadArr
gradArr = join gradArr revGradArr
)
return #(radArr, gradArr)
)
fn createDrops cnt: inc: rad: seg: targ: =
(
for d = 1 to cnt do
(
rgArr = (updownRadius cnt:cnt inc:inc)
rA = rgArr[1] ; gA = rgArr[2]
drop = (GeoSphere name:(uniquename "Drop") radius:rA[d] segs:seg wirecolor:[gA[d], gA[d], gA[d]])
drop[3][1].track = path path:targ constantVel:true percent:(100.0 / cnt * (d-1)) follow:on allowUpsideDown:on
)
)
createDrops cnt:30 inc:0.1 rad:2 seg:4 targ:webline
)
To do list:
– add random position on the curve to achive more natural look
– if you use ineractve creation of drops set segs value to 1.
Correction…they make me think of those “bag worms” people find in their trees.
I like the direction this is going a lot. I understand it doesn’t look like the typical cobwebs…I’ve gear mine more towards the random look like this
ReferenceImage
Thanks gazybara for the code. I’m going to try it out now.