POV-Ray : Newsgroups : povray.general : height_field { function n, n { ... weirdness : Re: height_field { function n, n { ... weirdness Server Time
4 Nov 2024 17:31:26 EST (-0500)
  Re: height_field { function n, n { ... weirdness  
From: Christian Walther
Date: 28 Oct 2003 06:26:03
Message: <pan.2003.10.28.11.26.12.952449@gmx.ch>
I have just dug up the source code (and the instructions for compiling it
on Mac OS X) again and can confirm that removing the two lines

  Image->width--;
  Image->height--;

from Make_Pattern_Image(...) in parstxtr.cpp fixes the problem.

One thing that still makes me wonder is that the function evaluation point
(for the pixel that controls the height_field vertex at <x, 0, z>) is
<x, 1-z, 0>, i.e. the image is upside down. Is there a reason for this?
Wouldn't it be more logical (and consistent with e.g. image_maps) to have
<x, z, 0>? Or would that break anything?

I believe that this is a bug which was introduced because the author
didn't consider that image scanlines are usually (and apparently also in
POV's IMAGE structure) numbered from top to bottom, while y coordinates
(in POV's standard coordinate system) increase from bottom to top.

A way to fix this, should one agree that it is a bug, would be replacing

  gray16_line = Image->data.gray16_lines[i] = ...

by

  gray16_line = Image->data.gray16_lines[Image->iheight-1-i] = ...

in Make_Pattern_Image(...).

 -Christian


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.