Download: hopf.pov

 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#version version;
#include "colors.inc" 
#include "rad_def.inc"

//----------------------------------------------------------------------------------------------------------
//					modify this to get a different picture
//----------------------------------------------------------------------------------------------------------
#declare S = seed(16411); //seed for the random generator. Change this to get your very own unique image !
#declare base=<255, 153, 51>/255; //random colors are generated from this one
#declare r_tube = 0.08;  // thickness (radius) of tube
#declare bgcolor=SkyBlue; //color of the background plane
#declare nbcircles=50; // number of circles to be drawn
//----------------------------------------------------------------------------------------------------------

background { color Black}

global_settings { assumed_gamma 1.0


//Replace LQ by HQ for higher quality (but much slower rendering)
radiosity {
	      Rad_Settings(Radiosity_IndoorLQ ,off,off)
	         }
	 }

camera
  {
  location <0.2, -0.1, -3.5>
  right x*image_width/image_height up <0,1,0>
  look_at  <0.0, 0.0, 0.0>

  //blurry out of focus effect for strands close to the screen
  focal_point < 0, 0, 0>
  aperture 0.08
  blur_samples 20
  angle 60
  }



light_source
  {
  2*<5, 10, -40>
  color White
 
 //area_light produces a nice smooth shadow but is resource consuming. 
 //Change the 20's to a lower value (e.g. 5) for faster rendering
 
  area_light <5, 0, 0>, <0, 5, 0>, 20, 20   
  adaptive 1
  }


plane //background plane
  {
  <0,0,1>, 2
  pigment { color bgcolor }
  finish
    {
    ambient 0.0
    diffuse 0.5
    }
}
#declare plastic= texture{ //plastic-like texture
	finish {
	ambient 0.0
	emission rgb base*0.6
	diffuse 0.3
	specular 0.2
	roughness 0.1
	reflection {0.0 metallic}
   	}
    	normal {
                        bumps 0.05 scale 0.05 
        }
}
//main loop. The formulas for the Hopf fibration are brutally hard coded.
union {
#declare it=0;
#while (it<=nbcircles) //nb of circles
	#declare c=rand(S)*1.3+0.1;
	#declare b=rand(S)*6.28;
	#declare a=0;
	#declare col= base/3+ 2*<rand(S), rand(S),rand(S)>/3;
	#while(a <= 13) //the standard to draw curves in Povray is by drawing a bunch of spheres
	      sphere{< cos((a+b)/2)*sin(c)/(1-cos(c)*sin((a-b)/2)),sin((a+b)/2)*sin(c)/(1-cos(c)*sin((a-b)/2)),
	      				cos((a-b)/2)*cos(c)/(1-cos(c)*sin((a-b)/2))>,r_tube
			 texture {plastic

				pigment {color rgb col}
		}

	      }
	      #declare a=a+0.001;
      #end
      #declare it=it+1;
#end
scale 0.4}