POV-Ray : Newsgroups : povray.advanced-users : format of hf_gray_16 .bmp files? Server Time
28 Jul 2024 14:24:14 EDT (-0400)
  format of hf_gray_16 .bmp files? (Message 1 to 10 of 27)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Ralph Smith
Subject: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 01:23:44
Message: <amepc191ufv40289ocd45u5qragqrhrm1j@4ax.com>
I generated a test gray-level image with hf_gray_16. This created a "image.bmp" file.
The
documentation says that this is a "special 16 bit grayscale". I looked into this file
and it seems
to be really an 8-bit file with all of the r-g-b values equal for each pixel. Is that
indeed the
format of these files? I want to write some c++ code to generate these height field
files that
povray can use.

thanks,
Ralph


Post a reply to this message

From: Mike Williams
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 03:57:29
Message: <$KHMtEAs$NzCFwdu@econym.demon.co.uk>
Wasn't it Ralph Smith who wrote:
>
>I generated a test gray-level image with hf_gray_16. This created a "image.bmp" 
>file. The
>documentation says that this is a "special 16 bit grayscale". I looked into this 
>file and it seems
>to be really an 8-bit file with all of the r-g-b values equal for each pixel. Is 
>that indeed the
>format of these files? I want to write some c++ code to generate these height 
>field files that
>povray can use.

It's not particularly easy to find the bit in the documentation that
says that only the TGA file format supports the storage of hf_gray_16
data. 

If you switch on hf_gray_16 and use a file format that can't store it,
then you just get a grey image.

If you look at a hf_gray_16 TGA file with an image editor, you'll see
that all the colours are wrong. The R and G channels are being used to
store high and low bytes of the 16-bit data, but the image editor
doesn't know that. If you look at any image in any other format that's
created with hf_gray_16, you'll see that that doesn't happen.

There are no hf_gray_16 BMP files.

The documentation suggests that you can use an externally generated PPM
file to store suitable 16-bit data, but PPM files created by POVRay with
hf_gray_16 switched on are not in this format (and they're not simple
grey images either). Creating such a PPM image is going to be a little
tricky, because you've also got to somehow set the undocumented marker
that tells POV to treat the RGB data as 16-bit grey (there's nothing in
the height_field syntax that specifies the hf data format, so POV has to
obtain that information from the file).

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Christoph Hormann
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 04:20:02
Message: <daiobu$52f$1@chho.imagico.de>
Mike Williams wrote:
> 
> It's not particularly easy to find the bit in the documentation that
> says that only the TGA file format supports the storage of hf_gray_16
> data. 

That's not quite correct - hf_gray_16 is supported for PPM (leading to 
PGM) and PNG output as well (and it makes most sense for those formats).

> The documentation suggests that you can use an externally generated PPM
> file to store suitable 16-bit data, but PPM files created by POVRay with
> hf_gray_16 switched on are not in this format (and they're not simple
> grey images either).

Why do you think so?  Last time i checked POV-Ray generated correct 
binary 16bit PGM with hf_gray_16 and +fp.

> Creating such a PPM image is going to be a little
> tricky, because you've also got to somehow set the undocumented marker
> [...]

POV-Ray reads 16 or 8 bit PGM images without problems.  Nothing 
undocumented there AFAIK.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.tu-bs.de/~y0013390/ (Last updated 01 Jul. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Mike Williams
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 09:09:13
Message: <m1Z6CLAWlSzCFwt6@econym.demon.co.uk>
Wasn't it Christoph Hormann who wrote:
>Mike Williams wrote:
>
>> The documentation suggests that you can use an externally generated PPM
>> file to store suitable 16-bit data, but PPM files created by POVRay with
>> hf_gray_16 switched on are not in this format (and they're not simple
>> grey images either).
>
>Why do you think so?  Last time i checked POV-Ray generated correct 
>binary 16bit PGM with hf_gray_16 and +fp.

When I use POVRay to generate a hf_gray_16 TGA file, it works as a
height_field.

When I do exactly the same thing with a PPM file generated with
hf_gray_16 and +fp. I get an error "Parse Error: File is not in PPM
format (type 53)" when I try to use it as a height_field. (POVRay 3.6
Windows 98se).

Some image editors think that the hf_gray_16 PPM file has 8 bits per
pixel (and don't display it correctly). Other image editors think that
it's an 8-bit greyscale PGM file with an incorrect extension (and do
display it correctly).

The documentation only mentions generating TGA hf_gray_16 files from
within POV. The only bit that mentions using 16-bit PPM files says that
they can be "generated with special custom-made programs".


However, the significant point for the original poster is that you can't
do it with BMP files.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Ralph Smith
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 10:12:09
Message: <19dqc1pcd64c36dn0odpm39vvog0ok5ods@4ax.com>
On Thu, 7 Jul 2005 14:08:38 +0100, Mike Williams <nos### [at] econymdemoncouk> wrote:

>
>However, the significant point for the original poster is that you can't
>do it with BMP files.

