|
Mise à jour : 01/07/2010
525 visites depuis 7 jours,
dont 10 sur ce chapitre
classé 218/786
|
Vous savez donner un motif à un objet. Mais ici, on ne va pas utiliser les pigments comme ça...
Incroyable, n'est-ce pas ?
1 2 3 4 5 | #declare ma_fonction = function { pigment { // ... } } |
1 2 3 4 5 | #declare ma_fonction_wrinkles = function { pigment { wrinkles } } |
1 | ma_fonction_wrinkles(x,y,z).gray |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #declare wr = function { pigment { wrinkles } } #declare fn = function { x*x + y*y + z*z + 0.5*wr(x, y, z).gray - 1 } isosurface { function { fn(x, y, z) } contained_by { sphere { 0, 1.2 } } threshold 0 accuracy 0.000001 max_gradient 6 pigment { rgb 1 } } |
1 2 3 | #declare fn = function { x*x + y*y + z*z + wr(2*x, 2*y, 2*z) - 1 } |
1 2 3 4 5 6 7 8 9 | #declare wr = function { pigment { crackle pigment_map { [0.1 granite] [0.6 rgb 0] } } } |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #declare wr = function { pigment { crackle pigment_map { [0.1 granite] [0.6 rgb 0] } } } #declare fn = function { x*x + y*y + z*z + 0.2*wr(x, y, z).gray - 1 } isosurface { function { fn(x, y, z) } contained_by { sphere { 0, 1.2 } } threshold 0 accuracy 0.000001 max_gradient 10 pigment { crackle } } |

, mais on peut imaginer de nombreuses combinaisons entre la fonction de l'isosurface et le pigment utilisé pour la colorer...
. C'est justement ce que nous allons faire !

1 | (x² + y² + z² + a² - b²)² - 4 * a² *(x² + z²) = 0 |
1 | x² + z² - r² = 0 |
1 | pow(x, y) = x ^ y |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | plane { y, 0 pigment { color rgb <0.7,0.5,0.3> } } #declare pilier = union { difference { box { <-0.5,0,-0.5> <0.5,1,0.5> } torus { 0.7, 0.4 translate y } } cylinder { y, 3*y, 0.3 } pigment { rgb 1 } } #declare arche = union { object { pilier translate -1.5*x } object { pilier translate 1.5*x } difference { torus { 1.5, 0.3 rotate x*90 } box { <-5,-5,-5>, <5,0,5> } translate 3*y } pigment { rgb 1 } } object { arche } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #declare isopilier = union { difference { object { isocube } object { isotorus1 translate y } } object { isocylindre } pigment { rgb 1 } } #declare isoarche = union { object { isopilier translate -1.5*x } object { isopilier translate 1.5*x } difference { object { isotorus2 rotate x*90 } box { <-5,-5,-5>, <5,0,5> } translate 3*y } pigment { rgb 1 } } object { isoarche pigment { rgb 1 } } object { isoplane pigment { color rgb <0.7,0.5,0.3> } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #declare fGranite = function { pigment { granite } } #declare fWrinkles = function { pigment { wrinkles } } #declare isocube = isosurface { function { max(abs(x), abs(y), abs(z)) - 0.025*fGranite(x, y, z).gray - 0.5 } threshold 0 contained_by { box { -1.2, 1.2 } } accuracy 0.000001 max_gradient 10 all_intersections translate 0.5*y } #declare isotorus1 = isosurface { #declare a = 0.7; #declare b = 0.4; function { pow(pow(x, 2) + pow(y, 2) + pow(z, 2) + pow(a, 2) - pow(b, 2), 2) - 0.025*fGranite(x, y, z).gray - 4 * pow(a, 2)*(pow(x, 2) + pow(z, 2)) }//- fGranite(x, y, z).gray - 0.4*0.4 } threshold 0 max_gradient 10 all_intersections accuracy 0.000001 contained_by { sphere { 0, 1.3 } } } #declare isotorus2 = isosurface { #declare a = 1.5; #declare b = 0.3; function { pow(pow(x, 2) + pow(y, 2) + pow(z, 2) + pow(a, 2) - pow(b, 2), 2) + pow(0.05*fGranite(x, y, z).gray, 0.5) - 4 * pow(a, 2)*(pow(x, 2) + pow(z, 2)) }//- fGranite(x, y, z).gray - 0.4*0.4 } threshold 0 max_gradient 20 all_intersections accuracy 0.000001 contained_by { sphere { 0, 2 } } } #declare isocylindre = isosurface { function { pow(x,2) + pow(z, 2) + 0.025 * fGranite(x, y, z).gray - pow(0.3, 2) } threshold 0 max_gradient 10 all_intersections accuracy 0.000001 contained_by { box { <-0.5, 0, -0.5>, <0.5, 3, 0.5> } } } #declare isopilier = union { difference { object { isocube } object { isotorus1 translate y } } object { isocylindre } pigment { rgb 1 } } #declare isoarche = union { object { isopilier translate -1.5*x } object { isopilier translate 1.5*x } difference { object { isotorus2 rotate x*90 } box { <-5,-5,-5>, <5,0,5> } translate 3*y } pigment { rgb 1 } } #declare isoplane = isosurface { function { y - 0.3 * (0.2 * fGranite(3*x, 3*y, 3*z).gray + fWrinkles(x*2, y*2, z*2).gray) } threshold 0 contained_by { box { <-5, -0.5, -5>, <5, 0.5, 5> } } max_gradient 10 accuracy 0.000001 } object { isoarche pigment { rgb 1 } } object { isoplane pigment { color rgb <0.7,0.5,0.3> } } |
...
C'est normal !
)Il n'y a pas encore de commentaire pour ce tuto.