POV-Ray : Newsgroups : povray.advanced-users : How to make my own 3D pigment? Server Time
23 Dec 2024 07:41:44 EST (-0500)
  How to make my own 3D pigment? (Message 1 to 8 of 8)  
From: Lars R 
Subject: How to make my own 3D pigment?
Date: 22 Jun 2011 10:13:46
Message: <4e01f89a$1@news.povray.org>
I want to render objects having a self-made 3D pigment that is defined
via 3 user-defined functions (one for red, one for green and one for
blue), or via one function that returns an RGB color vector directly

(Or even an 4- or 5-dimensional rgbf, rgbt or rgbft vector)

Is that possible, somehow?


As far as I understand a user-defined pigment functions just returns a
single float that is used as an index in a color_map.


			Lars R.


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: How to make my own 3D pigment?
Date: 22 Jun 2011 10:40:44
Message: <4e01feec$1@news.povray.org>

> I want to render objects having a self-made 3D pigment that is
> defined via 3 user-defined functions (one for red, one for green and
> one for blue), or via one function that returns an RGB color vector
> directly
>
> (Or even an 4- or 5-dimensional rgbf, rgbt or rgbft vector)
>
> Is that possible, somehow?
>
>
> As far as I understand a user-defined pigment functions just returns
> a single float that is used as an index in a color_map.
>

  If I understood it correctly, I think the "average" pattern should help
there: create 3 separate pigments for each function, then use a
pigment_map to average them together.

-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

From: Alain
Subject: Re: How to make my own 3D pigment?
Date: 22 Jun 2011 10:45:40
Message: <4e020014@news.povray.org>


>> I want to render objects having a self-made 3D pigment that is
>> defined via 3 user-defined functions (one for red, one for green and
>> one for blue), or via one function that returns an RGB color vector
>> directly
>>
>> (Or even an 4- or 5-dimensional rgbf, rgbt or rgbft vector)
>>
>> Is that possible, somehow?
>>
>>
>> As far as I understand a user-defined pigment functions just returns
>> a single float that is used as an index in a color_map.
>>
>
> If I understood it correctly, I think the "average" pattern should help
> there: create 3 separate pigments for each function, then use a
> pigment_map to average them together.
>

If you want to add a filter or transmit component, use your function 
this way, after the pigment itself:
filter My_Filter_Function(x,y,z) transmit My_Transmit_Function(x,y,z)


Post a reply to this message

From: clipka
Subject: Re: How to make my own 3D pigment?
Date: 22 Jun 2011 18:19:56
Message: <4e026a8c$1@news.povray.org>
Am 22.06.2011 16:40, schrieb Jaime Vives Piqueres:

>> I want to render objects having a self-made 3D pigment that is
>> defined via 3 user-defined functions (one for red, one for green and
>> one for blue), or via one function that returns an RGB color vector
>> directly
>>
>> (Or even an 4- or 5-dimensional rgbf, rgbt or rgbft vector)
>>
>> Is that possible, somehow?
>>
>>
>> As far as I understand a user-defined pigment functions just returns
>> a single float that is used as an index in a color_map.
>>
>
> If I understood it correctly, I think the "average" pattern should help
> there: create 3 separate pigments for each function, then use a
> pigment_map to average them together.

Yup, AFAIK that's the only way to do it. For each channel, use a 
color_map ranging from "rgbft 0" to "red N" (or "green N", "blue N", 
etc., respectively), where N is the number of channels you intend to 
mix, e.g. 4 for rgbf. (This is required because what you really want is 
a sum, not the average.)


Post a reply to this message

From: SharkD
Subject: Re: How to make my own 3D pigment?
Date: 22 Jun 2011 22:20:05
Message: <4e02a2d5$1@news.povray.org>
On 6/22/2011 10:13 AM, Lars R. wrote:
> I want to render objects having a self-made 3D pigment that is defined
> via 3 user-defined functions (one for red, one for green and one for
> blue), or via one function that returns an RGB color vector directly
>
> (Or even an 4- or 5-dimensional rgbf, rgbt or rgbft vector)
>
> Is that possible, somehow?
>
>
> As far as I understand a user-defined pigment functions just returns a
> single float that is used as an index in a color_map.
>
>
> 			Lars R.


There are some good examples here:

http://lib.povray.org/searchcollection/index2.php?objectName=ColorSolid&version=1.21&contributorTag=SharkD


Mike


-- 
http://isometricland.com


Post a reply to this message

From: Lars R 
Subject: Re: How to make my own 3D pigment?
Date: 23 Jun 2011 02:27:52
Message: <4e02dce8$1@news.povray.org>
> There are some good examples here:
> 
>
http://lib.povray.org/searchcollection/index2.php?objectName=ColorSolid&version=1.21&contributorTag=SharkD

Looks nice. I'll download it and look into its source to explore how
they did it. :-)

Thank you!

			Lars


Post a reply to this message

From: Lars R 
Subject: Re: How to make my own 3D pigment?
Date: 23 Jun 2011 02:35:32
Message: <4e02deb4$1@news.povray.org>
>  If I understood it correctly, I think the "average" pattern should help
> there: create 3 separate pigments for each function, then use a
> pigment_map to average them together.

AFAIK the pigment_maps have to be nested:

the outermost pigment is i.e. 'gradient z' and it pigment_map maps from
the "black/red/green/yellow" pigment of the front xy face to the
"blue/magenta/cyan/white" pigment of the back xy face.

The two 4-color pigments are created the same way:

A gradient in y direction to merge from "black/red" at the bottom to
"green/yellow" at the top => Front face pigment.

A second gradient in y direction to merge from "blue/magenta" at the
bottom to "cyan/white" at the top => back face pigment.

And finally, each of the four vertical ramps are "gradient x" from "left
color" to "left color + red".

Do I got it?

			Lars R.


Post a reply to this message

From: SharkD
Subject: Re: How to make my own 3D pigment?
Date: 23 Jun 2011 11:23:12
Message: <4e035a60$1@news.povray.org>
On 6/23/2011 2:27 AM, Lars R. wrote:
>> There are some good examples here:
>>
>>
http://lib.povray.org/searchcollection/index2.php?objectName=ColorSolid&version=1.21&contributorTag=SharkD
>
> Looks nice. I'll download it and look into its source to explore how
> they did it. :-)
>
> Thank you!
>
> 			Lars
>
>


I was thinking it would be a good subject for a tutorial, but I'm not 
sure I'll get around and do it.

-- 
http://isometricland.com


Post a reply to this message

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