POV-Ray : Newsgroups : povray.general : df3 and color-maps Server Time
4 Nov 2024 21:23:19 EST (-0500)
  df3 and color-maps (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: minzi0815
Subject: df3 and color-maps
Date: 27 May 2008 09:20:00
Message: <web.483c0a3c1dd277bbc32955910@news.povray.org>
Hi,

I have a df3-file that holds 2-byte values and have problms setting up the
color_map - not very successfull yet.

I have tried outthings like :

color_map{
        [0 rgb 0]
    [1 rgb <1,1,1>]
 }

....or...

color_map{
 [0.2 rgb <0,0,0>]
 [0.3 rgb <1,0,0>]
 [0.4 rgb <0,1,0>]
 [0.5 rgb <0,0,1>]
 [0.8 rgb <1,1,1>]
 }

....but not very successfull yet. What I want to achieve us to have a different
color for every different value in the df3-file.

Any idea ? Thanks in advance...


Post a reply to this message

From: Alain
Subject: Re: df3 and color-maps
Date: 27 May 2008 10:15:15
Message: <483c1773$1@news.povray.org>
minzi0815 nous illumina en ce 2008-05-27 09:18 -->
> Hi,
> 
> I have a df3-file that holds 2-byte values and have problms setting up the
> color_map - not very successfull yet.
> 
> I have tried outthings like :
> 
> color_map{
>         [0 rgb 0]
>     [1 rgb <1,1,1>]
>  }
> 
> ....or...
> 
> color_map{
>  [0.2 rgb <0,0,0>]
>  [0.3 rgb <1,0,0>]
>  [0.4 rgb <0,1,0>]
>  [0.5 rgb <0,0,1>]
>  [0.8 rgb <1,1,1>]
>  }
> 
> ....but not very successfull yet. What I want to achieve us to have a different
> color for every different value in the df3-file.
> 
> Any idea ? Thanks in advance...
> 
> 
> 
> 
A color_map can have at most 256 entries. It's interpolated between the given 
values, I think that it's a linear interpolation.

The first map give a linear ramp going from black (no media) to white. The 
result should be the same as if you don't provide any map.

The second map turn off any voxel with a value of 0.2 or less, then raise to 
pure red at 0.3, shift to green at 0.4 with yellow at 0.35, then turn blue at 
0.5, then turn to pure white at 0.8 and stay there for any value larger than 
0.8. That white can hide the contribution of other voxels on the same ray.

-- 
Alain
-------------------------------------------------
Cat, n.: Lapwarmer with built-in buzzer.


Post a reply to this message

From: minzi0815
Subject: Re: df3 and color-maps
Date: 27 May 2008 11:00:03
Message: <web.483c2150faa86b18c32955910@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> minzi0815 nous illumina en ce 2008-05-27 09:18 -->
> > Hi,
> >
> > I have a df3-file that holds 2-byte values and have problms setting up the
> > color_map - not very successfull yet.
> >
> > I have tried outthings like :
> >
> > color_map{
> >         [0 rgb 0]
> >     [1 rgb <1,1,1>]
> >  }
> >
> > ....or...
> >
> > color_map{
> >  [0.2 rgb <0,0,0>]
> >  [0.3 rgb <1,0,0>]
> >  [0.4 rgb <0,1,0>]
> >  [0.5 rgb <0,0,1>]
> >  [0.8 rgb <1,1,1>]
> >  }
> >
> > ....but not very successfull yet. What I want to achieve us to have a different
> > color for every different value in the df3-file.
> >
> > Any idea ? Thanks in advance...
> >
> >
> >
> >
> A color_map can have at most 256 entries. It's interpolated between the given
> values, I think that it's a linear interpolation.
>
> The first map give a linear ramp going from black (no media) to white. The
> result should be the same as if you don't provide any map.
>
> The second map turn off any voxel with a value of 0.2 or less, then raise to
> pure red at 0.3, shift to green at 0.4 with yellow at 0.35, then turn blue at
> 0.5, then turn to pure white at 0.8 and stay there for any value larger than
> 0.8. That white can hide the contribution of other voxels on the same ray.
>
> --
> Alain
> -------------------------------------------------
> Cat, n.: Lapwarmer with built-in buzzer.

So than means, the 65535 possible values are scaled to 256 colors ?
Means black for 0-255 ...


Post a reply to this message

From: Warp
Subject: Re: df3 and color-maps
Date: 27 May 2008 11:25:46
Message: <483c27fa@news.povray.org>
minzi0815 <mar### [at] eumetsatint> wrote:
> So than means, the 65535 possible values are scaled to 256 colors ?

  No, it means that you can only specify up to 256 entries in a color map.
Colors are interpolated between these entries and thus the total amount of
colors generated is limitless (well, limited by floating point range).

-- 
                                                          - Warp


Post a reply to this message

From: minzi0815
Subject: Re: df3 and color-maps
Date: 28 May 2008 02:15:01
Message: <web.483cf7c2faa86b18c32955910@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> minzi0815 <mar### [at] eumetsatint> wrote:
> > So than means, the 65535 possible values are scaled to 256 colors ?
>
>   No, it means that you can only specify up to 256 entries in a color map.
> Colors are interpolated between these entries and thus the total amount of
> colors generated is limitless (well, limited by floating point range).
>
> --
>                                                           - Warp

Well, to be honest, I am getting a little cobfused.
The question for me is the following:

I want to display a df3 - file that holds 16 Bit measuring values that range
from 0 to 65535. I want povray to display each value in a different color. How
is that possible to do ? Do I need a color map at all ?


Post a reply to this message

From: Warp
Subject: Re: df3 and color-maps
Date: 28 May 2008 04:18:24
Message: <483d1550@news.povray.org>
minzi0815 <mar### [at] eumetsatint> wrote:
> I want to display a df3 - file that holds 16 Bit measuring values that range
> from 0 to 65535. I want povray to display each value in a different color. How
> is that possible to do ? Do I need a color map at all ?

color_map
{ [0/255 color1]
  [1/255 color2]
  [2/255 color3]
  [3/255 color4]
  ...
  [255/255 color256]
}

  If all the 256 colors defined on the right-hand side are distinct and
properly selected, the entire image map can be used to get 65536 different
colors. (It might be difficult to avoid having some interpolated colors
being the same, though. That's why the colors have to be properly selected.)

-- 
                                                          - Warp


Post a reply to this message

From: Chris B
Subject: Re: df3 and color-maps
Date: 28 May 2008 04:49:11
Message: <483d1c87@news.povray.org>
"minzi0815" <mar### [at] eumetsatint> wrote in message 
news:web.483cf7c2faa86b18c32955910@news.povray.org...
> Warp <war### [at] tagpovrayorg> wrote:
>> minzi0815 <mar### [at] eumetsatint> wrote:
>> > So than means, the 65535 possible values are scaled to 256 colors ?
>>
>>   No, it means that you can only specify up to 256 entries in a color 
>> map.
>> Colors are interpolated between these entries and thus the total amount 
>> of
>> colors generated is limitless (well, limited by floating point range).
>>
>> --
>>                                                           - Warp
>
> Well, to be honest, I am getting a little cobfused.
> The question for me is the following:
>
> I want to display a df3 - file that holds 16 Bit measuring values that 
> range
> from 0 to 65535. I want povray to display each value in a different color. 
> How
> is that possible to do ? Do I need a color map at all ?
>

Hi Marcus,

Because of the 256 entry limit on the colour map it's not going to be 
possible to individually specify 65535 separate colour values, but by using 
all 256 entries in the way that I see Warp has indicated you should be able 
to get pretty close to using all the available colours.

If you don't specify a colour map, by default POV-Ray will try to pick a 
different colour/shade between <0,0,0> and <1,1,1> for each value in the df3 
file in a completely linear fashion. This would therefore theoretically 
progress from black to white assigning a different shade of grey to a 
location based on the value from the file as it increases from 0 to 65535.

I say it will 'try' and 'theoretically' assign a different colour because, 
to support that number of grey shades you'd need to support an extremely 
high number of colours, which your hardware probably can't differentiate 
between and which may well run you into the floating point limit of your 
computer. If this happens you may end up with adjacent values from the file 
being assigned the same colour value and even if they have different colour 
values they may look the same when displayed on a screen or on a print.

As you know, by specifying your own colour map you can change the way that 
the algorithm will progress through the colour spectrum as the value from 
the file rises from 0 to 65535, but it still progresses from one specified 
colour value to the next in a completely linear fashion, so your colour map:

color_map{
 [0.2 rgb <0,0,0>]
 [0.3 rgb <1,0,0>]
 [0.4 rgb <0,1,0>]
 [0.5 rgb <0,0,1>]
 [0.8 rgb <1,1,1>]
 }

would progress as Alain described, but it still doesn't hit the full range 
of possible colours. For example you don't get anything on the line of 
colours between pure red and pure blue and when it goes from blue to white 
it only picks colours where the red and green values are equal. By only 
using a small subset of the colours that your screen or printer supports 
you're therefore not getting very close to the optimum number of distinct 
values that you'll be able to see.

You could construct a more complicated colour map that also passes from red 
to blue, from green to yellow, from white to red etc and therefore uses more 
of the available colours. I don't know whether anyone's devised a colour map 
that can pass through a maximum number of available colours. That might be a 
challenge.

Regards,
Chris B.


Post a reply to this message

From: Tim Attwood
Subject: Re: df3 and color-maps
Date: 28 May 2008 05:02:46
Message: <483d1fb6$1@news.povray.org>
> Well, to be honest, I am getting a little cobfused.
> The question for me is the following:
>
> I want to display a df3 - file that holds 16 Bit measuring values that 
> range
> from 0 to 65535. I want povray to display each value in a different color. 
> How
> is that possible to do ? Do I need a color map at all ?

There are several issues with what you are asking...

1) DF3 data describes a value for a 3D voxel,
many voxels will be obsured by the voxels in front
of them, to really see the values you need to
slice the cloud of voxels.

2) The human eye can barely distinguish between nearby
16 bit colors, but if you wish to create a large color map
the colors are linearly interpreted between entries in the
color map. So if you have a color map...
color_map {
   [0 Black]
   [1/255 Red]
   [2/255 Yellow]
   ...etc
}
then a value of $007F (127) will be a color rgb <0.498,0,0>,
a value of $017F (295) will be a color rgb <1,0.498,0>.

