POV-Ray : Newsgroups : povray.general : RGB color Index Server Time
31 Jul 2024 16:23:08 EDT (-0400)
  RGB color Index (Message 1 to 9 of 9)  
From: sitha
Subject: RGB color Index
Date: 18 Jan 2007 01:40:01
Message: <web.45af15adb1d5e0224ac3566b0@news.povray.org>
Hi Everybody,
I am using POV for visualize my finite element analysis results of
buildings. I use RGB color to represent the displacement of buildings. Now
I need to put a color index which corresponds to the dispalcement. But I
dont know how to make a color index in POV. Please somebody help me as soon
as possible early because next week I have a presentation.
Thanks a lot in advance.

Regards,
Sitha.


Post a reply to this message

From: Alain
Subject: Re: RGB color Index
Date: 18 Jan 2007 19:02:22
Message: <45b00a8e@news.povray.org>
sitha nous apporta ses lumieres en ce 18-01-2007 01:37:
> Hi Everybody,
> I am using POV for visualize my finite element analysis results of
> buildings. I use RGB color to represent the displacement of buildings. Now
> I need to put a color index which corresponds to the dispalcement. But I
> dont know how to make a color index in POV. Please somebody help me as soon
> as possible early because next week I have a presentation.
> Thanks a lot in advance.

> Regards,
> Sitha.


You can have a small, long box coloured by an apropriate gradient in a corner or 
along an edge of your image.
Use some text objects to mark the reference points and units.
Tick marks can be done using tiny box or cylinders.
Try using the screen.inc to get the tools to help you place it correctly.
There is a sample scene that show a possible use of that include.

-- 
Alain
-------------------------------------------------
Stay out of my head, its a bad neighborhood.


Post a reply to this message

From: Tim Attwood
Subject: Re: RGB color Index
Date: 18 Jan 2007 19:16:24
Message: <45b00dd8@news.povray.org>
> I am using POV for visualize my finite element analysis results of
> buildings. I use RGB color to represent the displacement of buildings. Now
> I need to put a color index which corresponds to the dispalcement. But I
> dont know how to make a color index in POV. Please somebody help me as 
> soon
> as possible early because next week I have a presentation.
> Thanks a lot in advance.

I'm not entirely clear as to what you mean.

You might want to look at image_map.
The colors come from an image file and can be mapped
onto a 3d object. (3.5.1.5  Image Maps)

If you have a list of  RGB colors you have computed,
then you might want to place them into an array.
(3.2.1.8.1  Declaring Arrays)

#declare disp = arrary[2];
#declare disp[0] = pigment{color <0,0,0>};
#declare disp[1] = pigment{color <1,1,1>};

then later you can use them like this

object { thing
   pigment{disp[0]}
}


Post a reply to this message

From: Grassblade
Subject: Re: RGB color Index
Date: 19 Jan 2007 11:50:00
Message: <web.45b0f5fc89205d6dd58739470@news.povray.org>
"sitha" <nsi### [at] excitecom> wrote:
> Hi Everybody,
> I am using POV for visualize my finite element analysis results of
> buildings. I use RGB color to represent the displacement of buildings. Now
> I need to put a color index which corresponds to the dispalcement. But I
> dont know how to make a color index in POV. Please somebody help me as soon
> as possible early because next week I have a presentation.
> Thanks a lot in advance.
>
> Regards,
> Sitha.
I know nothing about FEA other than what I just read on Wikipedia, but if I
understand your problem correctly, here is what I would do:
1) pick a reference colour, if you have displacement in all three axes pick
a neutral gray,, if you have displacement in only two axes set an arbitrary
colour, like rgb <1,0.5,0.5>
2) determine the maximum absolute displacement along all axes, and, no, I
don't know how to do that, but I'm sure somebody does.
3) Divide the displacement for each node along each axis by twice the max
displacement you found before. Now you've got a number between -0.5 and
0.5. Add this to the correct colour channel of the reference colour at
point 1. If you have only two directions modify the procedure accordingly.

