|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka <ano### [at] anonymousorg> wrote:
> Am 01.12.2016 um 11:34 schrieb John Greenwood:
>
> > Yes I think so. It seems that the x,y,z is needed when it is a function within a
> > function as in R_Surface. I am nesting functions 5 deep and it looks like the
> > x,y,z needs to be "passed down" but I am not clear exactly what the rules are.
> > The x,y,z is a bit of clutter for the user.
>
> That shouldn't be the case -- unless the functions further down the
> rabbit hole actually try to access x,y,z.
>
> There's essentially just one special case with regards to x,y,z: If you
> specify a function without a parameter list, it will default to (x,y,z).
In the line:
#declare R_Surface =
function(p,r,L,xo,yo,zo,x,y,z,Fm){R_S_function(p,x,y,z,((x*xo+y*yo+z*zo)/sqrt(pow(xo,2)+pow(yo,2)+pow(zo,2))
+L+Fm) /-r)}
Substituting R_function for R_S_function no longer works. I think this is
because Fm is a function that contains functions of x,y,z.
R_function works when it is at the bottom of the hole as in this example from a
previous post:
#declare R_Object1 =
function(x,y,z){
R_Intersection(
+R_function(p,(x +(4)) /-r)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 01.12.2016 um 12:34 schrieb John Greenwood:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 01.12.2016 um 11:34 schrieb John Greenwood:
>>
>>> Yes I think so. It seems that the x,y,z is needed when it is a function within a
>>> function as in R_Surface. I am nesting functions 5 deep and it looks like the
>>> x,y,z needs to be "passed down" but I am not clear exactly what the rules are.
>>> The x,y,z is a bit of clutter for the user.
>>
>> That shouldn't be the case -- unless the functions further down the
>> rabbit hole actually try to access x,y,z.
>>
>> There's essentially just one special case with regards to x,y,z: If you
>> specify a function without a parameter list, it will default to (x,y,z).
>
> In the line:
> #declare R_Surface =
>
function(p,r,L,xo,yo,zo,x,y,z,Fm){R_S_function(p,x,y,z,((x*xo+y*yo+z*zo)/sqrt(pow(xo,2)+pow(yo,2)+pow(zo,2))
> +L+Fm) /-r)}
>
> Substituting R_function for R_S_function no longer works. I think this is
> because Fm is a function that contains functions of x,y,z.
>
> R_function works when it is at the bottom of the hole as in this example from a
> previous post:
> #declare R_Object1 =
> function(x,y,z){
> R_Intersection(
> +R_function(p,(x +(4)) /-r)
Can you attach an example scene file in povray.binaries.scene-files?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 01.12.2016 um 11:34 schrieb John Greenwood:
> >
> > > Yes I think so. It seems that the x,y,z is needed when it is a function within a
> > > function as in R_Surface. I am nesting functions 5 deep and it looks like the
> > > x,y,z needs to be "passed down" but I am not clear exactly what the rules are.
> > > The x,y,z is a bit of clutter for the user.
> >
> > That shouldn't be the case -- unless the functions further down the
> > rabbit hole actually try to access x,y,z.
> >
> > There's essentially just one special case with regards to x,y,z: If you
> > specify a function without a parameter list, it will default to (x,y,z).
>
> In the line:
> #declare R_Surface =
>
function(p,r,L,xo,yo,zo,x,y,z,Fm){R_S_function(p,x,y,z,((x*xo+y*yo+z*zo)/sqrt(pow(xo,2)+pow(yo,2)+pow(zo,2))
> +L+Fm) /-r)}
>
> Substituting R_function for R_S_function no longer works. I think this is
> because Fm is a function that contains functions of x,y,z.
This works:
#declare R_Surface =
function(p, r, L, xo, yo, zo, x, y, z, Fm) {
R_function(
p,
((x*xo + y*yo + z*zo)/sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2)) + L + Fm)/-r
)
}
Fm is not a function, it is a parameter that already contains a value when the
R_Surface function is evaluated, so x, y and z is not needed within the
R_Surface function for the purpose of calculating Fm.
Btw.:
If you do this:
#include "functions.inc"
Then you can replace this:
sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2))
- with this:
f_r(xo, yo, zo)
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> > clipka <ano### [at] anonymousorg> wrote:
> > > Am 01.12.2016 um 11:34 schrieb John Greenwood:
> >
> > Substituting R_function for R_S_function no longer works. I think this is
> > because Fm is a function that contains functions of x,y,z.
>
> This works:
>
> #declare R_Surface =
> function(p, r, L, xo, yo, zo, x, y, z, Fm) {
> R_function(
> p,
> ((x*xo + y*yo + z*zo)/sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2)) + L + Fm)/-r
> )
> }
>
> Fm is not a function, it is a parameter that already contains a value when the
> R_Surface function is evaluated, so x, y and z is not needed within the
> R_Surface function for the purpose of calculating Fm.
>
>
> Btw.:
>
> If you do this:
>
> #include "functions.inc"
>
> Then you can replace this:
>
> sqrt(pow(xo,2) + pow(yo,2) + pow(zo,2))
>
> - with this:
>
> f_r(xo, yo, zo)
>
> --
> Tor Olav
> http://subcube.com
Thanks for showing me this. I need to look at it more closely.
But what about the main question: can my function which, is a single closed
surface, be turned into mesh?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
....
> Thanks for showing me this. I need to look at it more closely.
You are welcome.
> But what about the main question: can my function which, is a single closed
> surface, be turned into mesh?
Perhaps you can find something useful in this thread:
Subject: Isosurface Approximation macros rewrite
From: Tor Olav Kristensen
Date: 2008 February 22nd
Message: <47be20ab@news.povray.org>
Newsgroup: povray.binaries.scene-files
http://news.povray.org/povray.binaries.scene-files/thread/%3C47cc76fd@news.povray.org%3E/
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
>> can my function, which is a single closed surface, be turned into mesh?
>
> Perhaps you can find something useful in this thread:
>
> Subject: Isosurface Approximation macros rewrite
> From: Tor Olav Kristensen
> Date: 2008 February 22nd
> Message: <47be20ab@news.povray.org>
> Newsgroup: povray.binaries.scene-files
>
>
http://news.povray.org/povray.binaries.scene-files/thread/%3C47cc76fd@news.povray.org%3E/
>
> --
> Tor Olav
> http://subcube.com
I have had a look and am floundering.
An example would be worth ten thousand words.
Could some kind person point me at an actual example of converting a simple
function, such as:
function(x,y,z){sqrt(pow(x,2)+pow(y,2)+pow(z,2))-L)/r }
into a mesh object?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
>
> >> can my function, which is a single closed surface, be turned into mesh?
> >
> > Perhaps you can find something useful in this thread:
> >
> > Subject: Isosurface Approximation macros rewrite
> > From: Tor Olav Kristensen
> > Date: 2008 February 22nd
> > Message: <47be20ab@news.povray.org>
> > Newsgroup: povray.binaries.scene-files
> >
> >
http://news.povray.org/povray.binaries.scene-files/thread/%3C47cc76fd@news.povray.org%3E/
> >
> > --
> > Tor Olav
> > http://subcube.com
>
> I have had a look and am floundering.
>
> An example would be worth ten thousand words.
See the code below.
> Could some kind person point me at an actual example of converting a simple
> function, such as:
> function(x,y,z){sqrt(pow(x,2)+pow(y,2)+pow(z,2))-L)/r }
> into a mesh object?
That function seemsto be missing a start parenthesis somewhere.
The code below uses a similar function.
Noe that this code also creates a file named triangles.inc that contains all the
triangles.
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
#include "functions.inc"
// Other functions to experiment with
//#declare Fn = function { f_torus(x, y, z, 1, 0.4) }
//#declare Fn = function { y - sin(2*x*z)*cos(x*z) }
//#declare Fn = function { cos(2*pi*x) + cos(2*pi*y) + cos(2*pi*z) }
// A sphere with radius 1.8
// x^2 + y^2 + z^2 = 1.8^2
// (x^2 + y^2 + z^2)^(1/2) = 1.8
// (x^2 + y^2 + z^2)^(1/2) - 1.8 = 0.0
// The elaborate way
//#declare Fn = function(x, y, z) { sqrt(pow(x,2) + pow(y,2) + pow(z,2)) - 1.8 }
// A simpler way
#declare Fn = function { f_sphere(x, y, z, 1.8) }
#declare isoThreshold = 0.0;
// Set to yes to produce the approximation
// or to no for the actual isosurface
#declare approximateIso = yes;
// Set to yes to produce a smooth_triangle approximation
// or to no ro produce a flat triangle approximation
#declare isoSmooth = no;
// Controls the size of the cube that is beeing sampled
#declare R = 2.0;
#declare isoMin = -<1, 1, 1>*R;
#declare isoMax = +<1, 1, 1>*R;
// The resolution of the sampling in the x, y and z directions
#declare Resolution = 6;
#if (approximateIso)
#declare Depth = 1; // Set to 0 for no recursion
#declare isoSegs = <1, 1, 1>*Resolution;
#declare isoFileOption = 1;
#declare isoFile = "triangles.inc";
#declare isoName = "Surface";
#include "isosurface_kl_jf_tok.inc"
object {
Surface
pigment { color rgb <1, 1, 1>*0.9 }
finish {
phong 0.5
phong_size 10
}
}
#else
isosurface {
function { Fn(x, y, z) }
max_gradient 8.0
contained_by { box { isoMin, isoMax } }
open
pigment { color rgb <1, 1, 1>*0.9 }
finish {
phong 0.5
phong_size 10
}
}
#end // if
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
sky_sphere {
pigment {
function { abs(y) }
color_map {
[ 0.0 color rgb <0.0, 0.0, 0.6> ]
[ 1.0 color rgb <1.0, 1.0, 1.0> ]
}
}
}
camera {
location <1, 2, -4>*2*R
look_at <0, 0, 0>
angle 32
}
light_source {
<1, 2, -1>*100
color rgb <1, 1, 1>
shadowless
}
light_source {
<-1, -2, -1>*100
color rgb <1, 1, 1>*0.5
shadowless
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> > "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > > "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> > I have had a look and am floundering.
> >
> > An example would be worth ten thousand words.
>
> See the code below.
>
>
> > Could some kind person point me at an actual example of converting a simple
> > function, such as:
> > function(x,y,z){sqrt(pow(x,2)+pow(y,2)+pow(z,2))-L)/r }
> > into a mesh object?
>
> That function seemsto be missing a start parenthesis somewhere.
> The code below uses a similar function.
>
> Noe that this code also creates a file named triangles.inc that contains all the
> triangles.
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
>
> #include "functions.inc"
>
> // Other functions to experiment with
> //#declare Fn = function { f_torus(x, y, z, 1, 0.4) }
> //#declare Fn = function { y - sin(2*x*z)*cos(x*z) }
> //#declare Fn = function { cos(2*pi*x) + cos(2*pi*y) + cos(2*pi*z) }
>
> // A sphere with radius 1.8
> // x^2 + y^2 + z^2 = 1.8^2
> // (x^2 + y^2 + z^2)^(1/2) = 1.8
> // (x^2 + y^2 + z^2)^(1/2) - 1.8 = 0.0
>
> // The elaborate way
> //#declare Fn = function(x, y, z) { sqrt(pow(x,2) + pow(y,2) + pow(z,2)) - 1.8 }
>
> // A simpler way
> #declare Fn = function { f_sphere(x, y, z, 1.8) }
>
> #declare isoThreshold = 0.0;
>
> // Set to yes to produce the approximation
> // or to no for the actual isosurface
> #declare approximateIso = yes;
>
> // Set to yes to produce a smooth_triangle approximation
> // or to no ro produce a flat triangle approximation
> #declare isoSmooth = no;
>
> // Controls the size of the cube that is beeing sampled
> #declare R = 2.0;
>
> #declare isoMin = -<1, 1, 1>*R;
> #declare isoMax = +<1, 1, 1>*R;
>
> // The resolution of the sampling in the x, y and z directions
> #declare Resolution = 6;
>
> #if (approximateIso)
> #declare Depth = 1; // Set to 0 for no recursion
> #declare isoSegs = <1, 1, 1>*Resolution;
> #declare isoFileOption = 1;
> #declare isoFile = "triangles.inc";
> #declare isoName = "Surface";
> #include "isosurface_kl_jf_tok.inc"
> object {
> Surface
> pigment { color rgb <1, 1, 1>*0.9 }
> finish {
> phong 0.5
> phong_size 10
> }
> }
> #else
> isosurface {
> function { Fn(x, y, z) }
> max_gradient 8.0
> contained_by { box { isoMin, isoMax } }
> open
> pigment { color rgb <1, 1, 1>*0.9 }
> finish {
> phong 0.5
> phong_size 10
> }
> }
> #end // if
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
>
> sky_sphere {
> pigment {
> function { abs(y) }
> color_map {
> [ 0.0 color rgb <0.0, 0.0, 0.6> ]
> [ 1.0 color rgb <1.0, 1.0, 1.0> ]
> }
> }
> }
>
> camera {
> location <1, 2, -4>*2*R
> look_at <0, 0, 0>
> angle 32
> }
>
> light_source {
> <1, 2, -1>*100
> color rgb <1, 1, 1>
> shadowless
> }
>
> light_source {
> <-1, -2, -1>*100
> color rgb <1, 1, 1>*0.5
> shadowless
> }
>
> // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8
>
>
> --
> Tor Olav
> http://subcube.com
Thanks I will have a go.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
> > > "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > > > "John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
>
> > > I have had a look and am floundering.
> > >
> > > An example would be worth ten thousand words.
> > The code below uses a similar function.
snip
> > --
> > Tor Olav
> > http://subcube.com
>
> Thanks I will have a go.
I have had a go and it works!
This is a great help for composing rounded objects. By reducing the resolution
to 5(and ignoring the artifacts) and putting isoSmooth = no, the render time is
4 seconds, AND I can have muliple views, almost essential for creating 3D
objects.
A single isosurface rendering took 88 seconds
I understand that with a mesh object I can change the colour locally. This will
be much better for introducing lip colours and rosy cheeks in this example.
Thanks
John
(I have posted the result in povray.binaries.images/ but am not clear if and how
to make it appear here)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John Greenwood" <joh### [at] john-greenwoodcouk> wrote:
>
> I understand that with a mesh object I can change the colour locally. This will
> be much better for introducing lip colours and rosy cheeks in this example.
>
> (I have posted the result in povray.binaries.images/ but am not clear if and how
> to make it appear here)
If by a link...?
http://news.povray.org/web.5842b2dd261ae99ae15d43a80%40news.povray.org
That object to mesh stuff is fascinating, unfortunately I'm terrible with
meshes. And not so good with isosurfaces either. LOL
Looks like you got a fair result. When I tried the in-pov converting from Chris
Young I was getting inner CSG surfaces found until changing from unions to
merge. Something I hadn't expected. No idea what could happen with isosurfaces
based on that.
Wish you luck.
Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|