3. POV is capable of producing 16 bit images instead of
24 bit. Set the Output_File_Type=T in povray.ini to produce
targa format images, then add hf_gray_16 to your
global_settings. Then set up your pigment slice with
ambient 1 and no other lighting (no color map). The TGA
image will have the MSB in the red channel and the LSB
in the green channel. The preview shows just the red
channel. When loaded into a paint program, this is a striped
red-yellow-green image not very suited to human viewing,
but the color values are unique per DF3 value. POV can
load such TGA images as a height_field to show values
as a height.

// File: df3_slice.pov
// Vers: 3.6
// Desc: Orthographic DF3 slice
// use Output_File_Type=T in povray.ini
// use a square image ratio

#version 3.6;

#declare SliceAt = -0.5; // from 0 to -1

global_settings {
  assumed_gamma 1.0
  hf_gray_16
}

camera {
  orthographic
  location <0,0,1>
  look_at  <0,0,0>
  right 1*x
  up 1*y
}

box { // this box fits exactly in view
  <-0.5, -0.5, 0>, <0.5, 0.5, 0.001>
  texture {
    pigment {
      density_file df3 "spiral.df3"
      translate <-0.5,-0.5,SliceAt>
    }
    finish {
      ambient 1.0
      diffuse 0.0
    }
  }
}


