POV-Ray : Newsgroups : povray.off-topic : Heightfield modification Server Time
11 Oct 2026 17:58:05 EDT (-0400)
  Heightfield modification (Message 1 to 21 of 21)  
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

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 18 Aug 2015 12:22:47
Message: <55d35bd7$1@news.povray.org>
On 8/15/2015 6:43 AM, Stephen wrote:
> 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.
>

Can POVray produce images suitable for using as heightfields?


Post a reply to this message

From: Stephen
Subject: Re: Heightfield modification
Date: 18 Aug 2015 12:48:47
Message: <55d361ef$1@news.povray.org>
On 8/18/2015 5:22 PM, Mike Horvath wrote:
> On 8/15/2015 6:43 AM, Stephen wrote:
>> 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.
>>
>
> Can POVray produce images suitable for using as heightfields?

Yes, use an orthographic camera and a square aspect ratio.

But I don't have enough experience to guide you on the slope pattern.

-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 19 Aug 2015 20:17:17
Message: <55d51c8d$1@news.povray.org>
On 8/18/2015 12:48 PM, Stephen wrote:
> On 8/18/2015 5:22 PM, Mike Horvath wrote:
>> Can POVray produce images suitable for using as heightfields?
>
> Yes, use an orthographic camera and a square aspect ratio.
>
> But I don't have enough experience to guide you on the slope pattern.
>

What I mean is, isn't there a special 16 bit format used by 
heightfields? Can POVray save as this special format?


Mike


Post a reply to this message

From: Nekar Xenos
Subject: Re: Heightfield modification
Date: 19 Aug 2015 22:18:09
Message: <op.x3m90ebkufxv4h@xena>
On Thu, 20 Aug 2015 02:17:24 +0200, Mike Horvath <mik### [at] gmailcom>  
wrote:

> On 8/18/2015 12:48 PM, Stephen wrote:
>> On 8/18/2015 5:22 PM, Mike Horvath wrote:
>>> Can POVray produce images suitable for using as heightfields?
>>
>> Yes, use an orthographic camera and a square aspect ratio.
>>
>> But I don't have enough experience to guide you on the slope pattern.
>>
>
> What I mean is, isn't there a special 16 bit format used by  
> heightfields? Can POVray save as this special format?
>

Yes there is. But I can't remember the command line settings. I think it's  
in the docs.

-- 
-Nekar Xenos-


Post a reply to this message

From: clipka
Subject: Re: Heightfield modification
Date: 20 Aug 2015 01:04:02
Message: <55d55fc2$1@news.povray.org>
Am 20.08.2015 um 02:17 schrieb Mike Horvath:
> On 8/18/2015 12:48 PM, Stephen wrote:
>> On 8/18/2015 5:22 PM, Mike Horvath wrote:
>>> Can POVray produce images suitable for using as heightfields?
>>
>> Yes, use an orthographic camera and a square aspect ratio.
>>
>> But I don't have enough experience to guide you on the slope pattern.
>>
> 
> What I mean is, isn't there a special 16 bit format used by
> heightfields? Can POVray save as this special format?

There /used/ to be a special variant of the .gif format known as POT
files, back in the good old times when most file formats were limited to
8 bit (total!) per pixel.

To my knowledge, POV-Ray was never able to write this format itself (in
fact it seems that the only commonly known program that ever wrote this
type of format was the infamous FractInt), and I'm not even sure whether
POV-Ray can still read it.

Also IIRC there's some hackish solution in the code for using two colour
channels of a 3*8 bits-per-pixel file format to achieve a depth of 16
bits; again, I'm not sure whether POV-Ray can also write this format.

Be that as it may, all those solutions are pretty much obsolete these
days; POV-Ray can use any of the supported image file formats for height
field data input, including several contemporary ones that natively
support a depth of 16 bits per colour channel (such as PNG).

To generate an output file with 16 bits per colour channel, use the
"Bits_Per_Color=n" ini file option, or the "+Fxn" command-line option
where "x" is the letter representing the desired file type, such as "N"
for PNG.

Specifically for the use with height fields, POV-Ray also supports
greyscale-only 16-bit file output (which saves a bit of disk space and
is faster and more memory-efficient when used as input) for the PNG file
format; to enable this, use "Greyscale_Output=true" or "+FNg".


One thing worth noting is that you should specify the "File_Gamma=1" ini
file option and "assumed_gamma 1.0" global scene setting when generating
files for height fields.


Post a reply to this message

