![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jörg 'Yadgar' Bleimann
Subject: Once again - problem with large mesh
Date: 30 Mar 2005 13:33:42
Message: <424af106@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
High!
Once again, like already in December 2003, I tried to render a spherical
mesh (to be precise, a small section of a spherical mesh, covering only
one square degree) from a 1200 x 1200 ASCII matrix generated itself from
a SRTM GeoTIFF (needless to say what part of the world ;-)).
I hoped that my new Athlon 64 2800+ would be able to cope with it... but
once again was disillusioned, after about 780 lines the parsing became
so slow that it would have take millennia to parse the rest.
Are there ways to speed things up? Christoph Hormann's HF_sphere macro
would not be an alternative as it renders only complete spheres (unless
there has been an update meanwhile, of which I don`t know yet), not
sections.
Here is the code:
#declare mtrix=array[1200][1200]
#warning "Reading ASCII matrix"
#fopen matr "e:\homepage\n34e068-b.txt" read
// #while(defined(matr))
#declare a=0;
#while (a<1200)
#declare b=0;
#while (b<1200)
#read (matr, data)
#declare mtrix[a][b]=data;
#declare b=b+1;
#end
#declare a=a+1;
#end
// #end
#fclose matr
#warning "Reading of ASCII matrix completed!"
#declare F_Standard=
finish { ambient 0.1 diffuse 1 brilliance 0.5 }
light_source
{
<-5000000, 30000000, 10000000>
color rgb 1
}
camera
{
location 10000*<sin(-68.5*(pi/180))*cos(34.5*(pi/180)),
sin(34.5*(pi/180)), cos(-68.5*(pi/180))*cos(34.5*(pi/180))>
look_at 0
angle 40
}
sky_sphere
{
pigment { color rgb <0.3, 0.6, 0.8> }
}
#declare re=6378140; // Earth, equatorial radius
#declare rp=6356755; // Earth, polar radius
#declare sLat=35;
#declare eLat=34;
#declare sLong=-68;
#declare eLong=-69;
mesh
{
#declare a=0;
#while (a<1199)
#declare b=0;
#while(b<1199)
triangle{<(re+mtrix[a][b])*sin((sLong-b/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180)),
(rp+mtrix[a][b])*sin((sLat-a/1200)*(pi/180)),
(re+mtrix[a][b])*cos((sLong-b/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180))>,
<(re+mtrix[a][b+1])*sin((sLong-(b+1)/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180)),
(rp+mtrix[a][b+1])*sin((sLat-a/1200)*(pi/180)),
(re+mtrix[a][b+1])*cos((sLong-(b+1)/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180))>,
<(re+mtrix[a+1][b])*sin((sLong-b/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180)),
(rp+mtrix[a+1][b])*sin((sLat-(a+1)/1200)*(pi/180)),
(re+mtrix[a+1][b])*cos((sLong-b/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180))>
}
triangle{<(re+mtrix[a][b+1])*sin((sLong-(b+1)/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180)),
(rp+mtrix[a][b+1])*sin((sLat-a/1200)*(pi/180)),
(re+mtrix[a][b+1])*cos((sLong-(b+1)/1200)*(pi/180))*cos((sLat-a/1200)*(pi/180))>,
<(re+mtrix[a+1][b+1])*sin((sLong-(b+1)/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180)),
(rp*mtrix[a+1][b+1])*sin((sLat-(a+1)/1200)*(pi/180)),
(re*mtrix[a+1][b+1])*cos((sLong-(b+1)/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180))>,
<(re+mtrix[a+1][b])*sin((sLong-b/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180)),
(rp+mtrix[a+1][b])*sin((sLat-(a+1)/1200)*(pi/180)),
(re+mtrix[a+1][b])*cos((sLong-b/1200)*(pi/180))*cos((sLat-(a+1)/1200)*(pi/180))>
}
#declare b=b+1;
#end
#warning concat("Parsing lines ", str(a, 4, 0), " and ", str(a+1,
4, 0),".")
#declare a=a+1;
#end
texture
{
pigment { color rgb <1, 0.5, 0> }
finish { F_Standard }
}
}
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: "Jérôme M. Berger"
Subject: Re: Once again - problem with large mesh
Date: 30 Mar 2005 16:20:06
Message: <424b1806@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
| High!
|
| Once again, like already in December 2003, I tried to render a
spherical
| mesh (to be precise, a small section of a spherical mesh, covering only
| one square degree) from a 1200 x 1200 ASCII matrix generated itself
from
| a SRTM GeoTIFF (needless to say what part of the world ;-)).
|
| I hoped that my new Athlon 64 2800+ would be able to cope with it...
but
| once again was disillusioned, after about 780 lines the parsing became
| so slow that it would have take millennia to parse the rest.
|
| Are there ways to speed things up? Christoph Hormann's HF_sphere macro
| would not be an alternative as it renders only complete spheres (unless
| there has been an update meanwhile, of which I don`t know yet), not
| sections.
|
How much RAM do you have on your computer? My bet is that it gets to
a point where you use too much memory and the computer starts to swap.
You could use a lot less memory by doing away with the mtrix arry and
using a mesh2 (and gain in computational complexity during parse at
the same time).
Try something like this (untested):
mesh2 {
~ vertex_vectors {
~ 1200*1200,
~ #fopen matr "e:\homepage\n34e068-b.txt" read
~ #declare a = 0;
~ #while (a < 1200)
~ #declare b = 0;
~ #while (b < 1200)
~ #read (matr, data)
~ <(re+data) * sin ((sLong-b/1200) * (pi/180)) *
~ cos ((sLat - a/1200) * (pi/180)),
~ (rp+mtrix[a][b])*sin((sLat-a/1200)*(pi/180)),
~ (re+data) * cos ((sLong-b/1200) * (pi/180)) *
~ cos ((sLat-a/1200)*(pi/180))>,
~ #declare b = b+1;
~ #end
~ #declare a = a+1;
~ #end
~ #fclose matr
~ }
~ face_indices {
~ 1199 * 1199 * 2,
~ #declare a = 0;
~ #while (a < 1199)
~ #declare b = 0;
~ #while (b < 1199)
~ <1200*a + b, 1200*a + b+1, 1200*(a+1) + b>,
~ <1200*a + b+1, 1200*(a+1) + b+1, 1200*(a+1) + b>,
~ #declare b = b+1;
~ #end
~ #declare a = a+1;
~ #end
~ }
~ texture {
~ pigment { color rgb <1, 0.5, 0> }
~ finish { F_Standard }
~ }
}
Jerome
- --
******************************
* Jerome M. Berger *
* mailto:jbe### [at] ifrance com *
* http://jeberger.free.fr/ *
******************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFCSxX6qIYJdJhyixIRAntZAJ9Psj1Xr7CsxU4LRgY28KfGwE00iwCffy5v
mGd6+/gyYQhhToVwZpqvBOE=
=y78+
-----END PGP SIGNATURE-----
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
High!
> How much RAM do you have on your computer?
Only 512 MB :-(
> Try something like this (untested):
>
> mesh2 {
> ~ vertex_vectors {
> ~ 1200*1200,
> ~ #fopen matr "e:\homepage\n34e068-b.txt" read
> ~ #declare a = 0;
> ~ #while (a < 1200)
> ~ #declare b = 0;
> ~ #while (b < 1200)
> ~ #read (matr, data)
> ~ <(re+data) * sin ((sLong-b/1200) * (pi/180)) *
> ~ cos ((sLat - a/1200) * (pi/180)),
> ~ (rp+mtrix[a][b])*sin((sLat-a/1200)*(pi/180)),
> ~ (re+data) * cos ((sLong-b/1200) * (pi/180)) *
> ~ cos ((sLat-a/1200)*(pi/180))>,
This won't work, as the array elements need to be assigned before!
Also, after the last vector must not follow a comma!
I rewrote the script, parsing runs perfectly, very quick - but then
(under Linux, I did not try it yet under Windows) the process is killed
and nothing is rendered at all!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: "Jérôme M. Berger"
Subject: Re: Once again - problem with large mesh
Date: 31 Mar 2005 12:44:11
Message: <424c36eb@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Yadgar wrote:
| High!
|
|
|> How much RAM do you have on your computer?
|
|
| Only 512 MB :-(
That's probably a bit short for your scene, which explains the sudden
slowdown (when the computer runs out of RAM and starts to swap).
|
|> Try something like this (untested):
|> ...
|> ~ #read (matr, data)
|> ~ <(re+data) * sin ((sLong-b/1200) * (pi/180)) *
|> ~ cos ((sLat - a/1200) * (pi/180)),
|> ~ (rp+mtrix[a][b])*sin((sLat-a/1200)*(pi/180)),
|> ~ (re+data) * cos ((sLong-b/1200) * (pi/180)) *
|> ~ cos ((sLat-a/1200)*(pi/180))>,
|
|
| This won't work, as the array elements need to be assigned before!
Sorry for the typo, "mtrix[a][b]" should be replaced by "data". The
array wastes the equivalent of 400*1200 mesh vertices so it must not
be used at all.
| Also, after the last vector must not follow a comma!
|
| I rewrote the script, parsing runs perfectly, very quick - but then
| (under Linux, I did not try it yet under Windows) the process is killed
| and nothing is rendered at all!
Is there an error message or does it just crash?
Jerome
- --
******************************
* Jerome M. Berger *
* mailto:jbe### [at] ifrance com *
* http://jeberger.free.fr/ *
******************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFCTDYgqIYJdJhyixIRAsvwAJ0XF8cHqFGx9Ed4+O4Y0hxQjJKhLACgsS9T
ZpFdgywpcsMQzy++lJg4CAQ=
=s8zG
-----END PGP SIGNATURE-----
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
High!
That's probably a bit short for your scene, which explains the sudden
slowdown (when the computer runs out of RAM and starts to swap).
Perhaps I could thin out the data points, i. e. make a 600 x 600 matrix
and assign only each second point...
| I rewrote the script, parsing runs perfectly, very quick - but then
| (under Linux, I did not try it yet under Windows) the process is killed
| and nothing is rendered at all!
Is there an error message or does it just crash?
program ended.
Meanwhile, I also tried it under Windows 98 - and then in fact the
rendering started (hey, isn't it scandalous - Windows performing better
than Linux!), but I could see only blue sky background, no spherical mesh!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
High!
Yadgar schrieb:
> Meanwhile, I also tried it under Windows 98 - and then in fact the
> rendering started (hey, isn't it scandalous - Windows performing better
> than Linux!), but I could see only blue sky background, no spherical mesh!
>
Oops, I see now what went wrong - I confused metres and kilometres when
I placed the camera - it's only 10,000 units from the origin, while it
should be 10,000,000!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>
> Are there ways to speed things up? Christoph Hormann's HF_sphere macro
> would not be an alternative as it renders only complete spheres (unless
> there has been an update meanwhile, of which I don`t know yet), not
> sections.
Just for the record - i did not write the HF_sphere macro in shapes.inc.
I did however write the IC_HF_Sphere macro in the IsoCSG library and
it will not have any trouble to handle large images and you can also
make the image cover only parts of the sphere without problems (by
modifying the macro or by using IC_HF_Sphere_Function instead).
http://www.tu-bs.de/%7Ey0013390/pov/ic/docu02.html#HF_Sphere
http://www.tu-bs.de/%7Ey0013390/pov/ic/docu02.html#HF_Sphere_Function
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 27 Feb. 2005 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |