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!

Share this post

Link to post
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


Share this post

Link to post
Share on other sites

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

Share this post

Link to post
Share on other sites

Would be great if we could combine the patch tool with scattering ... Will be a nice feature upgrade

Share this post

Link to post
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



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