POV-Ray : Newsgroups : povray.advanced-users : Help creating a parametric surface Server Time
28 Mar 2024 22:10:12 EDT (-0400)
  Help creating a parametric surface (Message 1 to 3 of 3)  
From: Seany
Subject: Help creating a parametric surface
Date: 15 Mar 2018 08:20:00
Message: <web.5aaa63c9effe1652512fbfb00@news.povray.org>
Hi
I am trying to create a parametric surface.

The surface is basically a sweep of a closed curve, along a logarithmic helix,
and the cross section is a bean curve.

I am using this code :

#include "colors.inc"
#include "glass.inc"
#include "golds.inc"
#include "metals.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "textures.inc"
#include "spectral.inc"
#include "rand.inc"
#include "param.inc"
#include "math.inc"


#declare MaxTrace    = 60;
#declare Radio       = 1;
#declare Photons     = 10000000;
#declare Sunlight    = 0;
#declare SkyEmission = 5;

#declare RoomDesign  = 1;


camera {      // sPlace the camera
  location  <-30.0,0,0.0>    // Camera location
  look_at < 0,0,-0>       // Where camera is pointing
//   angle 60           // Angle of the view

}
global_settings { ambient_light White }   // Ambient light to
       // "brighten up" darker pictures

#declare Lamp = union {
  light_source {<0,0,6>, SpectralEmission(E_Blackbody(5000)) * 200
  fade_power 2
  fade_distance 5
  photons {reflection on refraction on }
  }

  sphere { 0, 5
    pigment { SpectralEmission(E_Blackbody(5000)) }
    finish {emission 3 ambient 0 diffuse 0}
    no_shadow
    no_radiosity
  }

  translate <0, 50, 100>
}

object {Lamp}

background { color White}

/*
plane {
  <12,-0,5>, -12               // This represents the plane 0x+0y+z=0
  texture { Copper_Metal}      // The texture comes from the
       // file "metals.inc"
   }
*/


// u = horizontal angle

#declare logSpiral_a = 1.73;
#declare logspiral_b = 0.083;
#declare logSpiral_c = -0.638;

#declare logSpiral_x = function(u) {
    logSpiral_a*sin(u)*exp(logspiral_b*u)
   }
#declare logSpiral_y = function(u) {
    -1*logSpiral_a*cos(u)*exp(logspiral_b*u)
   }
#declare logSpiral_z = function(u) {
    logSpiral_c*u
   }

// all correct till here.


// v = vertical angle
#declare section_a = 3;
#declare section_b = 1;
#declare section_xMult = 2;
#declare section_yMult = 1.74;

#declare section_x = function(v) {
       section_xMult * cos(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }
#declare section_y = function(v) {
       section_yMult * sin(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }



#declare ustart = 0;




object { merge {
#while (ustart < 7*pi )



    #declare xx = logSpiral_x(ustart);
    #declare yy = -1*logSpiral_y(ustart);
    #declare zz = logSpiral_z(ustart);

    #declare vstart = 0;
    #while (vstart < 2*pi+0.01)
 #declare xxx = section_x(vstart);
 #declare yyy = 5;
 #declare zzz = -1*section_y(vstart);

 object {
  sphere {
  <xx,yy+xxx,zz+zzz>, 0.5
  }
  texture {NBoldglass}
 }
 #declare vstart = vstart + 0.1;
   #end

    #declare ustart = ustart + 0.1;
#end
}}

and gets me a sphere built version of what i want. that is, the contour is built
from many spheres.

But I actually want to generate a parametric surface with this.

So if i use the code :


#include "colors.inc"
#include "glass.inc"
#include "golds.inc"
#include "metals.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "textures.inc"
#include "spectral.inc"
#include "rand.inc"
#include "param.inc"
#include "math.inc"


#declare MaxTrace    = 60;
#declare Radio       = 1;
#declare Photons     = 10000000;
#declare Sunlight    = 0;
#declare SkyEmission = 5;

#declare RoomDesign  = 1;


camera {      // sPlace the camera
  location  <-30.0,0,0.0>    // Camera location
  look_at < 0,0,-0>       // Where camera is pointing
//   angle 60           // Angle of the view

}
global_settings { ambient_light White }   // Ambient light to
       // "brighten up" darker pictures

#declare Lamp = union {
  light_source {<0,0,6>, SpectralEmission(E_Blackbody(5000)) * 200
  fade_power 2
  fade_distance 5
  photons {reflection on refraction on }
  }

  sphere { 0, 5
    pigment { SpectralEmission(E_Blackbody(5000)) }
    finish {emission 3 ambient 0 diffuse 0}
    no_shadow
    no_radiosity
  }

  translate <0, 50, 100>
}

