Jump to content

Procedural spiral spiderweb setup w. scene file


Farmfield

Recommended Posts

So Tolya Shuverov posted a great spiderweb tutorial on Vimeo but it made me think about how you would create an adaptive spiral type spiderweb... This is what I came up with. 

And any tips on optimizing/simplifying anything in this setup are greatly appreciated - like the for the spiral point sorting, by distance kinda works, but I would rather have it calculated by prim/point number, I just didn't manage to wrap my head around how to formulate the expression to do it. Or perhaps there's something else. I live to simplify the sh!t out of this kinda setups! :D

 

procedural.web.v01.hip

Edited by Farmfield
Link to comment
Share on other sites

// Detail wrangle.

#define PI 3.1415926535897932384

// Center point.
addpoint(0, {0,0,0});

for (int i = 1; i < chi("number_of_points"); i++)
{
    int spokes = chi("spokes");
    float amplitude = ch("amplitude");
    float angle = fit(i % spokes, 0, spokes, 0, PI * 2);
    vector pos = set(cos(angle) * amplitude * i, sin(angle) * amplitude * i, 0);
    int prim, pt;

    // Spiral segment.
    prim = addprim(0, "polyline");
    pt = addpoint(0, pos);
    addvertex(0, prim, pt - 1);
    addvertex(0, prim, pt);
    setprimgroup(0, "spiral_segment", prim, true);

    // Radial segment.
    prim = addprim(0, "polyline");
    addvertex(0, prim, max(0, pt - spokes));
    addvertex(0, prim, pt);
    setprimgroup(0, "radial_segment", prim, true);
}

Then we just delete everything bounded by wall:

web.png

web.hipnc

  • Like 1
Link to comment
Share on other sites

LOL, that wrangle SOP, that's just rude. xD

On the other hand, as much as I'm into simplifying stuff, less nodes doesn't always mean simplifying it. The VEX block here would grow pretty quickly if you wanted to implement all the functionality you want in an adaptive web - if it's even possible? First off, you want to make it work whatever the geometry input. For that, either you can do a point projection type setup, like I did in this file, and I guess you could do that in VEX - but for a more complex setup, I would probably use scattering on the input geo, to create the initial spokes, just to have the input geometry drive the look of the web. Could you even do that in a simple VEX block? Well, I'm guessing you can do anything, but still, it's gonna start growing...

Capture.PNG

Then you have the sag, though less of a problem in a wrangle SOP, you still have to do it in two steps, first on the spokes, then on the connecting lines. Add to that randomization, adding random stray silk threads, etc... Growing on...

So even if you could do all this in a single VEX block, I personally wouldn't do it like that even if I was competent enough in VEX to be able to, I would want these steps separated. 

That being said and to get back to your wrangle SOP... That's one hell of an efficient way to create a web and disregarding anything else, it's still a mind blowingly cool setup!

Edited by Farmfield
Link to comment
Share on other sites

Yes, you are absolutely right. It is simple and foolproof, good for Engine and assets, and also can be modified to generate simple geometry spiral primitive. For any feature-rich web I would use something complex, like you did, involving Houdini operators and maybe even DOPs. Here is such complex spiderweb workflow from qLib, this time semi-realistic fantasy movie-like. Totally looks like caffeine example: qLib_polywirecurves_webs.hip

Link to comment
Share on other sites

The qLib example is cool, I'll absolutely dissect that setup and see what I can learn from it.

As for my setup, the thing that annoyed me was that I hadn't figure out a way to order the spiral points in the foreach - and once again it turns out I'm overcomplicating it. As the spiral is advancing one point number per step, creating an id attribute in the foreach just using the point number as the value, it will of course order the spiral points from the first to last. Crazy simple, too simple. xD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...