Jump to content

Iterate over all available Heightfield layers and combine everything into one?


Recommended Posts

Hi there!

What would be the best approach to iterate over all available heightfield layers and combine them?
E.g. I have layers like:
- rocks
- path1
- path2
- dirt
- dirtabc
- various erosion layers
- ....

The user can enter a custom layer name in my HDA and I won't know exactly how many layers are in the final heightfield.
Now i need one layer that combines every other layer (to create a layer for all areas that don't belong to any other layer).

What would be the best way to approach this?

Thanks in advance!

Link to comment
Share on other sites

not sure if there is a node for this, I'm not that familiar with hfields

but you should be able to do it in Volume Wrangle

string pattern = "rocks path* dirt*";  // pattern matching layer names you want to combine
float combinedlayers = 0;
for (int i=0;i<nprimitives(0); i++){
    string name = prim(0, "name", i);
    if (match(pattern, name)){
        float value = volumesample(0, name, @P);
        combinedlayers = max(combinedlayers, value); // combining layers using maximum 

f@mask = fit01(combinedlayers,1,0); // mask will contain complementary areas to combined layers


Link to comment
Share on other sites

  • 5 months later...

Hi all.

Im Looking to combine all my tiles into one large terrain, and blend the border of each according to the surrounding tiles so there is no break. 

I could do a Xform or copy to point, and obviously blending is okay for two layers , but to do automate this to a full large mosaic?

Cop , could be one i guess, but i don't know, maybe it's only me, buthe old beast feels so slowww , unstable and heavy :)


Also, speaking of syntax here, this is an easier question, just can't remember how to ... Let's say i have 10 variantes heightfield generated on my disk  saved in this folder structure  "/var00x/craterterrain.tif" _and i want to attribute a piece variant to each of then to scatter each terrain , do you remember what will be the proper way to load each tile from the different folder , assign a variant number and feed the scatter?

Here's if an heightfeild file input to read... PDG will be a good way, not sure how, is there a more simple way?



Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts









Edited by vinyvince
Link to comment
Share on other sites

I guess it's possible by building a 2d array with u,v translation values to give to the patch translate, then for each iteration to load a different heightfield.

Have to look how to do that, especially as i said in my previous post for loading a different heightfield from disk for each iteration pass, if someone knows, please drop a line :)

For now it's semi manual



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.

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