POV-Ray : Newsgroups : povray.off-topic : Heightfield modification Server Time
31 Oct 2024 21:28:09 EDT (-0400)
  Heightfield modification (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Mike Horvath
Subject: Heightfield modification
Date: 15 Aug 2015 00:49:12
Message: <55cec4c8$1@news.povray.org>
Let's say that I have a array of points generated from a height field. 
But I want areas of low slope to be made completely flat and rounded to 
the nearest 24 vertical units.

I know that the result will no longer be a classic heightfield since 
there will be vertical areas that will need to be joined by new 
triangles. But how would I accomplish this?

The simplest thing to do would be to measure the slope of each triangle 
relative to the ground plane and then alter the vertices. But the 
triangles are in a regular grid:

http://i421.photobucket.com/albums/pp292/SharkD2161/LDraw/terrain_nosteps_standin_01_zps6hreaqla.png

It will look funny since all they are all oriented in the same direction.

Thanks for the help!


Mike


Post a reply to this message

From: clipka
Subject: Re: Heightfield modification
Date: 15 Aug 2015 01:18:00
Message: <55cecb88$1@news.povray.org>
Am 15.08.2015 um 06:49 schrieb Mike Horvath:
> Let's say that I have a array of points generated from a height field.
> But I want areas of low slope to be made completely flat and rounded to
> the nearest 24 vertical units.
>
> I know that the result will no longer be a classic heightfield since
> there will be vertical areas that will need to be joined by new
> triangles. But how would I accomplish this?

Sounds like what you want is the equivalent of a 2D array of boxes, with 
each box's height determined by an input image. Do I understand that 
correctly?

POV-Ray currently doesn't provide any native support for such an object 
(except of course an actual array of boxes, a mesh generated by a custom 
macro, or some such). It shouldn't be too difficult to implement such a 
primitive though.


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 15 Aug 2015 01:33:45
Message: <55cecf39$1@news.povray.org>
On 8/15/2015 1:17 AM, clipka wrote:
> Am 15.08.2015 um 06:49 schrieb Mike Horvath:
>> Let's say that I have a array of points generated from a height field.
>> But I want areas of low slope to be made completely flat and rounded to
>> the nearest 24 vertical units.
>>
>> I know that the result will no longer be a classic heightfield since
>> there will be vertical areas that will need to be joined by new
>> triangles. But how would I accomplish this?
>
> Sounds like what you want is the equivalent of a 2D array of boxes, with
> each box's height determined by an input image. Do I understand that
> correctly?
>
> POV-Ray currently doesn't provide any native support for such an object
> (except of course an actual array of boxes, a mesh generated by a custom
> macro, or some such). It shouldn't be too difficult to implement such a
> primitive though.
>


I only need the special behavior when the slope is already low. For 
areas with a large slope I want to retain the original smooth mesh.

I will have to do the calculations myself because I need to be able to 
import the mesh into LDraw.


Post a reply to this message

From: Le Forgeron
Subject: Re: Heightfield modification
Date: 15 Aug 2015 05:05:33
Message: <55cf00dd$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 15/08/2015 07:33, Mike Horvath a écrit :
> On 8/15/2015 1:17 AM, clipka wrote:
>> Am 15.08.2015 um 06:49 schrieb Mike Horvath:
>>> Let's say that I have a array of points generated from a height
>>> field. But I want areas of low slope to be made completely flat
>>> and rounded to the nearest 24 vertical units.
>>> 
>>> I know that the result will no longer be a classic heightfield
>>> since there will be vertical areas that will need to be joined
>>> by new triangles. But how would I accomplish this?
>> 
>> Sounds like what you want is the equivalent of a 2D array of
>> boxes, with each box's height determined by an input image. Do I
>> understand that correctly?
>> 
>> POV-Ray currently doesn't provide any native support for such an
>> object (except of course an actual array of boxes, a mesh
>> generated by a custom macro, or some such). It shouldn't be too
>> difficult to implement such a primitive though.
>> 
> 
> 
> I only need the special behavior when the slope is already low.
> For areas with a large slope I want to retain the original smooth
> mesh.
> 

Assuming the height-field is created from an image, what you seems to
want is a local filter to detect slope and make them flat... aka
uniform in colour.

With the exception of nearest 24 vertical unit rounding, that looks
like a color/palette reduction in any decent picture manipulation
program. That kind of thing.

> I will have to do the calculations myself because I need to be able
> to import the mesh into LDraw.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlXPAN0ACgkQhKAm8mTpkW2fcAQAifIjBBLeXx45pPguEg2d2YXI
hdev1wOnwEbrEMW0GGJ/oTPJ6bAKY78+LeKh/Bn7m5JXVCf8FRPA/MHWSNjwXnJ4
WAYRGgHkOM4SMZtUKB1KjB3i310FOFJ8qRQusl8R3oG2o4X8CxnyyboN461Wz+Q6
SaOq9MvsmB9lH6SZi50=
=4Hr0
-----END PGP SIGNATURE-----


Post a reply to this message

From: Stephen
Subject: Re: Heightfield modification
Date: 15 Aug 2015 06:43:18
Message: <55cf17c6$1@news.povray.org>
On 8/15/2015 10:05 AM, Le_Forgeron wrote:
> Assuming the height-field is created from an image, what you seems to
> want is a local filter to detect slope and make them flat... aka
> uniform in colour.
>
> With the exception of nearest 24 vertical unit rounding, that looks
> like a color/palette reduction in any decent picture manipulation
> program. That kind of thing.

I was wondering if the slop pattern could be used to create a modified 
image to use as a height field.

-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 16 Aug 2015 12:21:10
Message: <55d0b876$1@news.povray.org>
How do I calculate the slope of a 3D triangle with respect to the ground 
plane? And I need a non-POVray solution. Thanks.

Mike


Post a reply to this message

From: Nekar Xenos
Subject: Re: Heightfield modification
Date: 16 Aug 2015 13:06:18
Message: <op.x3g0grcrufxv4h@xena>
On Sat, 15 Aug 2015 06:49:23 +0200, Mike Horvath <mik### [at] gmailcom>
wrote:

> Let's say that I have a array of points generated from a height field.  
> But I want areas of low slope to be made completely flat and rounded to  
> the nearest 24 vertical units.
>
> I know that the result will no longer be a classic heightfield since  
> there will be vertical areas that will need to be joined by new  
> triangles. But how would I accomplish this?
>
> The simplest thing to do would be to measure the slope of each triangle  
> relative to the ground plane and then alter the vertices. But the  
> triangles are in a regular grid:
>
>
http://i421.photobucket.com/albums/pp292/SharkD2161/LDraw/terrain_nosteps_standin_01_zps6hreaqla.png
>
> It will look funny since all they are all oriented in the same direction.
>
> Thanks for the help!
>
>
> Mike

Maybe open the map in Photoshop. The largest areas should be the flattest  
areas, so they should be easy to select with the Magic Wand Tool. Once  
selected, Image adjustment/Gradient Map should do the trick if you edit  
the gradient to be only 24 shades of grey.


-- 
-Nekar Xenos-


Post a reply to this message

From: Le Forgeron
Subject: Re: Heightfield modification
Date: 16 Aug 2015 14:34:26
Message: <55d0d7b2$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 16/08/2015 18:21, Mike Horvath a écrit :
> How do I calculate the slope of a 3D triangle with respect to the
> ground plane? And I need a non-POVray solution. Thanks.
> 
> Mike

basic 3x3 matrix of delta, in height field.
You get 8 products ( assume a 3x3 grid, numbered clockwise around the
center cell, of vectors from center cell to border cell: 1-c-2, 2-c-3,
...up to 8-c-1 ).

The projection on the plane of each products is 45°, so the sum of the
8 values gives you a criteria to detect a relative null curvature.

(there is the true flat situation, and the monkey saddle, but for the
central point, all of them are of flat at center).


Now, if you have a true triangle, it's another matter, just compute
the normal and normalize it, then project on the vertical axis and
check the length of the projection.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iJwEAQEIAAYFAlXQ17IACgkQhKAm8mTpkW117wP9Fa2lWNrXLdfg2bU5zT6Fq5HX
aUwL5j/M7N5v9nKGPJAQwwLncb3R0Uzr0kZQS4s18g+JYsdnaovj2eZd+8QfChNd
gpXunDXsvdva1WZTGPjCmkXjVakdKre79MwjShQoKvhjSOHCKR13dnpTILExTwsm
EQHjBpCJ80RFk9rFrQI=
=qiQo
-----END PGP SIGNATURE-----


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 17 Aug 2015 12:24:25
Message: <55d20ab9$1@news.povray.org>
On 8/16/2015 2:34 PM, Le_Forgeron wrote:
> Now, if you have a true triangle, it's another matter, just compute
> the normal and normalize it, then project on the vertical axis and
> check the length of the projection.

Some code would be helpful. JScript or VB or Lua please.

Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 17 Aug 2015 12:34:39
Message: <55d20d1f$1@news.povray.org>
On 8/16/2015 1:06 PM, Nekar Xenos wrote:
> Maybe open the map in Photoshop. The largest areas should be the
> flattest areas, so they should be easy to select with the Magic Wand
> Tool. Once selected, Image adjustment/Gradient Map should do the trick
> if you edit the gradient to be only 24 shades of grey.
>
>

1. An image is not going to work because the result may have coordinates 
sharing the same XZ positions, but differing in Y. You can't do this 
with images.
2. I want a solution in code, not one where I have to do things by hand.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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