| This section examines the differences in syntax between
MegaPOV and POV-Ray v3.5 isosurfaces, and subtle differences in the ways
that they work.
|
MegaPOV |
POV-Ray 3.5 |
contained_by
The contained_by keyword is mandatory.
The braces after the type of container are optional - e.g. contained_by {sphere 0,1}
|
The contained_by keyword is optional.
If absent it defaults to contained_by {box{-1,1}}
The braces after the type of container are mandatory - e.g. contained_by {sphere {0,1}}
|
method
There are two methods for evaluating functions, selected by
method 1 or method 2
|
All functions are evaluated with the same method.
There is no method keyword.
|
eval
eval can be used if you don't know the max_gradient of the function.
It is possible to specify three parameters for eval, but these
parameters are not explained sufficiently for them to be useful.
|
evaluate
Three parameters are required.
This feature is currently in development, and its current operation does not
match the documentation.
POV 3.5 will display a suggested value for the max_gradient if it considers that
the value you have used is unsuitable, whether you use evaluate or not.
|
sign
An isosurface can be turned inside out by using
sign -1.
This is particularly useful with certain built-in functions which
are written in such a way that the inside is the opposite of
what would normally be expected. e.g.
function {"Bicorn" <1,1>}
threshold 0.1
sign -1
|
There is no sign keyword.
To turn an isosurface inside out you must negate the function
and negate the threshold. e.g.
function { - f_bicorn(x,y,z,1,1)}
threshold - 0.1
|
| unions and intersections
The | and & operators can be used
to create unions and intersections of functions
|
Those operators now perform logical OR and logical AND operations.
Unions and intersections are now performed by using min()
and max().
|
referencing #declared functions
If you #declare a function "F", you can reference it as just "F",
in which case "(x, y, z)" is assumed.
|
If you #declare a function "F", you must always include the three parameters, e.g. "F(x,y,z)".
|
built-in functions
The built-in functions are always available.
They look like function {"Sphere" <4>}
The names of the functions are not case specific.
To use a built in function in an expression you must #declare it first.
|
To use built-in functions, you must use
#include "functions.inc"
They look like function {f_sphere(x, y, z, 1)}
The names of the functions are case specific. They're all in lower case.
The functions can be used in expressions
|
operators with restricted ranges
You can use operators like square roots and logarithms outside their normal ranges.
E.g. you can use sqrt(x) and ln(x) without worrying
whether x might be negative at some points. The results are therefore technically
mathematically incorrect, but reasonably intuitive.
|
You can only use operators within the ranges where they are mathematically meaningful.
ln(x) and log(x) will cause the render to terminate with a floating point exception if x becomes zero or negative at any point.
sqrt(x) will cause the space to be filled with blackness wherever x is negative.
asin(x) will cause the space to be filled with blackness wherever x is greater than 1.
|
coincident surfaces
If part of an isosurface is coincident with another surface, it becomes invisible.
I use this quite often in this tutorial, adding a visible, partially transparent, copy of the
contained_by object so that you can see where the container is.
|
If part of an isosurface is coincident with another surface, the traditional coincident
surface artefacts appear.
In this tutorial I have made the contained_by surfaces open where
this was problematical. Fortunately, the open keyword causes much less
of a speed penalty than it does in MegaPOV.
|
| evaluating pigments
When you use a pigment as an isosurface function, the value is calculated from the red component
and the green component. The red component being more significant.
|
When you use a pigment function in an isosurface, you must specify which component of the
colour is to be used, e.g. MyPigmentFn(x,y,z).red. The possible components
are .red, .blue, .green, .filter, .transmit, .grey and .hf. The .hf component is the same
as MegaPOV, but is considered an experimental feature.
|
| power operator
MegaPOV supports the "^" operator.
|
In 3.5 you can either replace x^2 by x*x or by pow(x,2).
|
Hints
If you're converting stuff between MegaPOV and POV 3.5 you might find it handy
to keep both programs running. By default this doesn't happen, but there is a way to achieve this.
- In both programs, from the options menu, switch off the "keep single instance" flag.
- Start MegaPOV before starting POV 3.5, not the other way round.
|
|
|