Jump to content
lacer8

Looking for slight random variation in scale, pos, rot

Recommended Posts

Hello and thank you for your time. 

This is my first post here. Not only am i new to the site, but also Houdini - having only been poking around a month or so. 

So, here's my problem, I'm feeding an edge wear graph that I'm working on, an imported mesh. The mesh is for a modular wall kit. The mesh is broken up into watertight bricks. I run the edge wear on this mesh within a foreach connected loop. What I really want to do is achieve a more natural and worn old rock wall look. To do that, I'd like to introduce small amounts of randomness to scale, rotation, and position. However, since the bricks aren't copied to points, I'm struggling to get anything to work. In fact, I can't get it to work within the loop or pulled out on it's own. Hopefully the issue makes sense. This has to be a trivial thing, but all the tutorials i'm finding are for using point attributes and vops... and when I do that, I'm unable to group the points within each connected mesh. In general, i want these to stay rectangular. 

Thanks again for your help. 

randomized_pos_scale_rot.jpg

Share this post


Link to post
Share on other sites

Hmm. I'm getting closer, but the way I'm currently doing it isn't actually doing a random but mulitplying by a float... so the pillar constantly rotates one direction, and constantly moves in one diagonal direction. The code in the boxes is: 
Translate: detail("../foreach_begin4_metadata1/", "iteration",0) * ch("../controller/randPos")

Rotate: detail("../foreach_begin4_metadata1/", "iteration",0) * ch("../controller/randRot")

Scale: detail("../foreach_begin4_metadata1/", "iteration",0) * ch("../controller/randScale") +1

I added the plus one to scale because it was getting some very small results too. So I need to figure out how to slot rand in here with a range instead for all these functions. 

 

 

randomized_pos_scale_rot2.jpg

Share this post


Link to post
Share on other sites

Ok, I think I've got it for rotation... Seems to be working with this expression in transform node's rotate X field: 

rand(detail("../foreach_begin4_metadata1/", "iteration",0)) * (2 * (ch("../controller/randRot"))) - (ch("../controller/randRot"))

So, I just need to extrapolate that out to other fields. 

I guess I just needed to talk to myself some. Thanks for listening! ;)

Share this post


Link to post
Share on other sites

You can also use the fit01() function to add more control over your randomness :

fit01(rand(detail("../foreach_begin_metadata1", "iteration", 0) + ch("seed")), ch("min_value"), ch("max_value"))

 

Share this post


Link to post
Share on other sites

Thanks Don. 
Cool suggestion. I don't know if I need that much control at this point, but if I want to individually limit the min and max, I'll return to this! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×