![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nicolas Alvarez <nic### [at] gmail com> wrote:
> SharkD wrote:
> > "clipka" <nomail@nomail> wrote:
> >> it's not very easy to tell, given the low resolution - but it is quite
> >> obvious that the red channel is most significant. So I'd guess that the
> >> height is coded as:
> >>
> >> height = red + (green/256.0) + (blue/65536.0)
> >>
> >> with red, green, blue and height all ranging from 0.0 to 1.0.
> >
> > I don't quite understand your math. If red, green and blue all range from
> > 0 to 1, then the maximum possible height is 3. The maximum height of
> > heightfields is 1.
>
> Those maths assume red, green and blue go from 0 to 255, and height would be
> from 0 to 16777216.
OK, but 255 + 255/256 + 255/65536 still don't add up to 16777216!
-Mike
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) |
SharkD wrote:
> Nicolas Alvarez <nic### [at] gmail com> wrote:
>> You want POV-Ray to output an image like this, for another application to
>> use?
>
> No, I want to reuse the images in POV.
I put the image directly into a heightfield, and I think I got the correct
height, but only at 16 bits. I can't see any way (without hacking the code)
to get 24 bits of precision in a heightfield.
The only way to put data in a heightfield without passing a filename is
using bitmap functions (function 200,200 { ... }), and those also support
only 16-bit.
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) |
SharkD wrote:
> Nicolas Alvarez <nic### [at] gmail com> wrote:
>> SharkD wrote:
>>> "clipka" <nomail@nomail> wrote:
>>>> it's not very easy to tell, given the low resolution - but it is quite
>>>> obvious that the red channel is most significant. So I'd guess that the
>>>> height is coded as:
>>>>
>>>> height = red + (green/256.0) + (blue/65536.0)
>>>>
>>>> with red, green, blue and height all ranging from 0.0 to 1.0.
>>> I don't quite understand your math. If red, green and blue all range from
>>> 0 to 1, then the maximum possible height is 3. The maximum height of
>>> heightfields is 1.
>> Those maths assume red, green and blue go from 0 to 255, and height would be
>> from 0 to 16777216.
>
> OK, but 255 + 255/256 + 255/65536 still don't add up to 16777216!
>
No -- the values go from 0 to 255, so the sum can go from 0 to (256 - 1 / 256^2)
Dan
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) |
Dan Connelly <djc### [at] yahoo com> wrote:
> No -- the values go from 0 to 255, so the sum can go from 0 to (256 - 1 / 256^2)
>
> Dan
Ah, I see now! Thanks.
-Mike
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) |
Nicolas Alvarez wrote:
> I put the image directly into a heightfield, and I think I got the correct
> height, but only at 16 bits. I can't see any way (without hacking the
> code) to get 24 bits of precision in a heightfield.
>
> The only way to put data in a heightfield without passing a filename is
> using bitmap functions (function 200,200 { ... }), and those also support
> only 16-bit.
But using some creative coding, I can get an isosurface out of a
heightfield. I lose almost all interpolation though; it looks like a
heightfield without the "smooth" parameter.
Isosurface function:
function(x,y,z) {
y -
Map(x,y,z).red +
Map(x,y,z).green / 256.0 +
Map(x,y,z).blue / 65536.0
}
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) |
Nicolas Alvarez wrote:
> But using some creative coding, I can get an isosurface out of a
> heightfield. I lose almost all interpolation though; it looks like a
> heightfield without the "smooth" parameter.
http://imagebin.ca/view/5lUU-ge.html
Source attached.
"interpolate 2" in the image_map is absolutely necessary. Without
interpolation, it like a bunch of square blocks, one for each pixel; the
function gradient and the render times go through the roof, and it looks
ugly. With it, the isosurface looks like a non-smoothed heightfield.
Post a reply to this message
Attachments:
Download 'us-ascii' (1 KB)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nicolas Alvarez <nic### [at] gmail com> wrote:
> I put the image directly into a heightfield, and I think I got the correct
> height, but only at 16 bits. I can't see any way (without hacking the code)
> to get 24 bits of precision in a heightfield.
How did you check whether it was only using 16 bits?
-Mike
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) |
"SharkD" <nomail@nomail> wrote:
> Nicolas Alvarez <nic### [at] gmail com> wrote:
> > SharkD wrote:
> > > I generated the following heightfield in some program or other. It uses
> > > all 24 bits for elevation information. My question is, how are the
> > > colors/height data organized? I would like to create a pigment that
> > > produces similar maps.
> >
> > Seems similar to the POV-Ray TGA heightfields, except using all three
> > channels instead of two.
> >
> > Basically, red*256*256 + green*256 + blue = 24-bit grayscale value.
>
> How would I create this type of pigment? Thanks.
>
> -Mike
OK, here's the pigment:
#local hf_pigment_function_pow = function {y * pow(256,3)}
#local hf_pigment_function_b = function {mod(hf_pigment_function_pow(x,y,z),
pow(256,1))}
#local hf_pigment_function_g = function {mod(hf_pigment_function_pow(x,y,z) -
hf_pigment_function_b(x,y,z), pow(256,2))}
#local hf_pigment_function_r = function {mod(hf_pigment_function_pow(x,y,z) -
hf_pigment_function_b(x,y,z) - hf_pigment_function_g(x,y,z), pow(256,3))}
#local hf_pigment_b = pigment
{
function {hf_pigment_function_b(x,y,z) / pow(256,1)}
color_map {[0 rgb 0][1 rgb z]}
}
#local hf_pigment_g = pigment
{
function {hf_pigment_function_g(x,y,z) / pow(256,2)}
color_map {[0 rgb 0][1 rgb y]}
}
#local hf_pigment_r = pigment
{
function {hf_pigment_function_r(x,y,z) / pow(256,3)}
color_map {[0 rgb 0][1 rgb x]}
}
// This is the one you want
#local hf_pigment_rgb = pigment
{
average
pigment_map {[3 hf_pigment_b][3 hf_pigment_g][3 hf_pigment_r]}
}
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) |
"Reactor" <rea### [at] hotmail com> wrote:
> I am intrigued by this idea. I have been using hf_gray_16 in the past, and it
> usually creates enough levels, but an hf_gray_24 might be pretty cool too.
Well, an hf_gray_24 function would require a new image format: one in which each
channel stores 24 bits of color information, for a total of 72 bits for the
entire image. AFAIK, povray only supports a maximum of 16 bits-per-color in a
handful of formats (PNG is one of them).
The pigment I created will generate 24 bits of heightfield data in 8
bits-per-color images (the most common format), and 48 bits of heightfield data
in 16 bits-per-color images.
-Mike
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) |
SharkD wrote:
> Nicolas Alvarez <nic### [at] gmail com> wrote:
>> I put the image directly into a heightfield, and I think I got the
>> correct height, but only at 16 bits. I can't see any way (without hacking
>> the code) to get 24 bits of precision in a heightfield.
>
> How did you check whether it was only using 16 bits?
The documentation says so.
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) |