XaiJu
entagma
entagma

patreon


VEX101 - Generating Randomness

Generating seemingly random numbers is a surprisingly elemental and often used part in our VEX setups. In this video we'll talk about the basics of generating random numbers and using them to orient our copies.

VEX101 - Generating Randomness

Comments

Heyhey, although in this case using integers instead of vectors to define the fit01's output range (Houdini casts those ints to vectors), I personally wouldn't recommend it. If at some point you'll be working in a less forgiving language (openCL?), this is gonna bite you back. And yes, the "times two minus one" trick works too, of course. Yet as VEX offers a compact and comfortable fitting function, I tend to use this more often. :) Cheers, Mo

Entagma

hey Mo, i tried to cheese it and use a float instead of a vect for the rand so fit01(randDir,-1,1); instead of fit01(randDir,{-1,-1,-1},{1,1,1}); it seemed to work identically, would this still be a valid approach? I'm guessing houdini figured out im multiplying a vector by a float so it concerted the float to vector? Also tried randDir = randDir*2 - 1; instead of fit which also seemed to work but ive never had access to fit functions in Javascript where i started to learn code but fit is very much more readable :D

Lucky Dee

What does 'correct' mean?

Khai Thieu

Hey Jinwoong Kim, I'm attaching a Normal SOP to make sure my mesh has correct normals. Cheers, Mo

Entagma

Hello! Thank you for the great tutorials. I have one question! At time 03:05 you add the normal operator after the copytopoints. Can you explain why you add that again??

Jinwoong Kim

Hi Christian, yep - that should do it :) Cheers, Mo

Entagma

Loving this tutorial series! Quick question. In the video, how would you limit the random rotation to only rotate the rubber toys on their Y axis? Edit: Would you just force the =@N.y = 0.0;

Christian Akesson

Hi aurora, the simplest way would be to just create an Attribute Wrange, set it to Rund over "Detail (only once) and then use this bit of VEX:

Entagma

Hi Moritz I just saw your strange attractor tutorail may I know how to deal with henon attractor ,it is sort of a number series. xn+1 = 1 + yn - a * xn2 yn+1 = b * xn a = 1.4b = 0.3

aurora

oh not to worry, found it on the overview page.

Josef

Thanks for the amazing tuts. Where is part 5 of this series?

Josef

Hi Christian. Just add this line to your houdini.env file, located in your documents folder: HOUDINI_EXTERNAL_HELP_BROWSER = 1 cheers mnu

Entagma

Love these classes Moritz - thank you. Very random question: How did you get the help to show up in your browser when you hit F1? Mine shows up in the internal help window which I do not like as much...

Christian Akesson

Phew - I'll look into if it is possible in an efficient way... No guarantees though :) Cheers, Mo

Entagma

Hi :) As I am trying to learn a vex, the bigest problem i think is to figure out what kind of function im looking for. maby good idea could be to show general functions groups and type of usage cases as a bigger picture like here: <a href="https://www.youtube.com/watch?v=OmJ-4B-mS-Y" rel="nofollow noopener" target="_blank">https://www.youtube.com/watch?v=OmJ-4B-mS-Y</a> It could help to create a raw imagination about all this wizzardy stuff :).

Adam Bryła

Well I guess if it works, technically there's nothing 'wrong' with it :) The reason for me sticking to very explicit function calls is that it makes it easier for Houdini to infer the correct data types. (Otherwise in some cases you might end up with a float instead of a vector.) Which in this case isn't necessary as we've already explicitely specified randdir's type with the keyword 'vector'. Cheers , Mo :)

Entagma

Just blitzed through all the VEX 101 last night and tried to figure this out (Randomness) on my own (to fail). So perfect timing! Thanks! Loving these.

Olaf Blomerus

Nice! one question, how wrong is it to write with the 'fit' fonction on a vector : fit01(randdir, -1,1); instead of fit01(randdir, {-1,-1,-1}, {1,1,1}); ? as I'm reading the same values on the spreadsheet with both route. Thanks a lot Mo!

Florian

Thank you Moritz. 👍🍻

Bahman Jahanbakhshi


More Creators