object {Lamp}

background { color White}

/*
plane {
  <12,-0,5>, -12               // This represents the plane 0x+0y+z=0
  texture { Copper_Metal}      // The texture comes from the
       // file "metals.inc"
   }
*/


// u = horizontal angle

#declare logSpiral_a = 1.73;
#declare logspiral_b = 0.083;
#declare logSpiral_c = -0.638;

#declare logSpiral_x = function(u) {
    logSpiral_a*sin(u)*exp(logspiral_b*u)
   }
#declare logSpiral_y = function(u) {
    -1*logSpiral_a*cos(u)*exp(logspiral_b*u)
   }
#declare logSpiral_z = function(u) {
    logSpiral_c*u
   }

// all correct till here.


// v = vertical angle
#declare section_a = 3;
#declare section_b = 1;
#declare section_xMult = 2;
#declare section_yMult = 1.74;

#declare section_x = function(v) {
       section_xMult * cos(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }
#declare section_y = function(v) {
       section_yMult * sin(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }



#declare ustart = 0;


object { parametric {

  function {logSpiral_x(u) }
  function {-1*logSpiral_y(u)  + section_x(v) }
  function {-1*section_y(v) + logSpiral_z(u)}
  <0,0>,<4*pi,2*pi>
  accuracy 0.01
  precompute 20 x,y,z

 }
 scale <0.2,0.2,0.2>
 texture {Green_Glass}

}

Nothing is rendered.

What am I doing wrong?

Please help !


Post a reply to this message

From: Bald Eagle
Subject: Re: Help creating a parametric surface
Date: 15 Mar 2018 20:30:01
Message: <web.5aab0f3d67d1924d5cafe28e0@news.povray.org>
I added a standard light source, used a simpler texture (for speed), and then
added contained_by and max_gradient.

That seems to have made the curve show up  :)




#version 3.7;

global_settings {
 assumed_gamma 1.0
}

#include "colors.inc"
#include "glass.inc"
#include "golds.inc"
#include "metals.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "textures.inc"
//#include "spectral.inc"
#include "rand.inc"
//#include "param.inc"
#include "math.inc"


#declare MaxTrace    = 60;
#declare Radio       = 1;
#declare Photons     = 10000000;
#declare Sunlight    = 0;
#declare SkyEmission = 5;

#declare RoomDesign  = 1;


camera {      // sPlace the camera
  location  <-5.0,0,0.0>    // Camera location
  look_at < 0,0,-0>       // Where camera is pointing
//   angle 60           // Angle of the view

}
//global_settings { ambient_light White }   // Ambient light to
       // "brighten up" darker pictures
light_source {<-40, 5, 0> color White}

/*
#declare Lamp = union {
  light_source {<0,0,6>, SpectralEmission(E_Blackbody(5000)) * 200
  fade_power 2
  fade_distance 5
  photons {reflection on refraction on }
  }

  sphere { 0, 5
    pigment { SpectralEmission(E_Blackbody(5000)) }
    finish {emission 3 ambient 0 diffuse 0}
    no_shadow
    no_radiosity
  }

  translate <0, 50, 100>
}

object {Lamp}
*/

background { color White}

/*
plane {
  <12,-0,5>, -12               // This represents the plane 0x+0y+z=0
  texture { Copper_Metal}      // The texture comes from the
       // file "metals.inc"
   }
*/


// u = horizontal angle

#declare logSpiral_a = 1.73;
#declare logspiral_b = 0.083;
#declare logSpiral_c = -0.638;

#declare logSpiral_x = function(u) {
    logSpiral_a*sin(u)*exp(logspiral_b*u)
   }
#declare logSpiral_y = function(u) {
    -1*logSpiral_a*cos(u)*exp(logspiral_b*u)
   }
#declare logSpiral_z = function(u) {
    logSpiral_c*u
   }

// all correct till here.


// v = vertical angle
#declare section_a = 3;
#declare section_b = 1;
#declare section_xMult = 2;
#declare section_yMult = 1.74;

#declare section_x = function(v) {
       section_xMult * cos(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }
#declare section_y = function(v) {
       section_yMult * sin(v) * (
         pow(sin(v),section_a) + pow(cos(v),section_b)
        )
     }



#declare ustart = 0;


object { parametric {

