|
|
High!
Recently, I once again tried to write some code to generate (manually
pixeled) heightfield bitmaps into bezier multi-patches. But when I
finally rendered a test patch generated from a tiny (8 x 4) PNG bitmap,
I found out, that the two 4 x 4 patches overlap each other by two
columns (as intended), but the points in the last column of patch #0 do
not align with those in the second column of patch #1 along the y
dimension, as you see in the large image attached.
Also, I discovered that the height values calculated in the nested loop
(see code below) differ somewhat from the expected values according to
my transformation formula (each red value unit equals 50 meters, each
green value unit equals 50/256 meters), throughout the whole bitmap.
As for example the first four pixels in the first row of the original
bitmap (which make up the first row of patch #0) have the following rgb
values:
<51, 200, 0>, <51, 204, 255>, <51, 208, 0>, <51, 216, 0>
(the blue variation is only for better visual discernibility when
pixeling the heightfield by hand, the blue values do not add to the
final y value!),
so the y values should be:
2589.0625, 2589.84375, 2590.625, 2592.1875
Instead, they are:
2599.22, 2600, 2600.78, 2602.35
Obviously, they are simply translated about 10.15 units along the y
axis... how could this have been happening?
See you in Khyberspace!
Yadgar
Post a reply to this message
Attachments:
Download 'patch.png' (18 KB)
Download 'minipatch4.png' (1 KB)
Download 'us-ascii' (1 KB)
Preview of image 'patch.png'
Preview of image 'minipatch4.png'
|
|