With this method, nodes that are diplaced a lot in 2 negative directions are
undistinguishable from nodes displaced  a lot in 3 negative directions. I
can't think of a way around it, unfortunately.


Post a reply to this message

From: sitha
Subject: Re: RGB color Index
Date: 20 Jan 2007 02:05:00
Message: <web.45b1be1889205d6d4ac3566b0@news.povray.org>
> You can have a small, long box coloured by an apropriate gradient in a corner or
> along an edge of your image.
> Use some text objects to mark the reference points and units.
> Tick marks can be done using tiny box or cylinders.
> Try using the screen.inc to get the tools to help you place it correctly.
> There is a sample scene that show a possible use of that include.
>
> --
> Alain
> -------------------------------------------------
> Stay out of my head, its a bad neighborhood.

Hi Alan,
I dont get your idea clearly. Please if you have any sample file give me.
The problem is, I put more than 1000 RGB color data in POV file. Is there a
way to automatically generate a long box which shows color and its
corresponding value. Pls give your suggestion as soon as possilble.

Thanks a lot........

I hope other people misunderstood my question. I am sorry if I made you all
in wrong direction.


Post a reply to this message

From: Alain
Subject: Re: RGB color Index
Date: 20 Jan 2007 11:47:02
Message: <45b24786$1@news.povray.org>
sitha nous apporta ses lumieres en ce 20-01-2007 02:02:
>> You can have a small, long box coloured by an apropriate gradient in a corner or
>> along an edge of your image.
>> Use some text objects to mark the reference points and units.
>> Tick marks can be done using tiny box or cylinders.
>> Try using the screen.inc to get the tools to help you place it correctly.
>> There is a sample scene that show a possible use of that include.

>> --
>> Alain
>> -------------------------------------------------
>> Stay out of my head, its a bad neighborhood.

> Hi Alan,
> I dont get your idea clearly. Please if you have any sample file give me.
> The problem is, I put more than 1000 RGB color data in POV file. Is there a
> way to automatically generate a long box which shows color and its
> corresponding value. Pls give your suggestion as soon as possilble.
You don't need many, individualy deffined, discreet colors. A gradient use some 
set colors and interpolate smoothly from one to the next.

> Thanks a lot........

> I hope other people misunderstood my question. I am sorry if I made you all
> in wrong direction.



For the "scale" box:
union{
box{1,-1 scale<20,0.2,1>pigment{gradient x 
pigment{color_map{Some_color_map}translate -0.5*x scale 40*x}}
object{ Some_text_objects }
object{ Some_tick_marks }
}
This box should be placed in any unobstructive area you want by translating and 
possibly rotating it.
Make the color_map match the color range you use, it realy don't need to be an 
exact match. Say, pure dark blue stand for the maximum negative displacement, 
bright red is for maximum positive displacement, and white is for no 
displacement. You could then use a color_map similar to this:
color_map{[0 rgb<0,0,0.3>]// a dark blue for strong negative
	[0.2 rgb<0.2,0.2,1>]// a lighter blue for medium negative
	[0.5 rgb 1]	// white for no displacement
	[0.8 rgb<0.8,0.2,0.1>]// a red for medium positive
	[1 rgb<1,0.5,0.3>]}// bright red for strong positive
This is a sample color_map. It can contain up to 256 entries.
This sample works best for one dimentional displacement, like the elevation.
It's possible, but somewhat more complex to represent 2 dimentional 
displacement. The "scale" box will need to be square and have a gradient along 
both axis.

-- 
Alain
-------------------------------------------------
SHOPPING MATH
A man will pay $20 for a $10 item he needs.
A woman will pay $10 for a $20 item that she doesn't need.


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: RGB color Index
Date: 20 Jan 2007 14:51:40
Message: <45b272cc$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

sitha wrote:
>> You can have a small, long box coloured by an apropriate gradient in a corner or
>> along an edge of your image.
>> Use some text objects to mark the reference points and units.
>> Tick marks can be done using tiny box or cylinders.
>> Try using the screen.inc to get the tools to help you place it correctly.
>> There is a sample scene that show a possible use of that include.
>>
>> --
>> Alain
>> -------------------------------------------------
>> Stay out of my head, its a bad neighborhood.
> 
> Hi Alan,
> I dont get your idea clearly. Please if you have any sample file give me.
> The problem is, I put more than 1000 RGB color data in POV file. Is there a
> way to automatically generate a long box which shows color and its
> corresponding value. Pls give your suggestion as soon as possilble.
> 
> Thanks a lot........
> 
> I hope other people misunderstood my question. I am sorry if I made you all
> in wrong direction.
> 
	If I understand you correctly, you have some software external to
povray. This software generates a data set and assigns *itself*
different colors to different points in the dataset. What you want
to do is to create a scale with the same colors.