I don't understand."image.pov created image.bmp. Image.pov contains

global_settings {
	assumed_gamma 2.2
	hf_gray_16
}

There is no image.tga.

Then I run test.pov to use this bmp file as a height field:

.....

height_field  {
   //tga "image.tga"		// created from "image.pov"
   sys "image.bmp"
   smooth
   pigment { 
   	gradient y
   	color_map {
      	[0.00 color rgb <  0,   0, 0.4>]
      	[0.05 color rgb <  0, 0.2,   0>]
      	[0.60 color rgb <1.0, 1.0, 1.0>]
      	[1.00 color rgb <1.0, 1.0, 1.0>]
		}
	}
   finish {
		specular 0.5
		roughness 0.05
	}
	normal {
		bozo
		translate <0, 1.23456, 0>
		scale 0.002
	}

   translate <-.5, 0, -.5>
   scale <17, 1.75, 17>
	rotate<-90, -45, 0>
}

.....


It works. So, I think that you CAN use .bmp files as height fields. But I also think
that they only
have 256 gray levels since for all pixels r = g = b as far as I can tell.

If I switch to .tga files would I get 65,536 gray levels?

But I would still like to be able to create hf_gray_16 files externally. It sounds
like the format
of such .tga files might not be documented.

Ralph


Post a reply to this message

From: Christoph Hormann
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 12:50:02
Message: <dajmek$bqc$1@chho.imagico.de>
Mike Williams wrote:
> 
> When I use POVRay to generate a hf_gray_16 TGA file, it works as a
> height_field.
> 
> When I do exactly the same thing with a PPM file generated with
> hf_gray_16 and +fp. I get an error "Parse Error: File is not in PPM
> format (type 53)" when I try to use it as a height_field. (POVRay 3.6
> Windows 98se).

As said with hf_gray_16 POV-Ray generates PGM files - you have to 
specify them as 'pgm' in the heightfield statement.

> Some image editors think that the hf_gray_16 PPM file has 8 bits per
> pixel (and don't display it correctly). Other image editors think that
> it's an 8-bit greyscale PGM file with an incorrect extension (and do
> display it correctly).

A lot of image editors don't read PPM/PGM files according to the specs.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.tu-bs.de/~y0013390/ (Last updated 01 Jul. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Christoph Hormann
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 13:00:02
Message: <dajn1h$btt$1@chho.imagico.de>
Ralph Smith wrote:
> 
> I don't understand."image.pov created image.bmp. Image.pov contains
> 
> global_settings {
> 	assumed_gamma 2.2
> 	hf_gray_16
> }
> 
> There is no image.tga.

You can find how to specify the file format to generate on

http://www.povray.org/documentation/view/3.6.1/219/

> But I would still like to be able to create hf_gray_16 files externally. It sounds
like the format
> of such .tga files might not be documented.

You can find the file format specifications for PGM on:

http://netpbm.sourceforge.net/doc/pgm.html

I would be really astonished if you could find a similarly complete 
specification for the BMP format.  As i have said a lot recently using 
BMP as an image file format is rarely a good idea (no matter if for 
renders or for heightfield data).

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.tu-bs.de/~y0013390/ (Last updated 01 Jul. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Darren New
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 13:12:51
Message: <42cd6293@news.povray.org>
Christoph Hormann wrote:
> I would be really astonished if you could find a similarly complete 
> specification for the BMP format. 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_4v1h.asp

Because, of course, we all know that Microsoft hates developers and 
wouldn't want to let anyone else create software that can export to 
their proprietary formats, naturally.  That's why when you search for 
"bitmap file" nothing comes up in MSDN. ;-)

-- 
   Darren New / San Diego, CA, USA (PST)
     The samba was clearly inspired
     by the margarita.


Post a reply to this message

From: Christoph Hormann
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 13:50:01
Message: <dajptc$chn$1@chho.imagico.de>
Darren New wrote:
> Christoph Hormann wrote:
> 
>> I would be really astonished if you could find a similarly complete 
>> specification for the BMP format. 
> 
> 
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_4v1h.asp 

;-)

I mean they write "established bitmap file format" - which says it all.

Never try to fool an ex-OS/2 user about there being a kind of standard 
in BMP files...

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.tu-bs.de/~y0013390/ (Last updated 01 Jul. 2005)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

From: Darren New
Subject: Re: format of hf_gray_16 .bmp files?
Date: 7 Jul 2005 14:53:46
Message: <42cd7a3a$1@news.povray.org>
Christoph Hormann wrote:
> Never try to fool an ex-OS/2 user about there being a kind of standard 
> in BMP files...

Oh, you mean OS/2 took a Windows format and modified it, but called it 
the same thing, and screwed things up? OK. ;-)

Seriously, they're *all* bitmap formats. I figured you meant the 
microsoft bitmap format. Typing "OS/2 bitmap storage" into google and 
hitting "I'm feeling lucky" gets you that bitmap format.

-- 
   Darren New / San Diego, CA, USA (PST)
     The samba was clearly inspired
     by the margarita.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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