How to use POV-Ray to draw a cylinder

The Persistence of Vision Raytracer, commonly known as POV-Ray, is a 3D graphics tool.

The cylinder is one of the most commonly used shapes. In this Answer, we'll learn how to draw a cylinder object using POV-Ray.

Implementation

The demo code used to draw a cylinder is as follows:

#version 3.7;
#include "colors.inc"

background { color White }

camera {
  location <0,-6,-6>
  look_at  <1,1,1>
}

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


cylinder {
    <0, 3, 0>,     // Center of one end
    <3, 4, 5>,     // Center of other end
    1.5            // Radius
    open           // Remove end caps
    texture {
    pigment {
      image_map {
        png "cylinder-map.png"
        map_type 1
      }
    }
    finish { ambient 0.3 diffuse 0.5 specular 0.2 }
  }
  }
How to draw a cylinder in POV-Ray

Explanation

  • Lines 1–4: We include the required libraries and set up the background color to white.

  • Lines 6–9: A camera statement is added to visualize the scene defining the location and Look-at with x, y, and z coordinate values.

  • Lines 11–14: The light_source statement is introduced to add light to the scene.

  • Lines 17–31: The cylinder statement is implemented with the center of the one end as the first parameter, the center of the other end as a second parameter, radius as the third parameter, and open to draw open edges as the fourth argument.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved