comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » shaded relief
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
shaded relief [message #52166] Fri, 19 January 2007 01:45
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
I want a method to generate fast shaded relief views from a surface
elevation grid (pixel for pixel orthogonal views which overlay)

I tried using direct graphics with something like:

shade_surf,dtm,image=sh,az=0,ax=90,position=[0,0,768,768],ti ck=0,xstyle=1,ystyle=1

This works, except that the z-scale is auto-scaled producing an
unrealistic exaggeration. shade_surf doesn't take an /isotropic
keyword.

I retried with object graphics, and after a lot of tinkering got it to
work:

function gm_ortho_shade,z,mpp,texture=texture ;z - DTM, metres; mpp -
horizontal metres per pix
dim=size(z,/dim)
x=findgen(dim[0])*mpp
y=findgen(dim[1])*mpp

oModel = OBJ_NEW('IDLgrModel',lighting=1);,depth_cue=[-1,1]
obj=[omodel]
if arg_present(texture) then begin
oImage=OBJ_NEW('IDLgrImage',texture);,greyscale=1)
obj=[obj,oimage]
oSurface = OBJ_NEW('IDLgrSurface', z,x,y, style=2,
color=[128,255,255],texture_map=oImage,shading=1);, color=[255,255,255]
endif else begin
oSurface = OBJ_NEW('IDLgrSurface',z,x,y, STYLE = 2,
color=[255,255,255], shading=1,shininess=128.,specular=[0,0,0])
endelse
obj=[obj,osurface]

oLight=obj_new('IDLgrLight',type=2, location=[-1000,1000,1000])
oModel -> add, oLight
obj=[obj,olight]

oModel -> Add, oSurface
oSurface->GetProperty,XRange=xr,YRange=yr,ZRange=zr

mx=yr[1]>xr[1]
r=(yr[1]>xr[1])/(yr[1]<xr[1])
f=r/mx ;make a scaling factor for the largest of x, y.
oSurface->SetProperty,XCoord_Conv=[0,f], YCoord_Conv=[0,f],
ZCoord_Conv=[0.,f]

oView =
OBJ_NEW('IDLgrView',projection=1,VIEWPLANE_RECT=[0,0,xr[1]/m x*r,yr[1]/mx*r])

oView -> Add, oModel
buffer=obj_new("idlgrbuffer",dimensions=dim)
buffer->draw,oView
(buffer->read())->getproperty,data=img
obj_destroy,[obj,buffer,oview]

return,img
end

The problem is that it's much slower than the direct graphics method.
I wonder if anyone has anyone has any suggestion to force shade_surf to
be isotropic? Or otherwise to speed up the object way?

Many thanks,
Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: nested structures in dlm
Next Topic: Re: backprojection

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:16:36 PDT 2025

Total time taken to generate the page: 0.00544 seconds