Helical Torus
Quelques changements :
- Le sol plane.
- L'éclairage avec une area_light.
- Une texture toute simple pour l'isosurface.
Le code :
// --------------------------------------------------------------------------
// --- LIGHTING -------------------------------------------------------------
// --------------------------------------------------------------------------
// --- area_light size is power of 2 plus 1
// --- 2^2+1 = 5, 2^3+1 = 9, 2^4+1 = 17, 2^5+1=33, 2^6+1=65...
#macro makeAreaLight(AreaSize,AreaLevel)
#local n=1+pow(2,AreaLevel);
area_light -*0.50, +*0.50, n, n
adaptive 1
jitter
orient
circular
#end
light_source {
p2r(15, 60, 100, false)
colour rgb 1
#if (useAreaLights)
makeAreaLight(100,3)
#end
}
// --------------------------------------------------------------------------
// --- ISOSURFACE -----------------------------------------------------------
// --------------------------------------------------------------------------
#declare transmitValue = 0.00;
#if (useTransmit)
#declare transmitValue = 0.25;
#end
#declare myColorMap = color_map {
[ 0.00 rgb < 1.00000, 0.50000, 1.00000> transmit transmitValue ]
[ 0.10 rgb < 1.00000, 0.50000, 1.00000> transmit transmitValue ]
[ 0.20 rgb < 0.50000, 0.50000, 1.00000> transmit transmitValue ]
[ 0.30 rgb < 0.20000, 0.20000, 1.00000> transmit transmitValue ]
[ 0.40 rgb < 0.20000, 1.00000, 1.00000> transmit transmitValue ]
[ 0.50 rgb < 0.20000, 1.00000, 0.20000> transmit transmitValue ]
[ 0.60 rgb < 1.00000, 1.00000, 0.20000> transmit transmitValue ]
[ 0.70 rgb < 1.00000, 0.50000, 0.20000> transmit transmitValue ]
[ 0.80 rgb < 1.00000, 0.20000, 0.20000> transmit transmitValue ]
[ 0.90 rgb < 1.00000, 0.20000, 0.20000> transmit transmitValue ]
[ 1.00 rgb < 1.00000, 0.50000, 1.00000> transmit transmitValue ]
}
isosurface {
function {
f_helical_torus (x, y, z, 1, 9, 5, 0.25, 0.10, -0.15, 0, 1, 1, 0)
}
contained_by {
box { <-1.5,-1.0, -1.5>, <1.5, 1.0, 1.5> }
}
max_gradient 10
texture {
pigment {
#if(useColorsMap)
radial
color_map { myColorMap }
#else
color Sienna
#end
}
finish {
emission 0.10
diffuse 0.50
specular 0.10
roughness 0.10
phong 0.20
#if(!SimpleTexture)
reflection 0.20
#end
}
}
#if(!SimpleTexture)
interior {
ior 1.50
}
#end
rotate<0,0,0>
scale 1
translate< 0, dH, 0>
}
// --------------------------------------------------------------------------
// --- PLANE ----------------------------------------------------------------
// --------------------------------------------------------------------------
plane {
y, 0
pigment {
checker rgb 0.60, rgb 0.80
rotate -45*y
}
normal {
checker 0.50
rotate -45*y
}
finish {
emission 0.20
diffuse 0.80
reflection 0.30
}
}
La variable
transmitValue et la table de couleurs
myColorMap seront utilisées un peu plus loin.
Ce qui nous donne :