Jump to content

Learning VEX via Animated Gifs - Bees & Bombs


mestela

Recommended Posts

Hey Matt thanks for the file, I learn a lot understanding it, I fixed the rotation in my way.

I was busy at work, but I could finish it today.

I saw the gif and see that everything moves/rotates but not the color, so I used an attribute transfer to solve that.

https://giphy.com/gifs/3ohze1Km7DkpK9X6rC

Link to the gif (I dont know why is not showing xD)

SecondLoop_v2.hipnc

Edited by PalTopin
  • Like 1
Link to comment
Share on other sites

Does anyone know of a comprehensive web series that starts with the basics of VEX? I can't seem to learn VEX with the random videos i find on the web. My ability to understand is largely based on a comprehensive training series. I hope someone can help.


Best,

Robert.

 

P.S. i would download the samples here and dink around but am too paranoid about viruses and i don't run a virus program on my work station. I tend to stick with clean files and sites only. You guys seem to be having a great time though. Excellent samples.

Link to comment
Share on other sites

10 hours ago, mestela said:

You wont get viruses from hip files.

Re tuts, try my wiki page first, if that's not enough then maybe JeffW's intro, apart from that there seems to quite a few vex resources on youtube and places like 3dbuzz etc.

http://www.tokeru.com/cgwiki/?title=HoudiniVex

 

 

Thank you, mestela.

This cgwiki looks perfect! Jeff Wagner is incredible. Will have to go through the cgwiki first, then revisit the VEX Wrangling webinar. Do you know where i can access the other Jeff Wagner webinars on this subject? This youtube isn't a youtube channel specifically on this series. Someone got permission to post just this one video.

Edited by rsgraphics
Link to comment
Share on other sites

  • 1 month later...

Here is my attempt at the Cube Wave. 
https://dribbble.com/shots/2931067-Cube-Wave

So, I was starting out with a few months of spare-time Houdini practice and next to no VEX knowledge at all. I have some very basic coding knowledge and I did a couple of years of math and physics about 15 years ago in college. 

For those looking to learn this stuff, here is what I did. I downloaded the examples that others have posted in this threads and started making intricate notes on what the code was doing. It was handy to know that you can place the cursor inside of a function and press 'F1' to bring up the help on what that function is doing specifically. Though, sometimes I was still a bit confused (damn you, bilinear interpolation). As often happens with coding, there seems to be that breakthrough moment where you start to actually know what is going on. 

As for this project, the hardest part was trying to get the influence more concentrated around the middle and more sparse towards the outside, giving it a more spherical look as it rises. I managed to solve this with a power function and a lot of time fiddling with the values. 

I'm still having a lot of trouble with the colours and rendering and ended up giving up and just colour correcting in After Effects. I'm coming from a Cinema4D background and to output solid colours there is easy (Luminance). But really not very straight forward in Houdini (emission colours still seem to come out really dull). Any advice would be greatly appreciated. 

I'm also having trouble with houdini crashing with these files when I reopen them. When I hit the playback button it crashes when it reaches frame 14 - 17. I even rebuilt it in another file and the same thing happened. Works fine until it is closed/reopened. So if anyone knows where I've gone wrong, I'd like to hear it. 

I've also done a couple more of these and will will drop them in soon. 

Edit: Whoa, that GIF is huge. I'll make them smaller in the future.

CubeWave_01.gif

CubeWave_01.hipnc

Edited by Clif
  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
On 6/13/2017 at 5:43 PM, Clif said:

Here is my attempt at the Cube Wave. 
https://dribbble.com/shots/2931067-Cube-Wave

So, I was starting out with a few months of spare-time Houdini practice and next to no VEX knowledge at all. I have some very basic coding knowledge and I did a couple of years of math and physics about 15 years ago in college. 

For those looking to learn this stuff, here is what I did. I downloaded the examples that others have posted in this threads and started making intricate notes on what the code was doing. It was handy to know that you can place the cursor inside of a function and press 'F1' to bring up the help on what that function is doing specifically. Though, sometimes I was still a bit confused (damn you, bilinear interpolation). As often happens with coding, there seems to be that breakthrough moment where you start to actually know what is going on. 

As for this project, the hardest part was trying to get the influence more concentrated around the middle and more sparse towards the outside, giving it a more spherical look as it rises. I managed to solve this with a power function and a lot of time fiddling with the values. 

I'm still having a lot of trouble with the colours and rendering and ended up giving up and just colour correcting in After Effects. I'm coming from a Cinema4D background and to output solid colours there is easy (Luminance). But really not very straight forward in Houdini (emission colours still seem to come out really dull). Any advice would be greatly appreciated. 

