Posts

Titling Made Simple

Titling is an important part of any animation. Well-done titling adds a touch of professionalism to your work. There are a lot of instances in which you will want to have some kind of titling in your POV-Ray scenes. There are two approaches you can employ to add titling: In-scene titling and post-processed titling. In-scene Titling The first approach has the advantage that it requires only one render. Its disadvantages are: The artist has to make sure that the other scene elements do not obscure the titling; If the titling is changed then the scene has to be entirely re-rendered; The method does not work well (if at all) in scenes where there is a camera effect in place (such as focal blur). In my earlier post about the main scene file , I invoke the scenery file and the titling file separately, so that the scenery file can specify the basic camera parameters, and the latter file can use these settings to place the titling exactly where it needs to be to appear in the re

A Simple Button Macro

If your animations include a lot of science fiction work, or other instances where a push button is part of the scene, this short macro will do a bit of the work for you. #macro RoundButton(pB, pT, rB, rE, dD, fM) #local hB = vlength(pT - pB); #local vY = vnormalize(pT - pB); #local vX = vnormalize(vcross(vY, <vY.y,vY.z,-vY.x>)); #local vZ = vnormalize(vcross(vX, vY)); #if (fM) merge #else union #end { #if (dD < 0) #local rD = (2 * rB * rE - rB * rB - rE * rE - dD * dD) / 2 / dD - rE; difference { lathe { 5, <0,0>, <rB,0>, <rB, hB - rE>, <rB - rE, hB - rE>, <0, hB + rD + dD> } sphere { y * (hB + rD + dD), rD } bounded_by { cylinder { 0, y * hB, rB } } } #elseif (dD > 0) #local hB = hB - dD; #local rD = (rB * rB + rE * rE + dD * dD - 2 * rB * rE) / 2 / dD + rE; intersection { lathe { 6, <0,0>, <rB,0>, <rB, hB - rE>, <rB - rE, hB - rE>, <

Motion Paths

A lot of animation involves moving either a character or the camera along a path through the scene, and so I'll provide a set of macros for defining a path. Some Helper Macros To make the code that follows a lot neater, I'll be using the following helper macros: #macro LinePoly(sVariable, sConstant, sLinear) (sLinear * sVariable + sConstant) #end #macro QuadPoly(sVariable, sConstant, sLinear, sQuadratic) ((sQuadratic * sVariable + sLinear) * sVariable + sConstant) #end #macro CubePoly(sVariable, sConstant, sLinear, sQuadratic, sCubic) (((sCubic * sVariable + sQuadratic) * sVariable + sLinear) * sVariable + sConstant) #end Continuity As with the macros that I provided in the last article, a motion path can have multiple levels of continuity, some of which are only necessary for specific applications. C 0 Continuity The minimal level of continuity is C 0 , which means that there are no open gaps in the path, but otherwise the motion is as simple as possible. The

Transition Macros

As part of my animation work I have a set of macros which simplify moving objects from one location to another, or in some other way allow me to transition an object from one state to another. Linear Changes There are going to be times when you want to fade a scene to black or from black, or fade between two scenes. You will want things to be at a starting state up until the motion or change begins, and for it to be at a certain place when the motion ends, and for it to stay there, and for the movement in between those times to occur at a steady rate. When that is the case, a macro like the following will come in handy: #macro Transition(tNow, tStart, pStart, tEnd, pEnd) #if (tNow <= tStart) (pStart) #elseif(tNow >= tEnd) (pEnd) #else (pStart + (pEnd - pStart) * (tNow - tStart) / (tEnd - tStart)) #end #end Call this macro with the parameters set to the following values: tNow : Set this to the current time of the animation (or the time for which you

Star Field Generator

A lot of POV-Ray users are fans of science fiction, and for this reason will want to create scenes set in space, or if not a fan of science fiction will want an appropraite background for scenes set at night. Whatever the reason, a method for adding a starry backdrop to a scene is a useful addition to your POV-Ray library. A lot of the attempts that have been released make use of a POV-Ray texture, usually a marble pattern that is mostly black with with just enough white (or other light colors) to create the appearance of stars against a black background. This works because it uses the pattern as essentially a random number generator, with a high threshold for turning a pixel on. This can work but for animation work it has several drawbacks: A pattern that generates a scattering of stars at one resolution will have different results at another resolution, most likely fewer stars at lower resolutions, and bands of white matching the underlying pattern used to simulate the effect at

Using ffmpeg

ffmpeg is a utility that can manipulate audio and video files in a large number of ways. For animators, its primary use is to take still images and generate a video file from them. There are some GUI video encoders that are a GUI front end bundled with ffmpeg, but ffmpeg is a command-line utility. I'll describe the command line options that I use when making my animations. As I've said in earlier posts, I am not yet working with sound in my animations, and so I haven't explored the options required for including sound in a video file. The command line I use a .BAT file to run ffmpeg, to avoid having to type out the same command line over and over. Here is the command line that I use for creating the final animation from all of the sets of generated frame files: "C:\Program Files\ffmpeg\bin\ffmpeg" -f concat -safe 0 -i framelist.txt -r 24 -y -c:v libx264 -pix_fmt yuv420p final.mp4 Here is what each term does, in order of its appearance in the command line: &

My Main Scene File

For every animation project I have just one .POV file, and this file will reference all of the other files needed for the animation. I generally name the file main.pov ; each animation project has its own folder, so there's little potential for confusion. The file basically does four things. Read and interpret the render settings POV-Ray exposes several of the rendering parameters to the scene description language (SDL). I used them to set up the camera and other scene-level aspects of the render: Shot : POV-Ray allows the user to pass variables from the command line to the SDL. I use this to specify which shot is being rendered. There's no fall-back code so that things will fail noisily if I forget to set them in the .INI file. Test : I also pass a simple 0 or 1 to indicate whether I an running a test render or a final render. If for some reason I've left this out of the .INI file then I supply a default: #ifndef(Test) #declare Test = 1; #end Time : If th