Skip to content

Instantly share code, notes, and snippets.

@patrickdown
Created September 21, 2016 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickdown/a17325247ae08edd65b8968a396d6855 to your computer and use it in GitHub Desktop.
Save patrickdown/a17325247ae08edd65b8968a396d6855 to your computer and use it in GitHub Desktop.
You can use this POV scene to make cube map. This is done by using the POV animation clock to create a 6 frame animation where the camera points each axis in the positive and negative directions.
// ==================================================================
// Persistence of Vision Ray Tracer Scene Description File
//
// You can use this POV scene to make cube map. This is done
// by using the POV animation clock to create a 6 frame animation
// where the camera points each axis in the positive and negative
// directions.
// ==================================================================
//
// POV will need an INI entry to define size, antialiasing
// and most importantly how many frames to render. It's also
// important that the image be square.
//
// [1024x1024, AA 0.1, Cubemap]
// Width=1024
// Height=1024
// Antialias=On
// Antialias_Threshold=0.1
// Final_Frame=6
// Final_Clock=5
//
// To use as a Unity skybox associate the image files
// like this.
//
// Image 1 - Up
// Image 2 - Left
// Image 3 - Down
// Image 4 - Right
// Image 5 - Back
// Image 6 - Front
//
#include "colors.inc"
#include "math.inc"
// Change the camera location and direction
#declare CameraLocation = <0, 0, 1>;
#declare CameraDirection = y;
#declare CameraUp = z;
// Leave these alone
#declare CamPlusZ = CameraDirection;
#declare CamPlusX = VPerp_To_Plane(CameraUp, CameraDirection);
#declare CamPlusY = VPerp_To_Plane(CamPlusZ, CamPlusX);
#declare CubeCamDir = array[6] { CamPlusZ, CamPlusX, -CamPlusZ, -CamPlusX, CamPlusY, -CamPlusY}
#declare CubeCamUp = array[6] { CamPlusY, CamPlusZ, -CamPlusY, CamPlusZ, CamPlusZ, CamPlusZ}
#declare CubeCamRight = array[6] { CamPlusX, CamPlusY, CamPlusX, -CamPlusY, -CamPlusX, CamPlusX}
camera {
location CameraLocation
direction CubeCamDir[clock]
up CubeCamUp[clock]
right CubeCamRight[clock]
angle 90
}
// ==================================================================
// Redefine the scene however you want
// ==================================================================
light_source {
< 0, 0, 0>
White
}
#for (Ang, -170, 170, 10)
#declare CAng = cos(Ang * 3.1415927 / 180);
#declare SAng = sin(Ang * 3.1415927 / 180);
torus { CAng * 100.0, 0.1
texture { pigment{ color Gray50 }
finish { ambient 1 }
} // end of texture
translate<0,SAng * 100,0>
sturm
} // end of torus
#end
#for (Ang, 0, 170, 10)
torus { 100.0, 0.1
texture { pigment{ color Gray50 }
finish { ambient 1 }
} // end of texture
rotate<90,Ang,0>
sturm
} // end of torus
#end
sphere { <0,0,0>, 17.25
texture {
pigment{ color Gray50 }
finish { ambient 1 }
} // end of texture
translate<0,100,0>
} // end of sphere
sphere { <0,0,0>, 17.2
texture {
pigment{ color Gray10}
finish { ambient 1 }
} // end of texture
translate<0,-100,0>
} // end of sphere
#declare PointPos = array[12] {
<1,1,0>, <-1,1,0>, <-1,-1,0>, <1,-1,0>,
<0,1,1>, <0,-1,1>, <0,-1,-1>, <0,1,-1>,
<1,0,1>, <-1,0,1>, <-1,0,-1>, <1,0,-1>
}
#declare PointColor = array[12] {
<0,0,0>, <0,0,1>, <0,1,0>, <0,1,1>,
<1,0,0>, <1,0,1>, <1,1,0>, <1,1,1>,
<0,0,.7>, <0,.7,0>, <0,.7,.7>, <.7,0,0>
}
#for (Idx, 0, 11)
sphere { PointPos[Idx]*100, 1.0
texture {
pigment{ color PointColor[Idx] }
finish { ambient 1 }
} // end of texture
} // end of sphere
#end
background { Gray15 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment