POV-Ray : Newsgroups : povray.newusers : Reading Raster ASCII data for animation Server Time
23 Nov 2024 18:07:53 EST (-0500)
  Reading Raster ASCII data for animation (Message 1 to 2 of 2)  
From: Erick
Subject: Reading Raster ASCII data for animation
Date: 3 Apr 2012 01:20:06
Message: <web.4f7a881bc5fd7c09108129760@news.povray.org>
Hello
I am very new at POV-Ray but I saw it is quite powerful and high quality
rendered images. My goal is to make an animation out of several RASTER data in
ASCII format I have. It is related to wave propagation in the coast. The data
looks like this:

ncols         1099               ---> # of grids X
nrows         1453               ---> # of grids Y
xllcorner     451497.16550264    ---> Long. Coord.
yllcorner     3950829.9769289    ---> Lat. Coord.
cellsize      405                ---> size of grid
NODATA_value  -99              ---> no data - no height (m)
 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000
 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000
 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000
 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000
 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000 -99.000   0.000
   0.000   0.000  -0.001  -0.001  -0.001  -0.001  -0.001  -0.001  -0.002  -0.002
  -0.002  -0.002  -0.002  -0.002  -0.003  -0.003  -0.003  -0.003  -0.003  -0.003
  -0.004  -0.004  -0.004  -0.004  [...]

I normally used Transform for a 2D animation, but I wish I can make a 3D
animation of these data. How can I read into POV-Ray such data and use it to
generate an image of a map with terrain (negative values) and sea (positive
values)?.
I would appreciate your help, thank you!

Erick


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Reading Raster ASCII data for animation
Date: 3 Apr 2012 18:24:52
Message: <4f7b78b4@news.povray.org>
> How can I read into POV-Ray such data

Although Povray has some file I/O (#fopen, #read, #fclose), it can
only parse values for comma-separated files. You therefore need to do
some external processing to get the data into povray. Apart from making
the data digestable for #read, you can alternatively generate an include 
file in POV-Ray syntax initializing some variables and in particular
an array literal containing the main data.

However, in your case the raster data would more naturally be
represented as an image. So if you can create an image out of the
data (you can use a 16-bit gray png if you need the resolution),
that would be the easiest option.

> and use it to generate an image of a map with terrain (negative
> values) and sea (positive values)?.

I assume you want to interpret the values as height. For this
the height_field object is appropriate. It can directly work with
a grayscale height image.

If you only read the ascii data in an array the best way to
proceed is probably to generate a mesh2 object with your data
points as vertexes.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.