POV-Ray : Newsgroups : povray.text.scene-files : POVEarth: once more mesh2writer.pov : Re: POVEarth: once more mesh2writer.pov Server Time
29 Nov 2022 18:52:08 EST (-0500)
  Re: POVEarth: once more mesh2writer.pov  
From: Bald Eagle
Date: 2 Aug 2020 13:45:00
Message: <web.5f26fa7267d51b0c1f9dae300@news.povray.org>
> By request in the process of debugging, here the current version of the
> script file mentioned in the subject:

A few points of observation:

1. _attach_ the scene as a .pov file to avoid the split-line / wrapping issue

2. You load the same image twice
     #declare P_Heightfield=
     #declare P_Texture=
why not just reuse the same image_map pigment pattern?

3. THEN, you scan the entire image TWICE, which has to take forever
#declare hcolor = eval_pigment(P_Heightfield, <(0.5+b)*(1/xdim),
(0.5+a)*(1/ydim), 1>);
// #declare C_Texture = eval_pigment(P_Texture, <(0.5+b)*(1/(xdim-1)),
(0.5+a)*(1/(ydim-1)), 0>);
and why is one calculation using xdim & ydim, and the other using xdim-1 &
ydim-1 ?

4. it's presently unclear to me how your calculations are working, but it does
seem to me that you are working on the images in the default unit square pigment
pattern.   You should get rid of

#declare xdim=1000; // full resolution: 3601;
#declare ydim=1000; // full resolution: 3601;

and use something like
#declare ImageMap = pigment {image_map {"yourimage.jpg" once} };
#declare Resolution = max_extent (ImageMap);
#declare Resolution = Resolution + <0, 0, 1>;

in order to automatically give you the correct number of pixels in the image.
then if you

scale Resolution

You will have an image_map pigment pattern where you can use integers in your
loops for pixel positions.

5.  I think you're breaking things up into several sequential loops where there
are a lot of redundant things happening, and you would do far better to perform
all of your operations in a single loop.
You store a lot of values in large arrays, but I'm not sure that if it were all
in one loop that you would need to store all of those values.  And of course
that would free up a LOT of memory.

Post a reply to this message

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