How to create transparent hillshade?

المشرف العام

Administrator
طاقم الإدارة
I get elegant transparent hillshades via a combination gdal and convert. Compare to grey-based hillshade commonly used, such transparent hillshades are very cool because they can be placed between the map background and other upper layers (roads, buiding) to provide a 3D feels whatever the background's type.

How it works

The trick: Starting with a grey scale hillshade, the trick is to take the grey channel's values, inverted each value, and flow them into a new opacity channel. Black pixel [0,0,0] get opacity=255, grey pixel [120,120,120] get lower opacity=135, white pixel (255,255,255) get null opacity=0 and so on. Hillshades are opaque and black, plains progressively become (white) transparent. Conceptually, the pixel's band equation is something such :

alpha_value([Grey]) = 255-Grey;alpha_value([0]) = 255-0 = 255; // black pixel get full opacityalpha_value([255]) = 255-255 = 0 // white pixel get null opacity !Question

Taking an ETOPO or SRTM derived grey-based hillshade (gdaldem hillshade crop_xl.tmp.tif shadedrelief.tmp.tif -s 111120 -z 5 -az 315 -alt 60 -compute_edges, file available to download here) as input...

...How to do the trick cited upper via gdal or an other non GIS-destructive way on such .tif files ?

Note that I wish to keep GIS properties (geolocalisation).





أكثر...
 
أعلى