I'm also having trouble with houdini crashing with these files when I reopen them. When I hit the playback button it crashes when it reaches frame 14 - 17. I even rebuilt it in another file and the same thing happened. Works fine until it is closed/reopened. So if anyone knows where I've gone wrong, I'd like to hear it. 

I've also done a couple more of these and will will drop them in soon. 

Edit: Whoa, that GIF is huge. I'll make them smaller in the future.

CubeWave_01.gif

CubeWave_01.hipnc

I've uploaded a simple way to make a perfect sphere this way. I made no attempt to match original proportions, etc. Just to demonstrate some principals. VEX is commented.

I broke the @P.y out into separate lines so that you can comment out the lines at the end to see what each step does.
As for simple flat color like this-- use the "old" Constant shader in SHOPs I've done that in this file, and assigned color via the prim wrangle sop.

Cheers
-matt

b_and_b_cubewave.hiplc

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
2 hours ago, mestela said:

Sweet! Saw this one yesterday, haven't quite got it right, maybe someone else will have an idea of how to fix it:

mobius_hsv_twist.hipnc

 

 

 

Just tried to do everything but the dots in one node. It's next to your network. While we can create points in a wrangle, we still need an input geometry--so I just used a point generate sop. So--two nodes plus the two more that would be needed to finish the job! ;-)
Cheers

One_node_twist.hipnc

Link to comment
Share on other sites

Nice! Could do it in a detail wrangle and get the single-node prize, including creating the spheres:

int pt;
vector pos;
int total = chi('total');
for (int i = 0; i<total; i++) {
    float nptnum = 2.0*i/(total); //ptnum, normalized 0-almost 2
    @P=(i/50+1)*set(sin(nptnum*2*$PI),0,cos(nptnum*2*$PI)); //double circle--exploit that ptnum is int
    //vectors-- axis is 2D perpendicular to out
    vector out = normalize(@P);
    vector pivot = out*1.5;
    vector axis = set(out.z,0,-out.x);
    //timing cycles
    float cycle = ch("cycle_frame_count");
    float ramp = (nptnum-@Frame/cycle)%1;
    ramp = smooth(0,ch("width"),ramp);
    float angle = -$PI*ramp;
    //rotations
    vector4 rotq = quaternion(angle,axis);
    @P-=pivot;
    @P= qrotate(rotq,@P);
    @P+=pivot;
    //new prim
    pt = addpoint(0,@P);
    int newsphere = addprim(0,'sphere',pt);
    matrix3 m = ident();
    scale(m,0.03);
    setprimintrinsic(0,'transform',newsphere,m);
    int newprim = addprim(geoself(),"polyline",pt,pt+50);
}

 

The bit that's eluding me is the colour ramp; I can keep it smooth, but the colours always stay cool on the outside and warm on the inside, or I can lock them down, but you get a discontinuity where the rotation resets. Should be a simple fix but I can't quite see it...

  • Like 1
Link to comment
Share on other sites

12 hours ago, mestela said:

Nice! Could do it in a detail wrangle and get the single-node prize, including creating the spheres:


int pt;
vector pos;
int total = chi('total');
for (int i = 0; i<total; i++) {
    float nptnum = 2.0*i/(total); //ptnum, normalized 0-almost 2
    @P=(i/50+1)*set(sin(nptnum*2*$PI),0,cos(nptnum*2*$PI)); //double circle--exploit that ptnum is int
    //vectors-- axis is 2D perpendicular to out
    vector out = normalize(@P);
    vector pivot = out*1.5;
    vector axis = set(out.z,0,-out.x);
    //timing cycles
    float cycle = ch("cycle_frame_count");
    float ramp = (nptnum-@Frame/cycle)%1;
    ramp = smooth(0,ch("width"),ramp);
    float angle = -$PI*ramp;
    //rotations
    vector4 rotq = quaternion(angle,axis);
    @P-=pivot;
    @P= qrotate(rotq,@P);
    @P+=pivot;
    //new prim
    pt = addpoint(0,@P);
    int newsphere = addprim(0,'sphere',pt);
    matrix3 m = ident();
    scale(m,0.03);
    setprimintrinsic(0,'transform',newsphere,m);
    int newprim = addprim(geoself(),"polyline",pt,pt+50);
}

 

The bit that's eluding me is the colour ramp; I can keep it smooth, but the colours always stay cool on the outside and warm on the inside, or I can lock them down, but you get a discontinuity where the rotation resets. Should be a simple fix but I can't quite see it...

