Hi Robert, Jason!
My gdal version:
$ gdalinfo --version
GDAL 1.3.2.0, released 2006/05/02
I think i tracked down this bug. Please look at use of any
RasterIO at DataSet.cpp, for example:
bandSelected->RasterIO(GF_Read,windowX,_numValuesY-(windowY+windowHeight),windowWidth,windowHeight,heightData,destWidth,destHeight,GDT_Float32,0,0);
Note third argument. Now in getInterpolatedValue:
band->RasterIO(GF_Read, colMin, rowMin, 1, 1, &llHeight,
1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMin, rowMax, 1, 1, &ulHeight,
1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMax, rowMin, 1, 1, &lrHeight,
1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMax, rowMax, 1, 1, &urHeight,
1, 1, GDT_Float32, 0, 0);
Apparently, here RasterIO is used in other way.
After trivial change:
band->RasterIO(GF_Read, colMin, _numValuesY-(rowMin+1), 1,
1, &llHeight, 1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMin, _numValuesY-(rowMax+1), 1,
1, &ulHeight, 1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMax, _numValuesY-(rowMin+1), 1,
1, &lrHeight, 1, 1, GDT_Float32, 0, 0);
band->RasterIO(GF_Read, colMax, _numValuesY-(rowMax+1), 1,
1, &urHeight, 1, 1, GDT_Float32, 0, 0);
everything works like charm.
Problem I described earlier appears in every dataset I
tried, (1k, 4k & 16k Puget sound, bluemarble 21k,
artifical testcases). Using geotransform/geotiff info, I
believe it's possible to workaround it, but on any
matching texture/heightmap pair with same transforms this
bug should result in flipped mesh vs texture.
On Sun, 17 Sep 2006 10:12:56 +0100 "Robert Osfield"
<[EMAIL PROTECTED]> wrote:
Hi Jason,
The error I'm seeing looks like a flipping around the Y
axis, rather than a
small shift you report. I used the 4k imagery as Dmitry
and you used.
After sending my last post yesterday it occured to me
that perhaps its GDAL
that is the problem, as your code looked fine, relying
upon GDAL to get the
data correctly. The fact that you aren't see the the Y
axis flip perhaps
could another hint that the problem is in GDAL, but has
been fixed already.
What version of GDAL are you guys using?
This is my version:
gdalinfo --version
GDAL 1.3.1.0, released 2005/10/04
Robert.
On 9/17/06, Jason Beverage <[EMAIL PROTECTED]>
wrote:
Robert,
I don't have time tonight to download and run the high
res Puget Sound
data but I got the 4096 texture and 4096 heightfield to
do a quick test.
I ran osgdem on the png's and I'm not seeing any
flipping around the y
axis on that data set. I tried setting
interpolateTerrain to false and
their is only a slight change in the position of the
terrain, but
nothing I would call "flipping around the Y axis".
The alignment of the texture to the heightfield is a
little off when
interpolateTerrain is set to true though, if that is
what you all are
referring to. I can see where the whitest part of the
texture should be
at the top of the peak on the right of the dataset, but
with
interpolateTerrain on, it is slightly off. The reason
for this is
because the changes I made only applies to terrain, not
to imagery, so
the sampling method in readHeightField is different than
in readImage.
If that is what the problem is, let me know and I'll see
what I can do.
Jason
---
Professional hosting for everyone - http://www.host.ru
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/