POV-Ray : Newsgroups : povray.newusers : parametric function error Server Time
31 Oct 2024 19:56:49 EDT (-0400)
  parametric function error (Message 1 to 9 of 9)  
From: Bald Eagle
Subject: parametric function error
Date: 19 Jul 2014 17:20:00
Message: <web.53cadfeadf57d4755e7df57c0@news.povray.org>
I was intrigued by the fact that an entire apple could be described by a
parametic equation: (WAY down at the bottom of the page)
http://www.econym.demon.co.uk/isotut/printable.htm

I wanted to play around with this some, but naturally it's been so long that I
have to RElearn how to get my brain to play nicely with functions.

#declare Apple = parametric {
   function { cos(u) * (R1 + R2*cos(v)) + pow((v/pi), 100) },
   function { sin(u) * (R1 + R2*cos(v)) + 0.25 * cos(5*u) },
   function { -2.3 * ln(1 - v*0.3157) + 6*sin(v) + 2*cos(v) }
   <0,0>, <2*pi,pi>
       contained_by { sphere{0, 1.1} }
       max_gradient 10
       accuracy 0.0001
       precompute 10 x,y,z
   texture {pigment {color Red}}
   }
This is throwing a
Parse Error: Expected 'parameter identifier or floating-point constant
identifier', } found instead
at the first _function_ line.

This leads me to believe that I'm missing something, but I've searched and read
things and looked at examples all over the place but haven't been able to lay my
finger on what's causing the error.


Post a reply to this message

From: Bald Eagle
Subject: Re: parametric function error
Date: 19 Jul 2014 18:45:00
Message: <web.53caf48925ca5e895e7df57c0@news.povray.org>
Ok, the error was caused by a typo in defining R1, but now when the script runs,
there's no object visible.

I'm assuming I'll have to play with the following values, but I find it starnge
that I get NOTHING.

contained_by { sphere{0, 2} }
max_gradient 5

Not a dark spot, just... nothing.


Post a reply to this message

From: Alain
Subject: Re: parametric function error
Date: 20 Jul 2014 15:52:40
Message: <53cc1e08$1@news.povray.org>

> Ok, the error was caused by a typo in defining R1, but now when the script runs,
> there's no object visible.
>
> I'm assuming I'll have to play with the following values, but I find it starnge
> that I get NOTHING.
>
> contained_by { sphere{0, 2} }
> max_gradient 5
>
> Not a dark spot, just... nothing.
>
>

Look at the messages after the render. Does it say anything about 
max_gradient?
As one of the functions contain pow((v/pi), 100), the effective 
max_gradient may be rather large. Try using max_gradient 100 or more.

Did you actualy /place/ your Apple object?
Add:
object{Apple pigment{rgb<1,0,0>}}
To your scene.



Alain


Post a reply to this message

From: Bald Eagle
Subject: Re: parametric function error
Date: 20 Jul 2014 17:55:01
Message: <web.53cc39f025ca5e895e7df57c0@news.povray.org>
> Look at the messages after the render. Does it say anything about
> max_gradient?

Nope.
But it did helpfully tell me what I might need to solve the issue:

Ray->Shape Intersection          Tests       Succeeded  Percentage

Parametric                       96390               0      0.00
Parametric Bound                245308           96390     39.29
Bounding Box                    571708          490616     85.82



> Did you actualy /place/ your Apple object?
> Add:
> object{Apple pigment{rgb<1,0,0>}}
> To your scene.

Yep!
I did manage to do that.  I even had the computer plugged in when running the
render.   :D   Yay for me!!!
 object {Apple scale 10 texture {pigment {color Red}}}

(I thought maybe I just couldn't see it, so I kept scaling it up, and stopped at
10)   So, bigger bounded_by, and smaller scale - to keep the render time down?


Post a reply to this message

From: Bald Eagle
Subject: Re: parametric function error
Date: 21 Jul 2014 10:20:01
Message: <web.53cd208125ca5e895e7df57c0@news.povray.org>
Changing to :

contained_by { sphere{0, 1.1} }
max_gradient 30
accuracy 0.1

Gave me a red sphere after 5 min.
(using object {Apple scale 1 texture {pigment {color Red}}} )
   camera {location  <0.0, 0.0, -10.0> look_at   <0, 0, 0>}

Message window:

Ray->Shape Intersection          Tests       Succeeded  Percentage

Parametric                       32428           18225     56.20
Parametric Bound                 37710           32428     85.99
Bounding Box                    387070           75420     19.48