From: Stephen
Subject: Re: Heightfield modification
Date: 20 Aug 2015 02:20:42
Message: <55d571ba$1@news.povray.org>
On 8/20/2015 6:03 AM, clipka wrote:
> There/used/  to be a special variant of the .gif format known as POT
> files, back in the good old times when most file formats were limited to
> 8 bit (total!) per pixel.
>
> To my knowledge, POV-Ray was never able to write this format itself (in
> fact it seems that the only commonly known program that ever wrote this
> type of format was the infamous FractInt), and I'm not even sure whether
> POV-Ray can still read it.

That is how I first heard of PovRay. From the FractInt (why infamous?) 
help doc.

-- 

Regards
     Stephen


Post a reply to this message

From: Thomas de Groot
Subject: Re: Heightfield modification
Date: 20 Aug 2015 03:41:45
Message: <55d584b9$1@news.povray.org>
On 20-8-2015 8:20, Stephen wrote:
> On 8/20/2015 6:03 AM, clipka wrote:
>> There/used/  to be a special variant of the .gif format known as POT
>> files, back in the good old times when most file formats were limited to
>> 8 bit (total!) per pixel.
>>
>> To my knowledge, POV-Ray was never able to write this format itself (in
>> fact it seems that the only commonly known program that ever wrote this
>> type of format was the infamous FractInt), and I'm not even sure whether
>> POV-Ray can still read it.
>
> That is how I first heard of PovRay. From the FractInt (why infamous?)
> help doc.
>

Yes, POV-Ray can use POT files for height_fields. See the Docs.

Fractint was far from infamous. To the contrary, it was the most 
formidable mandelbrot generator of its days available to the general 
public. It contributed to my discovery and use of POV-Ray too.

-- 
Thomas


Post a reply to this message

From: clipka
Subject: Re: Heightfield modification
Date: 20 Aug 2015 07:20:59
Message: <55d5b81b$1@news.povray.org>
Am 20.08.2015 um 08:20 schrieb Stephen:
> On 8/20/2015 6:03 AM, clipka wrote:
>> There/used/  to be a special variant of the .gif format known as POT
>> files, back in the good old times when most file formats were limited to
>> 8 bit (total!) per pixel.
>>
>> To my knowledge, POV-Ray was never able to write this format itself (in
>> fact it seems that the only commonly known program that ever wrote this
>> type of format was the infamous FractInt), and I'm not even sure whether
>> POV-Ray can still read it.
> 
> That is how I first heard of PovRay. From the FractInt (why infamous?)
> help doc.

Infamous because, while I hate to admit it, my English isn't perfect :-}

For some reason I was convinced that the word could be used with a
connotation of respect for outstanding achievements and bravado
bordering (or beyond) the illegal - possibly because the German
equivalent, "berüchtigt", can sometimes be used in this sense
(especially in the combination "berühmt-berüchtigt").

Strike that, and insert "badass" instead.


Post a reply to this message

From: Stephen
Subject: Re: Heightfield modification
Date: 20 Aug 2015 08:36:01
Message: <55d5c9b1$1@news.povray.org>
On 8/20/2015 12:20 PM, clipka wrote:
> Infamous because, while I hate to admit it, my English isn't perfect :-}
>

It is probably better than mine. :-)
Init!

> For some reason I was convinced that the word could be used with a
> connotation of respect for outstanding achievements and bravado
> bordering (or beyond) the illegal - possibly because the German
> equivalent, "berüchtigt", can sometimes be used in this sense
> (especially in the combination "berühmt-berüchtigt").
>

Google translates berüchtigt as notorious. Which fits in with your 
definition. I would have said the renowned Fractint.


> Strike that, and insert "badass" instead.
>

I don't suppose it is any easier when words like wicked and cool, have 
reversed their meanings in recent years.

-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: Heightfield modification
Date: 20 Aug 2015 20:31:40
Message: <55d6716c$1@news.povray.org>
On 8/16/2015 12:21 PM, Mike Horvath wrote:
> 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


Wow, Stack Exchange is stumped too! So far about a half dozen people 
haven't been able to figure it out.


Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: Heightfield modification
Date: 21 Aug 2015 03:18:49
Message: <55d6d0d9$1@news.povray.org>
On 20-8-2015 13:20, clipka wrote:
> For some reason I was convinced that the word could be used with a
> connotation of respect for outstanding achievements and bravado
> bordering (or beyond) the illegal - possibly because the German
> equivalent, "berüchtigt", can sometimes be used in this sense
> (especially in the combination "berühmt-berüchtigt").

That is interesting. I think that in Dutch (beroemd-berucht) that would 
not be possible. At least I think so... Language is a tricky business.

-- 
Thomas


Post a reply to this message

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