Use POV-Ray with Blender
HowTo

From POV-Wiki
Jump to: navigation, search

Template:MoreDetails $$wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/POV-Ray#Standard_Script_Information Standard Script Information at the bottom of this page.

Contents

POV-Ray 3.7 Exporter for Blender 2.8x

POV-Ray is an an SDL based (Scene Description Language) rendering engine with a long history that makes it very stable and feature rich. The latest version of POV-Ray 3.7 can be found at: $$www.povray.org/download/
See the $$wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/POV-Ray/Installation Installation page for platform specific details on how to get, install or build POV-Ray.

Download

The POV-Ray exporter is shipped with every official Blender release, so you can start using it directly.

However, after checking the logs of $$developer.blender.org/diffusion/BA/history/master/render_povray/ every commit to the source of the script for new features or bug fixes, if you find out you need an update,

  • You can download all the script at once by clicking snapshot here:

$$git.blender.org/gitweb/gitweb.cgi/blender-addons.git/tree/refs/heads/master:/render_povray

  • or download a fresh blender build including scripts from generally a few days before here:

$$builder.blender.org/download/

Usage

Quick Start

1. Go to the menu {{#ifeq:|popup| Template:Menu/sep |}}{{#if:File|Template:Literal|}}{{#if:User Preferences|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}
2. Choose the {{#ifeq:|popup| Template:Menu/sep |}}{{#if:Add-Ons|Template:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}} tab and check POV-Ray 3.7 down the list of render Add-Ons.
3. Choose POV-Ray 3.7 from renderer choices. Then you can render as usual with the Template:Button render button or its shortcut (Template:Shortcut in default layout)
The image will be rendered according to parameters set in the Properties Window.

Main global render settings for instance can be changed in the {{#ifeq:|popup| Template:Menu/sep |}}{{#if:Render|Template:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}} tab.

But there are also properties for environment, material (textures), object, etc. all accessible in neighbouring tabs contextually depending on selected object (geometry, camera, light...)

POV-Ray Branches

Below is a comparison of some features of the two engines available to this exporter:


===== Feature/Engine/Support =====


===== POV-Ray =====


===== UberPOV =====


Full Spectral Resolution
no
yes (under development)
Supersampling
yes
yes
Alpha Mapping
yes
yes
Bump Mapping
yes
yes
Normal Mapping
no
no
Displacement Mapping
no
no
Motion Blur
no
yes
Sub Surface Scattering (SSS)
yes
yes
Volumetric Scattering (Medium)
yes
yes
Blurred Reflections
yes (very tricky)
yes
Clay Render
yes
yes
Depth of Field
yes
yes
Material Layering
yes
yes
Thin Film Coating
yes
yes
Dispersion
yes
yes
Anisotropy
no
no
Thin Film Interference
yes
yes
Complex IOR Files
no
no
Coating Thickness Absorption
yes
yes
Custom Reflectance 90
yes
yes
Custom Fresnel Curve
yes(tricky)
yes(tricky)
Sigma Texture
yes
yes
Sun-Pool Caustics
yes
yes
Ambient Occlusion
no (tricky)
yes (under developement)
Lens Shift
yes
yes
Diaphragm Circular/Polygonal
yes
yes
Per-Model Texture Coordinates
yes
yes
Texture Projection Modes
yes
yes
Front/Camera Mapping
yes(tricky)
yes(tricky)
Multiple UV Channels
no
no
Texture Tone Mapping
yes(tricky)
yes(tricky)
Procedural Textures
yes
yes
Texture Layering
yes
yes
Synthesis Texture Layering
yes
yes
Point Lighting
yes
yes
Mesh Lighting
yes
yes
Image-based Lighting
yes
yes
Physical Sun/Sky
yes(tricky)
yes(tricky)
HDRI Support
yes
yes
IES Support
no
no
Instance Support
yes
yes
Resume/Merge Render
yes
yes
Interactive Render
yes
yes
Vignetting / Bloom / Glare (Post)
yes(tricky)
yes(tricky)
Camera Response CRF (Post)
no
no
Color Balance (Post)
no
no
Multithreading
yes
yes
Region Rendering
yes
yes
Passive Emitter
yes
yes
Invisible Emitter
yes
yes
Invisible Model
yes
yes
Shadowless Model
yes
yes
Shadowless Point Lights
yes
yes
Bucket Rendering
yes
yes

Template:MoreDetails

Exported UI Properties

Render Properties

Radiosity

In POV-Ray, Radiosity is diffuse inter-reflection which has nothing to do with vertex color based radiosity. In fact, it is more similar to final gathering of irradiance samples and provides a noise free indirect light.

Some presets to radiosity are included, their names and settings are those of the rad_def include file shipped with POV-Ray, they set up the properties so you don't need to include the rad_def.inc in the exported pov, it's one of the many examples of what an interface like blender can bring to all POV-Ray users who are not used to have one.

$$wiki.povray.org/content/HowTo:Use_radiosity More details on POV-Ray Wiki

Anti-aliasing

Three sampling methods are supported:

  • non-recursive
  • recursive
  • stochastic (Monte-Carlo)

The third is only available for UberPOV

Sampling depth

Values must be comprised between 1 and 9. Higher values increase render time and may even introduce some undesired blur.

Anti-alias threshold

In the simple, non-recursive method, POV-Ray initially traces one ray per pixel. If the color of a pixel differs from its neighbours (to the left or above) by at least the set threshold value, then the pixel is super-sampled by shooting a given, fixed number of additional rays. The default threshold is 0.3 but it may be changed using this Antialias_Threshold=n.n option.

$$wiki.povray.org/content/Reference:Tracing_Options#Anti-Aliasing_Options More details on POV-Ray Wiki

Template:NiceTip

Bounding method

Also called acceleration, it is set to automatic BSP (Binary space partitioning) by the exporter as it's generally the most efficient(POV-Ray 3.7 only) but other acceleration methods are available in POV-Ray.

$$wiki.povray.org/content/Reference:Tracing_Options#BSP_Bounding More details on POV-Ray Wiki

Command line switches

Some command line arguments can be passed to POV-Ray. Arguments are separated by spaces. Command line switches consist of a / (Slash), + (plus) or - (minus) sign, followed by one or more alphabetic characters and possibly a numeric value.

$$wiki.povray.org/content/Category:Command-Line_and_INI-File_Options More details on POV-Ray Wiki

Some Commonly Used Commands
-D Hide image while rendering

Use the command line switch -D to not show the rendered image in POV-Ray (slightly faster and lighter on memory). The image will be sent back to Blender after completion (on Linux this is a hidden default switch to avoid OS specific editor problems).

+WT Limit the number of threads used

+WT1 limits POV-Ray to using only one single render thread. (Likewise, +WT2 would instruct POV-Ray to use two render threads.)

+C Continue an interrupted render

+C for "Continue trace" is able to recover the point at which your last render stopped and continue it from there (even if you switched off your computer)

/EXIT Close POV-Ray after rendering the image

There is also an option in POV-Ray for windows interface to do the same:

The "On Completion" option to "Exit POV-Ray for Windows" (in the Render Menu).


Template:NiceTip

Formatting

The exported POV-Ray file can be customized:

  • Different indentation characters to choose from.
  • Option to add comments to POV-Ray file.
  • Option to write long lists of coordinates in one line for easier browsing of the POV file (and slightly faster parsing by the renderer)


Scene Properties

Color Management

sRGB is supposed to be always used currently (except for world colors which seem to still be linear in Blender Internal).

World Properties

Background

Blender World gets exported

  • As POV-Ray "background{}" if flat colored
  • Using Blender's Blend Sky options triggers its export as a POV-Ray "sky_sphere{}"

Using a World Preset such as Clear Blue Sky can also setup scattering media to a natural looking atmosphere.

(sky texture currently appears a little different because of its mapping).


Atmospheric Media

(to create volume lights):

  • Number of samples for media calculation
  • Atmospheric media color


Object Properties

Importance sampling

It is a priority value between 0 and 1 that can be set per object in the Object properties tab for Radiosity to shoot more rays at object that require them most. Touch this rather carefully when trying to improve render times.

Data Properties

The script exports Sky, Lights, Hair particles, Smoke, fluids, Meshes, Blobs (MetaBalls).

Camera

Depth of Field

It has to be enabled for below property to act:

The focal point of depth of field is based on Blender UI Distance field, or object field.

Aperture

sets the blur amount. (increase to get more)


Perturbation

Normal map for camera plane, native POV procedural patterns can be used with variable

  • strength
  • turbulence
  • scale


Lamp

  • No Shadows toggle button can be used to deactivate tracing of shadows for specific lamps only

Template:NiceTip

Smoke

  • A DF3 file (POV-Ray voxel format) is exported and used with a POV-Ray media container with the same dimension and resolution as Blender smoke Domain



Hair

  • A union of POV-Ray sphere_sweep is exported and used for each strand.
  • They can take the color of a texture applied to emitting object,
  • and shape of sphere sweep tries to emulate shape of strands.


Material Properties

Emission

Template:NiceTip


SSS / SSLT

Note that SSS in POV-Ray (called SSLT) is very sensitive and will give different results if the mesh normals are smooth shaded or flat.

Translucency

Illumination from the back of a surface.

$$wiki.povray.org/content/Reference:Finish#Diffuse More details on POV-Ray Wiki

IOR Mirror

This option is for using one consistent IOR for raytrace reflection and refraction and not breaking the law of conservation of energy between the two.

Iridescence

(Newton's thin film coating)

Caustics

  • Chromatic dispersion for refractive caustics
  • Fast fake caustics (somewhat like Blender Raytransp)
  • Refractive caustics using photons
  • Reflective caustics using photons (high IOR or no mirror IOR for easier effect.)


Template:NiceTip

shaders

Emulation is attempted from blender for:

  • Specular and diffuse toon (no edges yet)
  • Phong and Cook Torrence (both the same)
  • Blinn (not perfectly matched)
  • WardIso
  • Fresnel and Minnaert, started but not finished yet


Template:NiceTip

Texture Properties

UV coordinates

best with planar projection for now. (Silvio Falcinelli)

Texture channels

Texture influences currently exported are: Alpha ; Diffuse ; Bump ; Specular ; Mirror (uses same channel as specular) --(No other channel because of POV-Ray non uniform syntax for them)

Custom gamma

For image textures (read POV-Ray 3.7 doc before using since it generally needs not be used.)

$$wiki.povray.org/content/Documentation:Tutorial_Section_3.3#Gamma_Handling More details on POV-Ray Wiki


Template:MoreDetails

Custom POV Code

POV-Ray files are not just pure data files (unlike with most other renderers). They are programs, with loops, functions, etc. This means that no matter how many features this exporter could support, POV-Ray will always have much more under the hood.

Video Tutorial

Here is a demonstration of the exporter by SMcA. This video is currently being worked on and may get replaced in the future.

<youtube>PD4PmGLMyys</youtube>

Step by step

You can add custom POV code directly in Blender's text editor, all you have to do is to make sure this pov code has directly or indirectly a #declare keyword, followed by the name of your choice and the pov item you want to use. (Current POV syntax is closer to C than Python, so anything that follows two slash character ( // ) is a comment)

Adding POV code directly

Pov items can be anything but for now only the equivalent of Blender materials can be replaced with this method. In Povray, it is called texture {} don't get confused, it really includes all the material properties.

Though you can directly specify a texture {} block in POV-Ray files, the #declare directive allows to assign it to a variable and reuse it more easily. The exporter makes use of this feature by default, so you won't be able to use your custom texture, unless you declare it. Here is an example:

#declare MyTexture =
texture{
    pigment{
        brick color rgb< 0.99, 0.99, 0.99>  // color mortar
        color rgb< 0.75, 0.5, 0.30>*0.75  // color brick
        brick_size <0.25, 0.0525, 0.125> // format in x ,y and z- direction
        mortar 0.01                      // size of the mortar
        scale 3
    } // end of pigment
    normal {wrinkles 0.75 scale 0.01}
    finish {ambient 0.15 diffuse 0.95 phong 0.2}
    rotate<0,0,0>  translate< 0.01, 0.00, 0.00>
} // end of texture
1. Navigate the text window menu to display the text properties {{#ifeq:|popup| Template:Menu/sep |}}{{#if:View|Template:Literal|}}{{#if:Properties|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}
2. In the text view properties option, you can chose to render 3d view and/or text. Enable Both.
3. Syntax highlight detects pov/inc/mcr/ini extensions.
4. Some complete POV-Ray scenes are available to Templates menu from the text header.
5. And an Insert Menu to add just some pov code snippets at cursor's location.
6. Then you have to go into the material properties to the Template:Button field, and just type in the name of your declared item to use: MyTexture in the example Given. Then you can render your image normally and the material will be replaced.


Blender and POV-Ray do not have the same coordinates systems: POV is Y up while Blender is Z up, so it is to be expected that text generated content is not turned the same as exported UI items since the exporter adds a transform matrix to all exported entities. So if you want to specify orientations more intuitively by looking at the interface, some transforms have to be specified at the end of your custom blocks, for instance as follows :

scale <-1, 1, 1>
rotate <90, 0, -90>
}

Adding POV code from include files

In any Povray scene you can use the #include directive to add items from an external Povray file. It's like the import function in Python. The files to be included have .inc as their name extension. Then in the replacement field, you can type in any of the declared names available in the include file. "Out of the box", Povray ships with a lot of include files. So you can use them for your textures, but you can also use them for some of their elements. For instance a very often used include file is one that allows to call colors by their names instead of numbers called colors.inc, so the previous example could also be written:

#include "colors.inc"
#declare MyTexture =
texture{
    pigment{
        brick color White*0.99  // color mortar
        color rgb< 0.75, 0.5, 0.30>*0.75  // color brick
        brick_size <0.25, 0.0525, 0.125> // format in x ,y and z- direction
        mortar 0.01                      // size of the mortar
        scale 3
    } // end of pigment
    normal {wrinkles 0.75 scale 0.01}
    finish {ambient 0.15 diffuse 0.95 phong 0.2}
    rotate<0,0,0>  translate< 0.01, 0.00, 0.00>
} // end of texture

Some other POV-Ray specific objects are also available: In POV-Ray a triangle mesh is just one primitive among many. You can explore the POV-Ray language by modifying the output file. and with the same method, add these primitives by hand, OR you can just pick some from the Template:Button menu.

POV-Ray Primitives

Pressing Template:Shortcut in the 3D View Allows you to add POV-Ray specific objects in addition to native Blender objects

File:exporterAddMenu.png

They are mathematically defined as opposed to Triangle meshes. The sphere, torus, cylinder or cone side will always be round and smooth when rendered, no matter how close you get, and regardless of their appearance in the 3D view, which is only a proxy.


These objects are the type of objects that get created when you import a POV-Ray file, so that ideally, you could "exchange" data back and forth between POV-Ray and Blender.

Infinite Plane

The rendered plane is actually infinite, but represented by a proxy in the 3D view, which is just very big, but still finite. Please report if you'd rather have a différent default scale.

File:PovInfinitePlane1.png|File:PovInfinitePlane2.png


$$wiki.povray.org/content/Reference:Plane More details on POV-Ray Wiki

Box

Based on a mesh cube the object can be transformed using move/rotate/scale

File:PovBox.png


$$wiki.povray.org/content/Reference:Box More details on POV-Ray Wiki

Sphere

The sphere has a radius parameter, a location and a scale.

File:PovSphere1.png|File:PovSphere2.png


$$wiki.povray.org/content/Reference:Sphere More details on POV-Ray Wiki

Cylinder

In POV-Ray, cylinders are defined by radius, base point and end point. For convenience, move/rotate/escale can be used to the same effect.

File:PovCylinder1.png|File:PovCylinder2.png


$$wiki.povray.org/content/Reference:Cylinder More details on POV-Ray Wiki

Cone

Cones have a basis radius and end radius

File:PovCone1.png|File:PovCone2.png


$$wiki.povray.org/content/Reference:Cone More details on POV-Ray Wiki

Torus

Torus has a main radius and a section radius.

File:PovTorus1.png|File:Torus2.png


$$wiki.povray.org/content/Reference:Torus More details on POV-Ray Wiki

Parametric

This is a surface generated from the combination of three mathematical equations

$$wiki.povray.org/content/Reference:Parametric More details on POV-Ray Wiki

Rainbow

The rainbow is a view dependant effect

File:PovRainbow1.png|File:PovRainbow2.png


$$wiki.povray.org/content/Reference:Rainbow More details on POV-Ray Wiki

Lathe

This object behaves like the Blender screw modifier to create surfaces by revolving a spline except instead of being tesselated beforehand, it follows the mathematical curvature of the spline so you won't see any polygons no matter how close you zoom.

File:PovLathe1.png|File:PovLathe2.png


$$wiki.povray.org/content/Reference:Lathe More details on POV-Ray Wiki

Prism

This is a POV-Ray primitive that simply extrudes a shape

File:PovPrism.png


$$wiki.povray.org/content/Reference:Prism More details on POV-Ray Wiki

Superquadric Ellipsoid

A quite versatile tool that can provide quick models for cushion or star shaped objects

File:PovSuperquadricEllipsoid.gif
File:PovSuperquadricEllipsoid2.gif


$$wiki.povray.org/content/Reference:Superquadric_Ellipsoid More details on POV-Ray Wiki

HeightField

This is a displacement of a surface following a texture. Tessellation also happens at render time, so you don't need to subdivide anything before.

File:PovHeightField1.png|File:PovHeightField2.png


$$wiki.povray.org/content/Reference:Height_Field More details on POV-Ray Wiki

SphereSweep

This POV-Ray primitive sweeps a sphere a long as spline to create an interpolated form that can have variations of radius along the spline. It is also used to export hair strands.

File:PovSphereSweep1.png|File:PovSphereSweep2.png


$$wiki.povray.org/content/Reference:Sphere_Sweep More details on POV-Ray Wiki

BlobSphere

Like Blender Metaballs

File:PovBlob1.png|File:PovBlob2.png|File:PovBlob3.png


$$wiki.povray.org/content/Reference:Blob More details on POV-Ray Wiki

Isosurfaces

In POV-Ray isosurfaces are objects that can combine and be deformed using pigments or equations

$$wiki.povray.org/content/Reference:Isosurface More details on POV-Ray Wiki

Isosurface Box

An isosurfacecomponent shaped as a box

Isosurface Sphere

An isosurfacecomponent shaped as a sphere

Supertorus

An isosurface shaped as a torus with deforming parameters equivalent to those of the superellipsoid.

Parameters (POV-Ray names):

  • MajorRadius, MinorRadius = Base radii for the torus.
  • MajorControl, MinorControl = Controls for the roundness of the supertorus. Use numbers in the range [0, 1].
  • Accuracy = The accuracy parameter.
  • MaxGradient = The max_gradient parameter.

Macro based primitives

Two primitives are actually macros that generate a mesh from curves before render time:

  • Polygon to Circle Blending
File:PovPolyToCircle1.png|File:PovPolyToCircle2.png


  • Loft
File:PovLoft1.png|File:PovLoft2.png


Importing POV-Ray files

1. From the same Template:Shortcut menu, you can also import povray files
2. Or otherwise, clicking {{#ifeq:|popup| Template:Menu/sep |}}{{#if:File|Template:Literal|}}{{#if:Import|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}}{{#if:|Template:Menu/sepTemplate:Literal|}} from the main header menu
3. You can then select one or several files (holding Template:Shortcut or pressing Template:Shortcut for drag box selection

Template:MoreDetails

Standard Script Information

Template:ScriptInfo

Personal tools
Namespaces
Variants
Actions
Content
Other Pages
Toolbox