POV-Ray : Newsgroups : povray.general : Create heightmap from contour lines : Re: Create heightmap from contour lines Server Time
29 Jul 2024 04:30:27 EDT (-0400)
  Re: Create heightmap from contour lines  
From: Le Forgeron
Date: 2 Jan 2013 09:04:58
Message: <50e43e8a$1@news.povray.org>
Le 02/01/2013 14:28, scott nous fit lire :

>> Then for each vertex, you can compute the average normal at that vertex
>> by averaging the normal of its contributing triangles.
> 
> There's still the problem with how to deal with areas above the highest
> contour and below the lowest contour, I would like it to somehow follow
> on the gradient the other side of the contour rather than just be flat.

As the contributing triangles at a top vertex would either be :
* horizontal (same height)
* inclined (lower height)
the normal for the vertex is not going to be vertical.
As a consequence, the horizontal smooth_triangle at the top is going to
have normal that would generate a faked curve.

You would then need to sub-tesselate the mesh to generate
sub-true-triangles according to the computed normales (that
sub-tesselation should be done with a central point at the triangle
center, not only with intermediates points along the triangle's sides)

Assuming you have "random coordinate points", you might generate a
regular mesh using a regular triangle pattern, as long as the side of
your projected triangle is smaller than (half at least ?) the smallest
distance between the nearest two points in your points.
For each vertex of your mesh, compute its height with a weighted average
of all coordinates points.
The weight of Point k must inversely proportional to the distance of the
projected Point k with the projected vertex. When the distance is 0, the
weight should override any other contribution.

For instance, you could use as individual weight: 1/exp(distance)
(it's imperfect, as distance of 0 is not overriding any other values)

Using a bigger value than e for the exponential might provides smaller
influences of far values.

You can also clip the influence of a point once the distance is too far.
(typically twice the maximal distance between two adjacent lines of your
original curves): intercept with a test & replace weight by 0.


Post a reply to this message

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