|
|
Hi everyone,
I hit a strange "problem" with 'functions' or at least I can't figure out
what's wrong in my code:
I tried to use a function as a pigment and I'd like to use the normal vector
(or, to be more prezicely, the angle at with the camera ray hits the
surface) of the surface in my pigment-function, but I can't get it working.
Here's a short piece of code that shows the problem:
camera
{
location <0,5,-10>
look_at <0,0,0>
}
background { color rgb <0,0,1> }
/********************************************************************/
#declare test_pigment = pigment { checker }
#declare f_pigment = function { pattern { checker } }
#declare function_pigment = pigment { function { f_pigment(x,y,z) } }
/********************************************************************/
plane
{
y,-1
pigment { function_pigment }
finish { ambient 1 }
clipped_by { plane { x,0 } }
}
plane
{
y,-1
pigment { test_pigment }
finish { ambient 1 }
clipped_by { plane { -x,0 } }
}
sphere
{
<-2.5,1,0>,2
pigment { function_pigment }
finish { ambient 1 }
}
sphere
{
<2.5,1,0>,2
pigment { test_pigment }
finish { ambient 1 }
}
this works as expected, but when I change the pattern to slope:
/********************************************************************/
#declare test_pigment = pigment { slope { <0,5,-10> } }
#declare f_pigment = function { pattern { slope { <0,5,-10> } } }
#declare function_pigment = pigment { function { f_pigment(x,y,z) } }
/********************************************************************/
I get the following error:
"Parse Error: No matching } in 'pattern', slope found instead"
I also tried it with a pigment instead of a pattern:
/********************************************************************/
#declare test_pigment = pigment { checker }
#declare f_pigment = function { pigment { test_pigment } }
#declare function_pigment = pigment { function { f_pigment(x,y,z).grey } }
/********************************************************************/
and again, with the checker pigment it works just fine, but when
switching to the slope-pigment:
/********************************************************************/
#declare test_pigment = pigment { slope { <0,5,-10> } }
#declare f_pigment = function { pigment { test_pigment } }
#declare function_pigment = pigment { function { f_pigment(x,y,z).grey } }
/********************************************************************/
the left side of the image is black (the function seems to return zero all
the time)
Do you know if this is a limitation of the renderer or if there's something
wrong with the code?
As far as I understand, the only values passed to functions are the x/y/z
coordinates of the ray/shape intersection. Is there a way to use other
values like the surface normal, derivates, u/v-coordinates, vector of the
ray, etc. in custom functions (like in the Renderman Shaderlanguege) ?
thanks,
-Sascha Ledinsky
Post a reply to this message
|
|
|
|
Sascha Ledinsky wrote:
>
> Hi everyone,
>
> I hit a strange "problem" with 'functions' or at least I can't figure out
> what's wrong in my code:
>
> [...]
>
> this works as expected, but when I change the pattern to slope:
>
> [...]
Since the slope pattern is only defined on the surface of an object it can
only be used in textures and not in functions.
> As far as I understand, the only values passed to functions are the x/y/z
> coordinates of the ray/shape intersection. Is there a way to use other
> values like the surface normal, derivates, u/v-coordinates, vector of the
> ray, etc. in custom functions (like in the Renderman Shaderlanguege) ?
No, there is POVMan: http://www.aetec.ee/fv/vkhomep.nsf/
which supports a subset of renderman shader functionality though.
Christoph
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|