|
|
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
|
|