raytracingheightmappovray

How to map an image_map to a height_map in POV-ray?


I have a program (a water-flow simulation) that outputs three images every iteration: a heightmap (land+water height), and a texture (designed to actually sort-of look like water, on brown soil). I would like a 3d animation, and decided to use POV-Ray.

The problem is I can't get the height_map to align with the image_map. After looking at this documentation, I concluded that I only needed to have something like

height_map{
    png "frame_height.png" // animation stuff redacted for brevity
    smooth
    texture{
        pigment{
            image_map{
                 png "frame_texture.png"
            }
        }
    }
}

However, this doesn't map the pixels correctly.

example: demonstration of problem What I would like to happen, is for the blue splodge to coincide with the bulge visible in the picture.

For reference, the code to produce this is all available in this repo : https://github.com/smeagolthellama/rivergen


Solution

  • I just needed to rotate the texture:

    object{
      height_field{
        [...]
      }
      texture{
        pigment{
          image_map{[...]}
        }
        rotate <90,0,0>
      }
    }