Is it possible to rotate a heightfield output?

   1862   2   1
User Avatar
Member
27 posts
Joined: Oct. 2015
Offline
I am outputing my landscape to a heightmap on disk, however, there is a problem - it is rotated 90 degree. I need to rotate it back (-90 degrees). I have tried using the transform heightfield node, but this does not affect the output.
User Avatar
Member
23 posts
Joined: July 2015
Offline
Yep, having the same issues. I will try to write something that rotates all layer info based on their index but it would be cool if HF xform would work for this…
User Avatar
Member
23 posts
Joined: July 2015
Offline
I used this code in a volume wrangle:

vector current_pos = @P;
current_pos -= @center;
vector rot_pos = rotate_x_to(set(0,0,-1), current_pos);
vector sample_pos = set(rot_pos.x, 0, rot_pos.z) + @center;
float sample = volumesample(0, 0, sample_pos);
@height = sample;

1: Get the current position of the volume voxel
2: Because the center of the volume might not be at (0,0,0) we offset the voxel pos by the center position
3: Create a new vector position by rotating X to minus Z. (This is +90 degree rotation. Use (0,0,1) for -90)
4: Create a new vector called sample pos. by added the center offset.
5: Sample the volume
6: Assign height the sample value

This works only on square HF

Cheers!
Edited by cs_pix - Nov. 9, 2018 17:56:49
  • Quick Links