[GRASS-user] r.out.pov scale question

Adam Dershowitz, Ph.D., P.E. adershowitz at exponent.com
Tue Nov 2 13:57:01 EDT 2010


I have not heard anything back on this, so decided to go to the source code of r.out.pov.  I figured out the answer and wanted to post it, in case it is useful to anyone else, or someone might want to add it to the help page.
Here is what I figured out.  
1)  scale, and hftype are independent.  
So, first each cell is multiplied by scale (so, if a cell elevation is 12m and scale is 10, then the new value is 120.)  The default value of scale is 1.0.  
If hftype is set to 1, then each cell is multiplied by 65535/(maximum elevation value in the map).  

So, when using hftype=1, the correct scaling in the POV ray file is the maximum height in the map.  For example, if the maximum elevation is 1086 m, then this should go in the POV file:
scale < 1391, 1086, 1810 > // dx,dz,dy of extent in meters

Finally, I believe that there is a bug in r.out.pov!  It seems that "bias" is read in, in order to apply a bias to the height field, however "hfBias" is the variable that is actually being used for the calculations, and it is never assigned a value.  And "bias" is not actually used in any calculations.

--Adam



On Oct 27, 2010, at 9:07 AM, Adam Dershowitz, Ph.D., P.E. wrote:

> I have been trying to use r.out.pov but something is not clear to me from the documentation, and examples I can find on the web.
> If I use hftype=0 (the default) then, as I understand it it, each step, from 0-65535 represents one map unit (meters in my case).  That is giving me too much "stair-stepping" in POVRAY.  
> I think that part of the issue is that there is too much rounding of elevations.  So, I decided to try hrtype=1.  As I understand it that will scale the height of the image to use more of the range (my map just goes from 61-1086 meters).  But, I can't seem to figure out how much it scales by.  There is also the scale= option in r.out.pov, but I am not sure if that is a multiplier or a divider?  
> This is important because I need to then scale the heighfield in my POV file.  If I use hrtype=0 then this is correct:
> scale < dx, 65535, dy >
> 
> But, if I use hftype=1, what is the correct value for the above scale command?  Is it 65535/1086 (max height in the map?)
> 65535/(1086-61)  (vertical range of my map?)
> 
> If I use scale=10 then should it be?
> scale < dx, 65535/10, dy >
> scale < dx, 65535*10, dy >
> scale < dx, 10, dy >
> 
> Or should I use scale=0.1?  Or should I use r.out.pov scale=65535/1086
> 
> Thanks,
> 
> --Adam
> 
> 
> 
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user



More information about the grass-user mailing list