[GRASS-dev] Re: wxNviz toolbar

Michael Barton Michael.Barton at asu.edu
Mon Aug 22 15:30:34 EDT 2011


What Helena and I were getting at was that in order for NVIZ to display a correctly smoothed surface, a resolution of 1 should correspond with the resolution of the original map (i.e., as returned by r.info -r), not the computational region. It is good that the horizontal extents of the 3D surface correspond to the display extents, which you should be able to obtain from os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True)


Michael
______________________________
C. Michael Barton 
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ  85287-2402
USA

voice: 	480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)
www: 	http://csdc.asu.edu, http://shesc.asu.edu
		http://www.public.asu.edu/~cmbarton

On Aug 22, 2011, at 12:24 PM, Anna Kratochvílová wrote:

> Hi all,
> 
> On Mon, Aug 22, 2011 at 7:04 PM, Michael Barton <Michael.Barton at asu.edu> wrote:
>> 
>>> 
>>>> 
>>>>> 
>>>>> Another issue that does not work very well is fine resolution setting.
>>>>> The original intent was for fine resolution set to 1 to be the resolution of the original raster
>>>>> (later on changed to region resolution which could be set to the rater resolution)
>>>>> to avoid artifacts in the surface due to nn resampling
>>>>> http://skagit.meas.ncsu.edu/~helena/grasswork/secref_resampling.png
>>>>> When adjusting the 3D view to map display zoom the resolution can get easily higher that the original
>>>>> raster resolution, leading to resampling and then the surface looks like there is a problem
>>>>> with the data (there used to be lots of artifacts like this in older DEMs).
>>>>> Perhaps a warning should be given to the user that his DEM is resampled and the displayed
>>>>> surface may have artifacts or the 3D view just should not display anything at resolution
>>>>> higher than what the DEM has.
>>>> 
>>>> Good points. I'm still not sure exactly what is happening here though. When you change the computational region to match the display, it changes the region extents but not the region resolution. On the other hand, the display works by keeping the number of pixels constant (for a given window size) regardless of the map zoom/extents. So very large maps are displayed with fewer pixels than cells and a close-up of a region is displayed with more pixels than cells.
>>>> 
>>>> Is NVIZ registering the display resolution or the region resolution?
>>>> 
>>>> I've attached a very close up of a section of elevation.dem from Spearfish with nviz resolution set to 1. To me it looks like it is displaying perfectly. This is indeed what the DEM looks like close up in 3D.
>>> 
>>> not really - when visualized in nviz the grid is converted to TIN and with gouraud shading you should not see squares.
>>> (without the smooth shading you would see sloped triangles, not flat squares)
>>> When you see squares, your DEM is resampled by nearest neighbor - I have it explained in detail in this lecture
>>> http://courses.ncsu.edu/mea582/common/GIS_anal_lecture/GIS_Anal_Ldata.ppt
>>> see slides 29 and 31, slide 33 explains why you don't always see flat squares (it depends on the relation between the original
>>> and new resolution).
>>> 
>>>> But I guess it depends on what we expect to see. Should nviz be smoothing out the cells of the DEM at this scale?
>>>> If so, then it should take the resolution from the region and not from the display.
>>> 
>>> that is one of the solutions - if taken from region settings, then the user should be in control of the resampling
>>> (of course if he/she actually knows that GRASS does automatic resampling to region resolution).
>>> 
>>>> *Can* nviz create a smoothed landscape from such a small number of cells at this kind of scale?
>>> 
>>> as shouwn above, it is not the matter of having small number of cells - you get the squares even for the larger DEMs
>>> if resampling is going on and if the resolution of your screen displays every pixel. And if you do not resample,
>>> with gouraud shading your surface will be smooth even for a small number of cells, it just looks rather fuzzy then.
>>> (you can try this in old nviz which has the resolution controled by g.region, just make sure your region is set to the
>>> DEM that you are displaying.).
>> 
>> OK
>> 
>>> 
>>>> With respect to horizontal extent, it is very nice to have nviz finally display in 3D what I'm seeing in 2D. So I like it that wxNVIZ is using the display to define the horizontal extent of the 3D display.
>>> 
>>> yes, I like that too.
>>> 
>>>> I'm not sure how best to deal with the resolution issue.
>>> 
>>> avoiding the nn resampling should fix it, although I am not sure how difficult that would be.
>>> Another option would be to do bilinear interpolation when resampling FP continuous field maps
>>> (but we can have FP maps that are not continuous fields where interpolation is not appropriate).
>> 
>> It seems like the easiest would be to take the horizontal extents from the display region but use the map's native resolution for the resolution. Resampling every time NVIZ starts could slow it down a lot.
>> 
> 
> I've just tried to fix this problem. Although I thought the resolution
> was from computational region:
> 
> os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True)
> 
> it was recalculated to display resolution in
> 
> G_adjust_Cell_head(cellhd, TEST(F_ROWS), TEST(F_COLS));
> line 158
> 
> because of rows and columns.
> I changed the SetRegion method. I hope it won't affect some other
> functionality.
> 
> Now fine resolution set to 1 should correspond to resolution of
> computational region. Another possibility is to set original surface
> resolution but I'm afraid there could be problems when surfaces have
> different resolution.
> 
> BTW, Michael, this could help with #1427, please try it.
> 
> Anna
> 
>> But I guess I'd better grab some screenshots of a DEM the way it works now since that is a great display for class.
>> 
>> Michael
>> 
>>> 
>>> Helena
>> 
>> 
>> ______________________________
>> C. Michael Barton
>> Director, Center for Social Dynamics & Complexity
>> Professor of Anthropology, School of Human Evolution & Social Change
>> Arizona State University
>> Tempe, AZ  85287-2402
>> USA
>> 
>> voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)
>> fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)
>> www:    http://csdc.asu.edu, http://shesc.asu.edu
>>                http://www.public.asu.edu/~cmbarton
>> 
>> On Aug 22, 2011, at 6:53 AM, Helena Mitasova wrote:
>> 
>> 
>> 



More information about the grass-dev mailing list