	If that is the case, I see two solutions:
 - If you can, have your software input a value between 0 and 1
instead of outputting colors. It should then be possible to use a
color_map to colorize your output. To create a scale, you would then
create a box with a gradient texture using the same color_map;

 - Or (but this is *much* more difficult to get right), you can
create several boxes (you will need eight if you have 1000
individual colors to put on your scale). Then assign them a gradient
texture with this kind of color_map (adjust the values as needed):
color_map {
    [ 1 / 128 Color1 ]
    [ 1 / 128 Color2 ]
    [ 2 / 128 Color2 ]
    [ 2 / 128 Color3 ]
    [ 3 / 128 Color3 ]
...
}
(Note that each color and each value except the first and last color
are given twice, and that they are never increased together).
However, you should *really* look into the other solution first.

		Jerome

PS: Doc on the color_map keyword:
http://www.povray.org/documentation/view/3.6.1/335/
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFsnLKd0kWM4JG3k8RAppoAKCiibefYz2x02ylbCvb786wDZtwZACgn8oq
JDPBA4v74ZAI0DYiFekpTJU=
=8K+4
-----END PGP SIGNATURE-----


Post a reply to this message

From: Alain
Subject: Re: RGB color Index
Date: 20 Jan 2007 21:17:26
Message: <45b2cd36$1@news.povray.org>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> sitha wrote:
>>> You can have a small, long box coloured by an apropriate gradient in a corner or
>>> along an edge of your image.
>>> Use some text objects to mark the reference points and units.
>>> Tick marks can be done using tiny box or cylinders.
>>> Try using the screen.inc to get the tools to help you place it correctly.
>>> There is a sample scene that show a possible use of that include.
>>>
>>> --
>>> Alain
>>> -------------------------------------------------
>>> Stay out of my head, its a bad neighborhood.
>> Hi Alan,
>> I dont get your idea clearly. Please if you have any sample file give me.
>> The problem is, I put more than 1000 RGB color data in POV file. Is there a
>> way to automatically generate a long box which shows color and its
>> corresponding value. Pls give your suggestion as soon as possilble.
>>
>> Thanks a lot........
>>
>> I hope other people misunderstood my question. I am sorry if I made you all
>> in wrong direction.
>>
> 	If I understand you correctly, you have some software external to
> povray. This software generates a data set and assigns *itself*
> different colors to different points in the dataset. What you want
> to do is to create a scale with the same colors.
> 
> 	If that is the case, I see two solutions:
>  - If you can, have your software input a value between 0 and 1
> instead of outputting colors. It should then be possible to use a
> color_map to colorize your output. To create a scale, you would then
> create a box with a gradient texture using the same color_map;
> 
>  - Or (but this is *much* more difficult to get right), you can
> create several boxes (you will need eight if you have 1000
> individual colors to put on your scale). Then assign them a gradient
> texture with this kind of color_map (adjust the values as needed):
> color_map {
>     [ 1 / 128 Color1 ]
>     [ 1 / 128 Color2 ]
>     [ 2 / 128 Color2 ]
>     [ 2 / 128 Color3 ]
>     [ 3 / 128 Color3 ]
> ...
> }
> (Note that each color and each value except the first and last color
> are given twice, and that they are never increased together).
> However, you should *really* look into the other solution first.
> 
> 		Jerome
> 
> PS: Doc on the color_map keyword:
> http://www.povray.org/documentation/view/3.6.1/335/
>
This just can't work in this case. You are limited to 256 entries, total, in 
your color_map, texture_map, normal_map or material_map.
What you need is only a few, evenly spaced, samples of the colors used, place 
them in a color_map WITHOUT any repeat values, then use that in a gradient 
pattern scaled to the lenght of the bar.

-- 
Alain
-------------------------------------------------
The strongest reason for the people to retain the right to keep and bear
arms is, as a last resort, to protect themselves against tyranny in
government.
Thomas Jefferson


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: RGB color Index
Date: 21 Jan 2007 04:12:11
Message: <45b32e6b@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alain wrote:

>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> sitha wrote:
>>>> You can have a small, long box coloured by an apropriate gradient in
>>>> a corner or
>>>> along an edge of your image.
>>>> Use some text objects to mark the reference points and units.
>>>> Tick marks can be done using tiny box or cylinders.
>>>> Try using the screen.inc to get the tools to help you place it
>>>> correctly.
>>>> There is a sample scene that show a possible use of that include.
>>>>
>>>> -- 
>>>> Alain
>>>> -------------------------------------------------
>>>> Stay out of my head, its a bad neighborhood.
>>> Hi Alan,
>>> I dont get your idea clearly. Please if you have any sample file give
>>> me.
>>> The problem is, I put more than 1000 RGB color data in POV file. Is
>>> there a
>>> way to automatically generate a long box which shows color and its
>>> corresponding value. Pls give your suggestion as soon as possilble.
>>>
>>> Thanks a lot........
>>>
>>> I hope other people misunderstood my question. I am sorry if I made
>>> you all
>>> in wrong direction.
>>>
>>     If I understand you correctly, you have some software external to
>> povray. This software generates a data set and assigns *itself*
>> different colors to different points in the dataset. What you want
>> to do is to create a scale with the same colors.
>>
>>     If that is the case, I see two solutions:
>>  - If you can, have your software input a value between 0 and 1
>> instead of outputting colors. It should then be possible to use a
>> color_map to colorize your output. To create a scale, you would then
>> create a box with a gradient texture using the same color_map;
>>
>>  - Or (but this is *much* more difficult to get right), you can
>> create several boxes (you will need eight if you have 1000
>> individual colors to put on your scale). Then assign them a gradient
>> texture with this kind of color_map (adjust the values as needed):
>> color_map {
>>     [ 1 / 128 Color1 ]
>>     [ 1 / 128 Color2 ]
>>     [ 2 / 128 Color2 ]
>>     [ 2 / 128 Color3 ]
>>     [ 3 / 128 Color3 ]
>> ...
>> }
>> (Note that each color and each value except the first and last color
>> are given twice, and that they are never increased together).
>> However, you should *really* look into the other solution first.
>>
>>         Jerome
>>
>> PS: Doc on the color_map keyword:
>> http://www.povray.org/documentation/view/3.6.1/335/
>>
> This just can't work in this case. You are limited to 256 entries,
> total, in your color_map, texture_map, normal_map or material_map.

	That's why I said he needed *eight* boxes.

> What you need is only a few, evenly spaced, samples of the colors used,
> place them in a color_map WITHOUT any repeat values, then use that in a
> gradient pattern scaled to the lenght of the bar.
> 
	This won't work if he can't control the colors taken by the data
and if he needs an accurate scale bar. However, you'll notice that
it is the first solution I suggested and the one I recommended he
look into first.

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeb### [at] freefr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeb### [at] jabberfr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFsy5qd0kWM4JG3k8RAjoWAKCo2WzTnrSt0B2jjdmTv/w4bD6HVwCgkp7A
jg1Z3hO9LDxRgPjE8Qko3FA=
=+6Ku
-----END PGP SIGNATURE-----


Post a reply to this message

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