// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-12-08 11:44:48 by jstolfi #version 3.6; // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.65, 0.60, 0.35 > } #declare tx_purple = texture{ pigment{ color rgb < 0.600, 0.300, 0.600 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_silver = texture{ pigment{ color rgb < 0.80, 0.80, 0.80 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_black = texture{ pigment{ color rgb < 0.10, 0.10, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // DESCRIÇÃO DA CENA #declare body = sphere { <0.00, 0.00, 0.00> 1.00 texture { tx_purple } } #include "eixos.inc" #macro virus(N) union{ object { body } tentaculo_aleatorio(N, 25, <0, 0.85, -0.30>, <0, 3, 0>, 0.3, 0) tentaculo_aleatorio(N, 145, <0, -0.85, -0.30>, <0, -4, 0>, 0.3, 0) tentaculo_aleatorio(N, 151, <0, -0.55, -0.60>, <0, -2, -3>, 0.3, 0) tentaculo_aleatorio(N, 386, <0, 0.55, -0.60>, <0, 2, -3>, 0.3, 0) tentaculo_aleatorio(N, 494, <0, -0.25, -0.90>, <0, -1, -4>, 0.3, 0) tentaculo_aleatorio(N, 777, <0, 0.25, -0.90>, <0, 1, -4>, 0.3, 0) segmento(N, <0, 0.70, 0.70>, <0, 0.85, 0.70>, <0, 0.85, 2>, <0, 0.85, 2>, 0.3, 0) segmento(N, <0, -0.70, 0.60>, <0, -0.85, 0.70>, <0, -0.85, 2>, <0, -0.85, 2>, 0.3, 0) } #end #macro interpola1(tt, tt0, tt1, vv0, vv1) #local rr = (tt - tt0)/(tt1 - tt0); #local vv = (1 - rr)*vv0 + rr*vv1; vv #end #macro interpola3(tt, tt0, tt3, vv0, vv1, vv2, vv3) #local vv01 = interpola1(tt, tt0, tt3, vv0, vv1); #local vv12 = interpola1(tt, tt0, tt3, vv1, vv2); #local vv23 = interpola1(tt, tt0, tt3, vv2, vv3); #local vv012 = interpola1(tt, tt0, tt3, vv01, vv12); #local vv123 = interpola1(tt, tt0, tt3, vv12, vv23); #local vv0123 = interpola1(tt, tt0, tt3, vv012, vv123); vv0123 #end #macro segmento(N, P0, P1, P2, P3, R0, R3) #local tt = 0.1; #local T1 = N/10; union{ sphere{ P0, R0 texture {tx_purple} } #while (tt < T1) sphere{ interpola3(tt, 0, T1, P0, P1, P2, P3), interpola1(tt, 0, T1, R0, R3) texture {tx_purple} } #local tt = tt + 0.1; #end } #end #macro tentaculo(N, A0, A1, A2, B1, B2, C1, C2, C3, RA0, RC3) #local A3 = (A2 + B1)/2; #local B3 = (B2 + C1)/2; #local RA3 = interpola1(1/3, 0, 1, RA0, RC3); #local RB3 = interpola1(2/3, 0, 1, RA0, RC3); segmento(N, A0, A1, A2, A3, RA0, RA3) segmento(N, A3, B1, B2, B3, RA3, RB3) segmento(N, B3, C1, C2, C3, RB3, RC3) #end #macro tentaculo_aleatorio(N, smt, A0, C3, RA0, RC3) #declare roleta = seed(smt); #local A1 = interpola1(1/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); #local A2 = interpola1(2/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); #local B1 = interpola1(4/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); #local B2 = interpola1(5/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); #local C1 = interpola1(7/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); #local C2 = interpola1(8/9, 0, 1, A0, C3) + (-1 + 2*rand(roleta)); tentaculo(N, A0, A1, A2, B1, B2, C1, C2, C3, RA0, RC3) #end // Aqui está a cena, finalmente: union{ // object{ eixos(3.00) } //segmento(100, <0.00, 0.00, 0.00>, <0.00, 0.00, 1.00>, <0.00, 3.00, 2.00>, <0.00, 3.00, 3.00>, 0.30, 0.20) //tentaculo(100, <0, 0, 0>, <0, 0, -1>, <0, -3, -2>, <0, -3, -3>, <0, -4, -3>, <0, -4, -4>, <0, -5, -4>, <0, -5, -5>, 0.3, 0) //tentaculo_aleatorio(100, 25, <0, 0, 0>, <0, -6, -3>, 0.3, 0) virus(100) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 5.7; #declare dir_camera = < 10.00, 1.00, 1.00 >; #declare dist_camera = 12*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)