POV-Ray : Newsgroups : povray.advanced-users : functions as patterns, mip-mapping Server Time
29 Jul 2024 08:10:15 EDT (-0400)
  functions as patterns, mip-mapping (Message 1 to 2 of 2)  
From: Sascha Ledinsky
Subject: functions as patterns, mip-mapping
Date: 10 Oct 2002 06:32:26
Message: <3da5573a$1@news.povray.org>
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) ?


And another questions: doe's anyone know a path that supports mip-mapping
and bicubic interpolation for image-maps?

thanks,

-Sascha Ledinsky


Post a reply to this message

From: Tom Melly
Subject: Re: functions as patterns, mip-mapping
Date: 10 Oct 2002 07:40:22
Message: <3da56726$1@news.povray.org>
"Sascha Ledinsky" <sas### [at] opensyscoat> wrote in message
news:3da5573a$1@news.povray.org...
> Hi everyone,

Hi Sascha,

Please read the guidlines regarding cross-posting vs. multi posting (in
frequently asked questions).

It's fine to cross-post (putting two or more newsgroups in the address), but
multi-posting (sending separate copies to different groups) is a no-no.

Anyway, I think someone's answered your question in General...


Post a reply to this message

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