  function {logSpiral_x(u) }
  function {-1*logSpiral_y(u)  + section_x(v) }
  function {-1*section_y(v) + logSpiral_z(u)}
  <0,0>,<4*pi,2*pi>
  contained_by {box {<1,1,1>*-10, <1,1,1>*10}}
  max_gradient 20
  accuracy 0.01
  precompute 20 x,y,z

 }
 scale <0.2,0.2,0.2>
 //texture {Green_Glass}
 texture {pigment {Green*0.5} finish {specular 0.4}}

}


Post a reply to this message

From: Alain
Subject: Re: Help creating a parametric surface
Date: 16 Mar 2018 14:15:52
Message: <5aac09d8$1@news.povray.org>
Le 18-03-15 à 20:26, Bald Eagle a écrit :
> I added a standard light source, used a simpler texture (for speed), and then
> added contained_by and max_gradient.
> 
> That seems to have made the curve show up  :)
> 
> 
> 
> 
> #version 3.7;
> 
> global_settings {
>   assumed_gamma 1.0
> }
> 
> #include "colors.inc"
> #include "glass.inc"
> #include "golds.inc"
> #include "metals.inc"
> #include "stones.inc"
> #include "woods.inc"
> #include "shapes.inc"
> #include "textures.inc"
> //#include "spectral.inc"
> #include "rand.inc"
> //#include "param.inc"
> #include "math.inc"
> 
> 
> #declare MaxTrace    = 60;
> #declare Radio       = 1;
> #declare Photons     = 10000000;
> #declare Sunlight    = 0;
> #declare SkyEmission = 5;
> 
> #declare RoomDesign  = 1;
> 
> 
> camera {      // sPlace the camera
>    location  <-5.0,0,0.0>    // Camera location
>    look_at < 0,0,-0>       // Where camera is pointing
> //   angle 60           // Angle of the view
> 
> }
> //global_settings { ambient_light White }   // Ambient light to
>         // "brighten up" darker pictures
> light_source {<-40, 5, 0> color White}
> 
> /*
> #declare Lamp = union {
>    light_source {<0,0,6>, SpectralEmission(E_Blackbody(5000)) * 200
>    fade_power 2
>    fade_distance 5
>    photons {reflection on refraction on }
>    }
> 
>    sphere { 0, 5
>      pigment { SpectralEmission(E_Blackbody(5000)) }
>      finish {emission 3 ambient 0 diffuse 0}
>      no_shadow
>      no_radiosity
>    }
> 
>    translate <0, 50, 100>
> }
> 
> object {Lamp}
> */
> 
> background { color White}
> 
> /*
> plane {
>    <12,-0,5>, -12               // This represents the plane 0x+0y+z=0
>    texture { Copper_Metal}      // The texture comes from the
>         // file "metals.inc"
>     }
> */
> 
> 
> // u = horizontal angle
> 
> #declare logSpiral_a = 1.73;
> #declare logspiral_b = 0.083;
> #declare logSpiral_c = -0.638;
> 
> #declare logSpiral_x = function(u) {
>      logSpiral_a*sin(u)*exp(logspiral_b*u)
>     }
> #declare logSpiral_y = function(u) {
>      -1*logSpiral_a*cos(u)*exp(logspiral_b*u)
>     }
> #declare logSpiral_z = function(u) {
>      logSpiral_c*u
>     }
> 
> // all correct till here.
> 
> 
> // v = vertical angle
> #declare section_a = 3;
> #declare section_b = 1;
> #declare section_xMult = 2;
> #declare section_yMult = 1.74;
> 
> #declare section_x = function(v) {
>         section_xMult * cos(v) * (
>           pow(sin(v),section_a) + pow(cos(v),section_b)
>          )
>       }
> #declare section_y = function(v) {
>         section_yMult * sin(v) * (
>           pow(sin(v),section_a) + pow(cos(v),section_b)
>          )
>       }
> 
> 
> 
> #declare ustart = 0;
> 
> 
> object { parametric {
> 
>    function {logSpiral_x(u) }
>    function {-1*logSpiral_y(u)  + section_x(v) }
>    function {-1*section_y(v) + logSpiral_z(u)}
>    <0,0>,<4*pi,2*pi>
>    contained_by {box {<1,1,1>*-10, <1,1,1>*10}}
>    max_gradient 20
>    accuracy 0.01
>    precompute 20 x,y,z
> 
>   }
>   scale <0.2,0.2,0.2>
>   //texture {Green_Glass}
>   texture {pigment {Green*0.5} finish {specular 0.4}}
> 
> }
> 
> 

The default contain_by is probably mush to small. Also, the default 
max_gradient was probably much to small, causing the ray testing to 
totally miss the surfaces.


Post a reply to this message

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