Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Videos

Content

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.

Files

Previews only

VEX 101 pt. 6: Generating Randomness

Comments

Florian

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!

Olaf Blomerus

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.

entagma

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

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

Christian Akesson

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...

entagma

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

Josef

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

aurora

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

entagma

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:

Christian Akesson

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;

entagma

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

Jinwoong Kim

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??

entagma

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

Lucky Dee

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

entagma

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