Hello!
I'm starting to learn hdk Houdini and look at the examples in toolkit folder. So I have two question, I found two examples files: 1. OBJ_WorldAlign.C, 2. OBJ_Shake.C… So, OBJ_WorldAlign file has function cookMyObj, but OBJ_Shake does't have, why? and what is main compute function in Houdini rules?
And second question.. in file “OBJ_Shake.C” I found bit operation XOR “seed ^= 0xdeadbeef;”
seed = (int)OPgetDirector()->getChannelManager()->getSample(t);
jx *= 2*SYSfastRandom(seed) - 1.0;
seed ^= 0xdeadbeef;
jy *= 2*SYSfastRandom(seed) - 1.0;
seed ^= 0xfadedcab;
jz *= 2*SYSfastRandom(seed) - 1.0;
what for this operation? could you explain to me, please! If I do it without this operation, what's happen?
Thanks!
https://www.sidefx.com/docs/hdk/_o_b_j___world_align_8_c_source.html [www.sidefx.com]
https://www.sidefx.com/docs/hdk/_o_b_j___shake_8_c_source.html [www.sidefx.com]
HDK question XOR/main compute function
1512 1 0- rash
- Member
- 14 posts
- Joined: Oct. 2017
- Offline
- jsmack
- Member
- 7658 posts
- Joined: Sept. 2011
- Online
The xor with the bitmask ‘deadbeef’ or ‘fadedcab’ is a bit of programmer humor, but it's purpose is to change the seed without losing entropy.
If the xor part was skipped, then the seed would be the same for all three axes, and result in a shaking that is along an xyz diagonal line, instead of the noisy space intended.
If the xor part was skipped, then the seed would be the same for all three axes, and result in a shaking that is along an xyz diagonal line, instead of the noisy space intended.
-
- Quick Links