|
|
High!
I recently started preparing for building Khyberspace (= POVghanistan)
in earnest... I downloaded some SRTM Earth elevation data tiles of
south-western Afghanistan, converted them to ASCII terrain matrices
using 3DEM, and then (as 3DEM is not able to correct error pixels when
they are adjacent to the tile's edges) convert them into 16-bit PNG
heightfields using a self-programmed POV-Ray script.
Then I stitched together two of these heightfield tiles with error
pixels (marked in blue by my POV-Ray script) and cut out a 1200 x 1200
square tile from the mid-section of these combined tiles (attached
below) which in turn I tried to re-convert into an ASCII matrix readable
to 3DEM (to more conveniently clean up the remaining error pixels).
But my "png2ascii" script wrote strange values into that ASCII file -
elevations are far too low, instead of some 350 metres below sea level,
they should be around 500 metres above sea level! I checked the color
vector output of eval_pigment(), and in fact the function returned red
values between 0.01 and 0.05, where it should have been between 0.09 and
0.16!
What went wrong with eval_pigment()?
Here is the code:
// Converting PNG 16-bit heightfields into SRTM ASCII terrain matrices
// Non-commercial use is free; any commercial usage needs written
authorization by the copyright owner
#include "functions.inc"
#declare xdim=1200;
#declare ydim=1200;
#declare deadsea=422;
#declare everest=8848;
#declare rng=everest+deadsea;
#declare hf=
pigment
{
image_map
{
png "../png_half_patched/n29e061-5.png"
}
}
#fopen srtm "n29e061-5.txt" write
#declare b=0;
#while (b<ydim)
#declare a=0;
#while (a<xdim)
#declare cv=eval_pigment(hf, <1/(xdim*2)+a*(1/xdim),
1/(ydim*2)+b*(1/ydim), 0>);
#warning vstr(3,cv,",",3,2)
#declare h=rng*(cv.red+cv.green/256)-deadsea;
#write (srtm, str(h, 1, 2), " ")
#declare a=a+1;
#end
#declare b=b+1;
#end
#fclose srtm
camera
{
orthographic
up <0, ydim, 0>
right <xdim, 0, 0>
location <xdim/2, ydim/2, -10>
look_at <xdim/2, ydim/2, 0>
}
// end of code
See you in Khyberspace!
Yadgar
Post a reply to this message
Attachments:
Download 'n29e061-5.png' (1069 KB)
Preview of image 'n29e061-5.png'
|
|
|
|
High!
On 10/25/2010 02:29 AM, Jim Holsenback wrote:
>
http://wiki.povray.org/content/Documentation:Reference_Section_5#Specifying_an_Image_Map
>
> in particular the file_gamma option:
> http://wiki.povray.org/content/Documentation:Reference_Section_5#The_Gamma_Option
Yes, I looked that up, but in refers to PoV-Ray 3.7, while I still use
3.6 (and will continue so as long as it is still beta, as a friend of
mine who is also an avid PoVer frequently experiences crashes when
running 3.7)... but then I just adjusted assumed gamma to 2.2 and now
color values are perfect!
Nevertheless, thank you for the hint!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
|
|
|
news:4cc774a4$1@news.povray.org...
> Yes, I looked that up, but in refers to PoV-Ray 3.7, while I still use 3.6
> (and will continue so as long as it is still beta, as a friend of mine who
> is also an avid PoVer frequently experiences crashes when running 3.7)...
> but then I just adjusted assumed gamma to 2.2 and now color values are
> perfect!
>
I am not an expert ;-) but I don't think those crashes are due to POV-Ray
3.7.... You can use the beta safely. It never crashed on me at least (using
the Windows version).
Thomas
Post a reply to this message
|
|
|
|
> High!
>
> On 10/25/2010 02:29 AM, Jim Holsenback wrote:
>
>>
http://wiki.povray.org/content/Documentation:Reference_Section_5#Specifying_an_Image_Map
>>
>>
>> in particular the file_gamma option:
>> http://wiki.povray.org/content/Documentation:Reference_Section_5#The_Gamma_Option
>>
>
> Yes, I looked that up, but in refers to PoV-Ray 3.7, while I still use
> 3.6 (and will continue so as long as it is still beta, as a friend of
> mine who is also an avid PoVer frequently experiences crashes when
> running 3.7)... but then I just adjusted assumed gamma to 2.2 and now
> color values are perfect!
>
> Nevertheless, thank you for the hint!
>
> See you in Khyberspace!
>
> Yadgar
>
Version 3.7 is prety stable and not prone to crash.
Maybe the crashes of your friend are due to something else on his computer.
Alain
Post a reply to this message
|
|