POV-Ray : Newsgroups : povray.general : Can I use a function to create a pigment WITHOUT using a colour_map? : Re: Can I use a function to create a pigment WITHOUT using a colour_map? Server Time
30 Jul 2024 00:19:23 EDT (-0400)
  Re: Can I use a function to create a pigment WITHOUT using a colour_map?  
From: Rarius
Date: 12 Apr 2010 04:46:02
Message: <4bc2ddca$1@news.povray.org>
>> It appears you can't put functions into a rgbt<>.
> No, but you can have a function that will return a pigment.
> pigment{ rgbt fRingPigment(x,y,z) }
> or even
> pigment{ fRingPigment(x,y,z) }

I tried this and the parser fails as soon as it hits the x, saying 
"Parse Error: Float
expected but vector or color expression found."

Here is the entire code...

#local InnerEdge=74.510;
#local OuterEdge=140.390;

#local fRingGradient=
function
{
    (sqrt((x*x)+(y*y)+(z*z))-InnerEdge)/(OuterEdge-InnerEdge)
}

#local fRingColour=
function
{
    pigment
    {
        image_map
        {
            png "bjj\sat_ring_color.png"
            interpolate 4
        }
    }
}

#local pRingColour=
function
{
    pigment
    {
        colour fRingColour(fRingGradient(x, y, 0),0,0)
    }
}

fRingGradient() returns a value from 0 to 1 depending where on the ring 
disk x,y,z is. 0 at inner edge, 1 at outer edge
fRingColour() returns a square pigment loaded with the imagemap file. 
This file is 800px wide and 1px high.
pRingColour() should return the colour from the image mapping the square 
image onto the ring. 

Unfortunately it appears that in pRingColour() the x and y are no longer 
the parameters, but have reverted to the standard vectors. 

I have tried removing the "colour" keyword, removing the "pigment" all 
to no avail.

There is something odd going on here.

Rarius


Post a reply to this message


Attachments:
Download 'iso-8859-1' (4 KB)

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