Jump to content

Recommended Posts

Ground Zero: pretty obvious what this does....ie. no more bothering with getting the box's height then half it and move it up blah blah blah...just do this 'one' liner....

attribexpression/snippet
    Ground Zero
    @P;@P.y -= getbbox_min(0).y

 

Share this post


Link to post
Share on other sites

(Dirty) LookAt:

attribexpression/snippet
    Lookat 2nd Input
    (@P - getbbox_center(0)) * lookat(getbbox_center(1),getbbox_center(0)) + getbbox_center(0)

Why dirty ? coz it's manipulating points....not actually transforming the object

I used the Pighead as an easy object for illustration. By default, the pig is looking down on its Z axis...so if you are using a pointy object (ie. cone)...point your object down its Z axis first...

 

Edited by Noobini
  • Like 1

Share this post


Link to post
Share on other sites

Align: (to bbox extremities)

(sorry for breaking the 'one line' rule...)

attribexpression/snippet
    Align
    @P;
    int alignaxis = chi("axis");
    float offset = ch("offset");
    if(alignaxis == 0){
        @P.y -= getbbox_min(0).y - offset;
    }
    else if(alignaxis == 1){
        @P.y -= getbbox_max(0).y - offset;
    }
    else if(alignaxis == 2){
        @P.x -= getbbox_min(0).x - offset;
    }
    else if(alignaxis == 3){
        @P.x -= getbbox_max(0).x - offset;
    }
    else if(alignaxis == 4){
        @P.z -= getbbox_min(0).z - offset;
    }
    else {
        @P.z -= getbbox_max(0).z - offset;
    }

 

Share this post


Link to post
Share on other sites

Stack:

attribexpression/snippet
    Stack
    @P;
    int stackaxis=chi("axis");
    float stackoffset=ch("offset");
    @P+=getbbox_center(1);
    if(stackaxis==0){
        @P.x+=getbbox_max(1).x-getbbox_center(1).x-getbbox_min(0).x+stackoffset;
    }
    else if(stackaxis==1){
        @P.y+=getbbox_max(1).y-getbbox_center(1).y-getbbox_min(0).y+stackoffset;
    }
    else{
        @P.z+=getbbox_max(1).z-getbbox_center(1).z-getbbox_min(0).z+stackoffset;
    }

 

Edited by Noobini

Share this post


Link to post
Share on other sites
On 29/6/2017 at 0:06 AM, Noobini said:

Collision Deform:
- 1st input - Geo to deform
- 2nd input - Collider


attribexpression/snippet
    Collision Deform
    length(@P-point(1,"P",nearpoint(1, @P)))<ch("dist")?lerp(@P,@P+@N,ch("deform")*chramp("lip",fit(length(@P-point(1,"P",nearpoint(1,@P))),0,1,0,1))*(1-length(@P-point(1,"P",nearpoint(1,@P))))):@P

 

 

CheapAssCollisionDeform.hipnc

DUDE YOU'RE  AWESOME!!!

Share this post


Link to post
Share on other sites

Planar Symmetrical Taper: unlike a 'normal' Taper that tapers from one end to the other, this taper starts from centre and
symmetrically tapers out to the 2 ends.

EDIT: orig version has hardcode of '- 0.5', now I've used 'cent' instead so you can slide the centre to where ever
you want, but normal usage is when you first apply the Point SOP, create the params then assign Centre  = 0.5 as default.

attribexpression/snippet
    PlanarSymTaper
    @P;
    int plane = chi("TaperPlane");
    float tap = 10*ch("Taper");
    float cent = ch("Centre");
    if(plane==0)
        {
        @P.x *= cos(tap*abs(relbbox(0,@P).y - cent));
        }
    else if(plane==1)
        {
        @P.y *= cos(tap*abs(relbbox(0,@P).x - cent));
        }
    else if(plane==2)
        {
        @P.x *= cos(tap*abs(relbbox(0,@P).z - cent));
        }
    else if(plane==3)
        {
        @P.z *= cos(tap*abs(relbbox(0,@P).x - cent));
        }
    else if(plane==4)
        {
        @P.y *= cos(tap*abs(relbbox(0,@P).z - cent));
        }
    else
        {
        @P.z *= cos(tap*abs(relbbox(0,@P).y - cent));
        }

 

Edited by Noobini

Share this post


Link to post
Share on other sites

so I watched this intro video:
https://www.thegnomonworkshop.com/tutorials/houdini-fast-track-vol-1-fundamentals

and saw the barrel, basically after you bend the staves, they have to be tapered to fit at the ends, so as you can see in the video, a Linear taper (in the Bend) was used....nah....doesn't look right, using the Smooth option got close..but still not quite right...plus you can see the
thickness of the stave is compromised...hence I thought, stuff it...I'll do my own Taper...and so PlanarSymTaper was conceived.

Then did me own barrel of fun HDA too...ahoy me zombie...

PlanarSymTaper1.jpg

Share this post


Link to post
Share on other sites

PlanarSymTaper:

ok, this version is improved. Previously, your geo needs to be properly centred around the world origin, so if you transform your 'box' somewhere...you'd notice the Taper effect goes wonky...

Now it does not matter where your geo is in the world, the Taper effect is always relative to the 'local' bbox.

attribexpression/snippet
    PlanarSymTaper
    @P;
    int plane = chi("TaperPlane");
    float tap = 10*ch("Taper");
    float cent = ch("Centre");
    vector c = getbbox_center(0);
    vector relbbox = relbbox(0,@P);
    
    @P -= c;
    if(plane==0)
        {
        @P.x *= cos(tap*abs(relbbox.y - cent));
        }
    else if(plane==1)
        {
        @P.y *= cos(tap*abs(relbbox.x - cent));
        }
    else if(plane==2)
        {
        @P.x *= cos(tap*abs(relbbox.z - cent));
        }
    else if(plane==3)
        {
        @P.z *= cos(tap*abs(relbbox.x - cent));
        }
    else if(plane==4)
        {
        @P.y *= cos(tap*abs(relbbox.z - cent));
        }
    else
        {
        @P.z *= cos(tap*abs(relbbox.y - cent));
        }
    @P += c;

 

Share this post


Link to post
Share on other sites

is it just me or has SESI put some of the snippets here into their H16.5 ?:

C:\Program Files\Side Effects Software\Houdini 16.5.268\houdini\VEXpressions.txt

(yes...my head is swelling at an alarming rate...)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×