Jump to content

Help stacking blocks based on height map?


Recommended Posts

Hi all, I made a quick "cover surface with single-square lego pieces" for a character at work and I wanted to develop it a bit more now that I have some downtime. The idea is to have any surface, static or animated covered in blocks, with some height variation here and there.

Initially I was dealing with the height in a rather manual fashion,  reading in a texture height map and manually selecting grey value ranges with group nodes to separate out each level before displacing them along a normal. These points then all got merged back together before being plugged into my final Copy node.. The results aren't bad, albeit a bit slow (see my screenshot), but I'd like to be able to choose how many levels I want with a slider & have this all filter through nicely. 

Here's what I have figured out - load a height map texture in a vop, with a bit of fit range, divisions and value flooring assign each point a "height level" attribute. Ascertain max height level value (I just promoted my point attr to a detail attr using a max filter, or i suppose i could just take my input value!).

Now .. what I'm a bit stuck with is how to do what  I was doing before - selecting all the points within certain ranges, displacing them upward...selecting next lot, displacing them up... and then finally merging my points back into one node before Copying! I'm sure its because I'm not thinking in a Houdini way still (Maya user here). What are my options for looping through? Or is my approach not the most efficient? I started looking at the "add point" node in Vops, is this a good road to take?

The For loop structure doesn't work how I imagined (for i=0; i<max height level; i++   <-being able to do this would be amazing...I know it's possible......somehow..)

Oh - and thanks in advance for any pointers!

 

blockStacking.jpg

blockStackingScr.jpg

Edited by magicU
image
Link to comment
Share on other sites

you can copy lines on your points first based on the number of boxes you have already found

however if you want it to be faster, you can directly create those points in VOPs or Wrangle

here is the example with both (VOP and Wrangle) versions, just to compare as there are complains that many examples are just wrangle centric which may make it difficult for beginners

ts_create_points_from_heightmap.hip

Link to comment
Share on other sites

Thanks for the speedy help Tomas - I'll start dissecting what you've done. Good call on the lines, I'll try to implement that too!

Edit - It all works really well Tomas! I think the wrangle is actually easier to read than the VOP network, but that might just be me.. I do have a better understanding of the For loop within VOPs now though. Thanks again.

Edited by magicU
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...