IsoCSG Library

Section Content:

The IsoCSG Library

POV-Ray offers very powerful CSG functions to design objects, but an often requested feature, bending and other nonlinear transformations is not possible for principal reasons. See external linkWarp's FAQ for an explanation.

The new isosurface shape can overcome this limitation since in contrast to other shapes the intersections are approximated and therefore arbitrary math functions can be used for defining the surface.

But designing isosurface functions requires some math knowledge. This include file should help to reduce this requirement.

Anyway isosurfaces are still more difficult to handle than native CSG and furthermore they can be quite slow with complicated functions so be careful when using them.

POV-Ray 3.5 is required for using this include file.

For MegaPOV 1.0 there is a specially adapted version of the file that will improve performance of the sor and triangle shapes by using internal MegaPOV functions. The plain version 0.7 of the IsoCSG library works with MegaPOV too.

An example translation:

native CSG version IsoCSG version

difference {
  box { <-1-1-1><110> }

  merge {
    cylinder { 02*x0.3 }
    sphere { 00.3 }

    rotate 45*z

  translate 0.5*z
  scale 0.9


#declare fn_Shape=
IC_Transform (
  IC_Difference2 (
    IC_Box (<-1-1-1><110>),
    IC_Rotate (
      IC_Merge2 (
        IC_Cylinder (02*x0.3),
        IC_Sphere (00.3)
  transform {
    translate 0.5*z
    scale 0.9

Note that fn_Shape is a user defined function that can be used in an isosurface object. Various sample scenes can be found in the package.