POV-Ray Buttons and Logos

Eric Bainville - Mar 2007

Button colors

In the following code, I restored the ambient light, and added textures for the button and its contents. I also added a torus as outer ring of the button. I rendered them in 48x48 with anti-aliasing on. The highlighted button corresponds to the activation of the frontal light.

  
#include "colors.inc"
#include "metals.inc"
#include "textures.inc"

global_settings {
  assumed_gamma 1        
  ambient_light White // Ambient light is back!
}

camera {
  orthographic 
  location <0,0,1000>
  right 2*x up 2*y direction -z
  // Uncomment to render a side view  
  // rotate 45*x
}

light_source { <-50,100,100>, White }  

// Uncomment to highlight the button
//light_source { <0,0,100>, White*0.6 }  

// Round button
#declare b_round = sphere {
  <0,0,-1>,1
  // Squash the sphere in Z
  scale <1,1,0.2>
}

// Rounded square button
#declare b_rsquare = superellipsoid {
  // Adjust first parameter: 1=circle, 0=square
  <0.2,0.15>
  translate -z scale <1,1,0.2>
}

// Hollow round button
#declare b_hround = difference {
  sphere { <0,0,-0.1>,1 }
  sphere { <0,0,1>,1 scale 1.4 }
  scale <1,1,0.2>
}

// Right arrow
#declare c_rarrow = prism {
  // Object extends in Z range 0..1
  0, 1,
  6, <-1,-1>,<-0.3,-1>,<1,0>,<-0.3,1>,<-1,1>,<0.3,0>
  rotate 90*x
  scale <0.6,0.6,1>
}

// Button finish
#declare f_button = finish {
  ambient 0.1
  diffuse 0.3
  specular 0
  phong 0.6 phong_size 20
}

// Content finish
#declare f_content = finish {
  ambient 0.7
  diffuse 0.3
  specular 0
  phong 0
}

// Outer ring and cylinder,
// cylinder is needed to block light when button is pushed down
#declare o_ring = merge {
  difference {
    cylinder { <0,0,0>,<0,0,-20>,1 }
    cylinder { <0,0,1>,<0,0,-21>,0.8 }
  }
  torus { 0.9,0.1 rotate 90*x }
}

// Button and its contents
difference {
  object { b_round
    texture { pigment { color Green } finish { f_button } } }
  object { c_rarrow translate <0.1,0,-0.1>
    texture { pigment { color White } finish { f_content } } }  
  scale <0.8,0.8,1>
  // Uncomment to render the down position
  // translate -0.2*z
}

// Ring
object { o_ring
  texture { Chrome_Metal }
  translate -0.2*z // Align with Z center of round button
}