Very cool. I gave myself a time limit when I threw that up last night and just stopped after 15 minutes. But I could swear there were only a couple primitive types (not including 'sphere') that you could add not long ago... So thanks for that! Your cgwiki is amazing, BTW. Great work, clearly illustrated without loads of extra words. Well done!

The continuous hue thing is a bit tricky, because all meaningful values go from 1 to 0 at some point. The version pasted below addresses this, and adds better support for inner and outer radius, and allows you to shift hue. I added spaces before and after the stuff I changed (except the npoints at the beginning ;-))
 

int pt;
vector pos;
int total = npoints(0);
for (int i = 0; i<total; i++) {
    float nptnum = 2.0*i/(total); //ptnum, normalized 0-almost 2
    
    @P = fit(i>=50,0,1,ch("inner_radius"),ch("outer_radius"))*set(sin(nptnum*2*$PI),0,cos(nptnum*2*$PI));
    
    //vectors-- axis is 2D perpendicular to out
    vector out = normalize(@P);
    
    vector pivot = out*.5*(ch("inner_radius")+ch("outer_radius"));
    
    vector axis = set(out.z,0,-out.x);
    //timing cycles
    float cycle = ch("cycle_frame_count");
    float ramp = (nptnum-@Frame/cycle)%1;
    
    //orig ramp is sawtooth w 2 peaks, this creates 1 ramp, and stabilizes anim spatially by subtracting anim
    float fullramp = 0.5*(ramp+(i>=0.5*total))-.5*@Frame/cycle;
    
    ramp = smooth(0,ch("width"),ramp);
    float angle = -$PI*ramp;
    //rotations
    vector4 rotq = quaternion(angle,axis);
    @P-=pivot;
    @P= qrotate(rotq,@P);
    @P+=pivot;
    //new prim
    pt = addpoint(0,@P);
    int newsphere = addprim(0,'sphere',pt);
    
    // map fullramp to hue, add cycle anim to keep hue from spatially animating
    float hue = (fullramp+@Frame/cycle+ch("hue_offset"))%1;
    vector color = hsvtorgb(set(hue,1,1));
    setprimattrib(geoself(),"Cd",newsphere,color,"set");
    
    matrix3 m = ident();
    scale(m,0.03);
    setprimintrinsic(0,'transform',newsphere,m);
    int newprim = addprim(geoself(),"polyline",pt,pt+50);
}

 

Link to comment
Share on other sites

Doh!

Didn't even notice that i double-compensated for anim.

corrected version below.

but also noticed something else broken that I can't explain (and can't really look into at the moment). At frames 48, and 18 (and, I'm sure, cycle multiples of those), points disappear... hrm. >:-|

 

int pt;
vector pos;
int total = npoints(0);
for (int i = 0; i<total; i++) {
    float nptnum = 2.0*i/(total); //ptnum, normalized 0-almost 2
    
    @P = fit(i>=50,0,1,ch("inner_radius"),ch("outer_radius"))*set(sin(nptnum*2*$PI),0,cos(nptnum*2*$PI));
    
    //vectors-- axis is 2D perpendicular to out
    vector out = normalize(@P);
    
    vector pivot = out*.5*(ch("inner_radius")+ch("outer_radius"));
    
    vector axis = set(out.z,0,-out.x);
    //timing cycles
    float cycle = ch("cycle_frame_count");
    float ramp = (nptnum-@Frame/cycle)%1;
    
    //orig ramp is sawtooth w 2 peaks, this creates 1 ramp, and stabilizes anim spatially by subtracting anim
    float fullramp = 0.5*(ramp+(i>=0.5*total))+.5*@Frame/cycle;
    
    ramp = smooth(0,ch("width"),ramp);
    float angle = -$PI*ramp;
    //rotations
    vector4 rotq = quaternion(angle,axis);
    @P-=pivot;
    @P= qrotate(rotq,@P);
    @P+=pivot;
    //new prim
    pt = addpoint(0,@P);
    int newsphere = addprim(0,'sphere',pt);
    
    // map fullramp to hue
    float hue = (fullramp+ch("hue_offset"))%1;
    vector color = hsvtorgb(set(hue,1,1));
    setprimattrib(geoself(),"Cd",newsphere,color,"set");
    
    matrix3 m = ident();
    scale(m,0.03);
    setprimintrinsic(0,'transform',newsphere,m);
    int newprim = addprim(geoself(),"polyline",pt,pt+50);
}

 

  • Like 1
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...