Post a reply to this message

From: minzi0815
Subject: Re: df3 and color-maps
Date: 28 May 2008 05:55:01
Message: <web.483d2be6faa86b18c32955910@news.povray.org>
"Tim Attwood" <tim### [at] comcastnet> wrote:
> > Well, to be honest, I am getting a little cobfused.
> > The question for me is the following:
> >
> > I want to display a df3 - file that holds 16 Bit measuring values that
> > range
> > from 0 to 65535. I want povray to display each value in a different color.
> > How
> > is that possible to do ? Do I need a color map at all ?
>
> There are several issues with what you are asking...
>
> 1) DF3 data describes a value for a 3D voxel,
> many voxels will be obsured by the voxels in front
> of them, to really see the values you need to
> slice the cloud of voxels.
>
> 2) The human eye can barely distinguish between nearby
> 16 bit colors, but if you wish to create a large color map
> the colors are linearly interpreted between entries in the
> color map. So if you have a color map...
> color_map {
>    [0 Black]
>    [1/255 Red]
>    [2/255 Yellow]
>    ...etc
> }
> then a value of $007F (127) will be a color rgb <0.498,0,0>,
> a value of $017F (295) will be a color rgb <1,0.498,0>.
>
> 3. POV is capable of producing 16 bit images instead of
> 24 bit. Set the Output_File_Type=T in povray.ini to produce
> targa format images, then add hf_gray_16 to your
> global_settings. Then set up your pigment slice with
> ambient 1 and no other lighting (no color map). The TGA
> image will have the MSB in the red channel and the LSB
> in the green channel. The preview shows just the red
> channel. When loaded into a paint program, this is a striped
> red-yellow-green image not very suited to human viewing,
> but the color values are unique per DF3 value. POV can
> load such TGA images as a height_field to show values
> as a height.
>
> // File: df3_slice.pov
> // Vers: 3.6
> // Desc: Orthographic DF3 slice
> // use Output_File_Type=T in povray.ini
> // use a square image ratio
>
> #version 3.6;
>
> #declare SliceAt = -0.5; // from 0 to -1
>
> global_settings {
>   assumed_gamma 1.0
>   hf_gray_16
> }
>
> camera {
>   orthographic
>   location <0,0,1>
>   look_at  <0,0,0>
>   right 1*x
>   up 1*y
> }
>
> box { // this box fits exactly in view
>   <-0.5, -0.5, 0>, <0.5, 0.5, 0.001>
>   texture {
>     pigment {
>       density_file df3 "spiral.df3"
>       translate <-0.5,-0.5,SliceAt>
>     }
>     finish {
>       ambient 1.0
>       diffuse 0.0
>     }
>   }
> }

Hm, I don't know what's wring in my configuration: All I get is white. Is there
a way I can contact you directley ?


Post a reply to this message

From: Tim Attwood
Subject: Re: df3 and color-maps
Date: 28 May 2008 07:31:42
Message: <483d429e$1@news.povray.org>
> Hm, I don't know what's wring in my configuration: All I get is white. Is 
> there
> a way I can contact you directley ?

If it's all white the values are probably all large?
You can count the colors in a paint program.
It's important to set the output type to T if you don't
do that the output is 8 bit greyscale despite
asking for hf_gray_16. You can use +ft in the command
line box.

Also this is for 3.6, not for 3.7 beta 26, this feature is under
significant change in beta and is non-functional there ATM.
The intention is to depreciate hf_gray_16 in favor of
+fng or 'Grayscale_Output=true'. (according to Chris Cason)

You can mail me: timothyea *don't spam me* comcast dot net


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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