Houdini In Five Minutes 11: The Foreach Loop

Поделиться
HTML-код
  • Опубликовано: 1 фев 2020
  • Download project file (.hipnc): www.entagma.com/downloads/fiv...
    For more of everything: www.entagma.com
    Support us on Patreon: / entagma

Комментарии • 38

  • @N3.1Kryuk
    @N3.1Kryuk 2 года назад +1

    Thank you! This is exactly what I was looking for.

  • @blaaablooo5233
    @blaaablooo5233 Год назад

    Legend!

  • @anxhelo7383
    @anxhelo7383 3 года назад +7

    im still confused, i understand what it does but i dont understans in which cases do we use for each loop

  • @user-ou7ek3gg7w
    @user-ou7ek3gg7w Год назад

    Genious!

  • @harun3Ddigitalartist
    @harun3Ddigitalartist Год назад

    thank you bro man...

  • @fallenhoenix1255
    @fallenhoenix1255 3 года назад +3

    Anyone out there know why might my code completion not work in the same way when typing the target geometry string of the detail function like in the video? I'm using relative references the same way. Is there a hotkey or something?

  • @maximtuts1780
    @maximtuts1780 2 года назад

    Where can i learn to make such a cool reflective texture with sun sparkles just like u did in the intro.

  • @jack_drums
    @jack_drums 4 года назад +25

    Hey guys! As an exercise I tried to implement it in VEX, it's extremely faster! I just used a Facet node (with Unique Points checked to "separate" the primitives) and then a Primitive Attribute Wrangler, I'll paste my VEX snippet down here (and a .hip too with the comparison) if anyone is interested!
    (Does anyone know if it's possible to transform a primitive directly without having to access all its points? I wasn't able to just use/set a @P attribute for them)

    • @jack_drums
      @jack_drums 4 года назад +13

      matrix3 mat;
      vector pos;
      int success;
      //Get per axis rotation amount from Controller (red null)
      float rotX = ch("../Controller/rotation")*ch("../Controller/rotationX");
      float rotY = ch("../Controller/rotation")*ch("../Controller/rotationY");
      float rotZ = ch("../Controller/rotation")*ch("../Controller/rotationZ");
      //Get primitive points
      int points[];
      points = primpoints(0, @primnum);
      //Rotate each point of the primitive using the transform matrix matr
      foreach (int pt; points){
      mat = ident();

      rotate(mat, radians(@primnum * rotX), {1,0,0});
      rotate(mat, radians(@primnum * rotY), {0,1,0});
      rotate(mat, radians(@primnum * rotZ), {0,0,1});

      pos = pointattrib(0, "P", pt, success);

      if(success)
      setpointattrib(0, "P", pt, pos*mat , "set");
      }

    • @lveronese
      @lveronese 4 года назад +2

      @@jack_drums thanks for the code, it's extremely faster

    • @mattreed6871
      @mattreed6871 4 года назад +1

      @@jack_drums SO much faster!!!

    • @aboldmule
      @aboldmule 2 года назад +1

      great inspiration and application of linear algebra! Thanks!

    • @jack_drums
      @jack_drums 2 года назад

      @@aboldmule Thank you! Glad it helps! ☺️

  • @robertschroer5794
    @robertschroer5794 2 года назад

    Awesome Tutorial!
    Isnt Chris Hebert the director of finances at SideFX ? :D

  • @Zerefthedark
    @Zerefthedark 4 года назад

    I have a doubt ....
    I tried to replace the pigs head with an alembic animation and the result i got was the entire body rotating instead of the polygons...
    what should i do to get the polygons rotating

    • @psychedlicavfx6646
      @psychedlicavfx6646 4 года назад +2

      Hard to say as there could be a number of reasons but did you try using Unpack sop right under alembic import?

    • @Zerefthedark
      @Zerefthedark 4 года назад

      @@psychedlicavfx6646 thank you for replying 😄.
      I did, the thing is it works on the first or well the selected frame but not on the rest of the animation 😶. I tried unpacking and also using time shifting and using that to link the animation to geo node but so far no luck 😣

    • @psychedlicavfx6646
      @psychedlicavfx6646 4 года назад +1

      @@Zerefthedark that's strange. maybe write out the geo as a single frame bgeo after unpacking. then read it back in. this way you can diagnose if houdini is having trouble reading the alembic or there is something off in the alembic itself. bit of a hack but it could work. let me know if it works. am curious :)

    • @Zerefthedark
      @Zerefthedark 4 года назад +1

      @@psychedlicavfx6646 ok I will let you know when I try it 😄 thanks for replying tho

    • @Tyson2k55
      @Tyson2k55 4 года назад +2

      DAVID T VARGHESE maybe place an unpack and then a convert node. After the unpack I think it’s still a poly soup. The convert will make it into polygons. I’m no expert though.

  • @undertone_dj
    @undertone_dj 3 года назад

    Hmmm, for some reason, I don't get the same results. When typing the expression for the seed to connect to the iteration attribute of the metadata node, the results deviate for me. It's still green. Tried it twice, and get the same, differing result. I'm on 18.5.483

    • @undertone_dj
      @undertone_dj 3 года назад +4

      Figured it out. Had iteration spelled incorrectly.

    • @Evemy_
      @Evemy_ 9 месяцев назад

      @@undertone_dj Cheers for this, you made me realise I'd made the same mistake 😅

  • @Goten1010
    @Goten1010 3 года назад

    why does the for each loop split the individual primitives up? Why wouldnt it keep it as a complete mesh?

    • @Entagma
      @Entagma  3 года назад +1

      Because the foreach loop (as we set it up in this case) is used to execute whatever nodes you put inside the loop body for each primitive separately. If you want to work on the geo as a whole, simply don't use a foreach loop :)
      Cheers, Mo

    • @Goten1010
      @Goten1010 3 года назад

      @@Entagma First of all, thanks for the answer, and thanks for all the great vids you guys do :) I think what I was trying to say was that the vertices between the polygons get split up, instead of the mesh being kept closed. I feel like it isn't intuitive that the loop would do that: after all, it could just, one after the other, transform each polygon, while NOT separating each polygon from the ones next to it(kind of like a displacement would do it). It seems like you wouldn't be able to do that in the loop, right? Sorry, maybe that's a bit stupid to point out, since I can't think of a good example why one would want to do that either at the moment, just something that I noticed^^

    • @FullThrottle1091
      @FullThrottle1091 2 года назад

      @@Goten1010 There's For-Each Connected Piece which uses the connectivity sop defining an attribute ("class" by default) that is used for the piece attribute in the block end.

  • @pinkospace9040
    @pinkospace9040 3 года назад

    What does it mean to rotate each primitive according to iterations? I imagine each of the primitives to rotate in place, but in the video they are flying around, so I don't understand what is it actually doing? Where is the origin of the primitive's rotation?

    • @Entagma
      @Entagma  3 года назад +2

      Heyhey,
      the origin of each individual primitive is at {0,0,0}, so that's why they appear to be "flying" around. If you wanted to have the primitives rotate in place you'd first have to translate them so their center is at {0,0,0}, then rotate them, then translate them back.
      Cheers, Mo

    • @pinkospace9040
      @pinkospace9040 3 года назад

      @@Entagma Thank you so much for your reply, so each primitive's origin is at 0,0,0 but they are positioned based on the points they are connected to, which could be anywhere, sorry coming from a 3ds max background, didn't get this until now

    • @Entagma
      @Entagma  3 года назад +1

      Yes, exactly this. :) Cheers, Mo

    • @FullThrottle1091
      @FullThrottle1091 2 года назад +1

      In the transform sop's pivot transform type $CEX $CEY $CEZ in the pivot translate's X Y Z channels respectively to transform around the centroid.

  • @pavelpetrikor
    @pavelpetrikor 2 года назад +1

    First peak of the sound too high and beat my ears every time.

  • @waqar_de
    @waqar_de 2 года назад +2

    Why are you running in hurries? ... Sounds extremely stupid and enjoying!!! .... Completely loosing the focus what I am trying to achieve 😂... The learning! ... It's not a demo of your performance 😉 ... It's how better I can understand what you have to theater for me as audience.....

  • @wavelogic8471
    @wavelogic8471 3 года назад +1

    This is ridiculous! there is no god forsaken reason to have to type code on a foreach loop in a node interface. Look at unreal engine blueprints to see how it's done.

    • @Entagma
      @Entagma  3 года назад +6

      Thank you for your valuable feedback. Cheers, Mo

    • @reasonsreasonably
      @reasonsreasonably Месяц назад

      @@Entagma Lovely deadpan passive aggressive reply.