Function VM calls:        281215195

I'm unsure how to interpret this output.  Do I need to increase my contained_by
size to 1.28  (1.1/0.86)?  Or do I need to double it because Parametric
Percentage is down near 50%?


Post a reply to this message

From: William F Pokorny
Subject: Re: parametric function error
Date: 21 Jul 2014 14:05:11
Message: <53cd5657$1@news.povray.org>
On 07/21/2014 10:15 AM, Bald Eagle wrote:
> Changing to :
>
> contained_by { sphere{0, 1.1} }
> max_gradient 30
> accuracy 0.1
>
> Gave me a red sphere after 5 min.
>
Have your tried working from the source code Mike provides via 
download-able zip at the bottom of the page: 
http://www.econym.demon.co.uk/isotut/real.htm ?

His Apple.pov example works without trouble for me in < 15 seconds. No 
AA at default povray resolution.

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: parametric function error
Date: 21 Jul 2014 21:50:01
Message: <web.53cdc29625ca5e895e7df57c0@news.povray.org>
> Have your tried working from the source code Mike provides via
> download-able zip at the bottom of the page:
> http://www.econym.demon.co.uk/isotut/real.htm ?

Ooooooh.  Tricksy you are, reading all the way down to the bottom of the page.
Stupid I was feeling, when I discovered that zip file already on my hard drive.
:(
I am, however, ever so grateful.
You've denied me my cross of agony and frustration.

> His Apple.pov example works without trouble for me in < 15 seconds. No
> AA at default povray resolution.

Wicked cool.  I, embracing the technology of The Ancients, am able to render it
in a mere 1:52. (4:27 with aa).

Thanks for the tip, WP!  While that gets me an amazing apple (really?  with only
TWO pigments??),  I'm still just as ignorant about the ray ---> intersection
output.  I also didn't see any notification in the message window about
max_gradient.  Is it there?  Nothing leapt off the screen, grabbed me around the
neck, and screamed, "LOOK AT ME!!!"   So I may have missed it.  :O


Post a reply to this message

From: William F Pokorny
Subject: Re: parametric function error
Date: 22 Jul 2014 07:35:31
Message: <53ce4c83$1@news.povray.org>
On 07/21/2014 09:47 PM, Bald Eagle wrote:
>
> Wicked cool.  I, embracing the technology of The Ancients, am able to render it
> in a mere 1:52. (4:27 with aa).

Suppose with ray tracing as in the movie Jaws, once you see the shark, 
you want a bigger boat. ;-)

>
> Thanks for the tip, WP!  While that gets me an amazing apple (really?  with only
> TWO pigments??),  I'm still just as ignorant about the ray ---> intersection
> output.  I also didn't see any notification in the message window about
> max_gradient.  Is it there?  Nothing leapt off the screen, grabbed me around the
> neck, and screamed, "LOOK AT ME!!!"   So I may have missed it.  :O
>

I admit to not spending much time with the intersection test values 
beyond checking them for sanity if I am getting a result which is 
completely wrong. That said, I believe what gets reported is basically a 
hierarchy of tests. How many rays hit the bounding box(es) -> how many 
of those rays hit the parametric containing sphere -> finally how many 
of those rays hit the parametric object.

As for a maximum gradient report. I re-ran Mike's example code 
commenting out the precompute option and adding a max_gradient of 0.5. 
Only a portion of the object renders, so I would expect to see a max 
gradient report - if they are reported for parametric objects - but I do 
not. Lastly looking at the source code for the parametric object, it 
doesn't look to me like any attempt is made to record and report a max 
gradient as is the case with isosurfaces.

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: parametric function error
Date: 22 Jul 2014 16:25:01
Message: <web.53cec86925ca5e895e7df57c0@news.povray.org>
Thanks for taking a look at that, it would have bothered me for a while.

After reading various threads on the explanation of why parametrics are so slow
to render, and how there can be problems seeing where the surface is supposed to
be rendered,  I decided to see how fast the equations could be plotted out if I
"manually" ran through values of phi and theta.  I figured this would also be
independent of any reliance on contained_by shapes, and would help rapidly
troubleshoot parametrics.

of note:  I started out trying use "functions", and after contemplating
POV-i-cide, decided to just declare equations and while-loop through them.

Results at:
http://news.povray.org/povray.binaries.images/thread/<web.53cec54fc9bb24105e7df57c0%40news.povray.org>/


Even with the frequency (2 radians) and the bells and whistles, it renders for
me at +q9 in 25 sec.


Post a reply to this message

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