Programaticaly setting values to volume names for Heightfields

   1600   0   0
User Avatar
Member
23 posts
Joined: 7月 2015
Offline
Hi everyone,

I have a list of string that represents layers.
["snow", "dirt", "grass", "rock"]
Because these are in an array, they have an index from 0 to 3.

Then, I have some files on disk:
000_000_000.png
000_000_001.png
000_000_002.png
000_000_003.png

Their name is in this format TILEX_TILEY_LAYER.

Now I want to load all of these images as volumes on a Heightfield. I can programaticaly create all the volumes by using the Layer Copy node but in my Volume Wrangle, I want to loop the layer list and set the values of these images into their corresponding volume. For example:

for (int i = 0; i < len(layer_list); i++) {
   string layer_id = sprintf("%03d", i);
   string layer_name = layer_list[i];
   string image = "000_000_" + layer_id + ".png";

   vector sample = rawcolormap(image, u, v);
   @layer_name = sample.x;   // doesnt work because "layer_name" is a variable, not a volume
}

The last line is where I'm blocked. I would like to set the value using the layer name and not the “@” symbol. I would use the setpointattrib() function in a point wrangle but how can I do this in a volume wrangle?

Thx!
C
Edited by cs_pix - 2018年12月12日 17:13:17
  • Quick Links