Megapov MCP documentation
This file describes my own additions to Megapov MCP 0.1. Some sample scenes are included in the package too.
If you have questions, comments or suggestions concerning this Povray version you can contact me via email: chris_hormann@gmx.de.
Description of the other patches that are part of this Povray version can be found here:
The new things I added to this version are:
- new patterns:
- other things:
new displace warp type 2
Megapov's type 1 displace warp displaces according to the gradient vector of a pattern. An optional undocumented parameter specifies the sampling distance used for calculating the gradient:
warp { displace { [pigment] type 1, 0.05 } }
where 0.05 is the default distance.
In the old type 1, the amount of displacement depends on the distance, which seems not very useful to me, so i changed it for type 2. An optional range parameter with default value 0.05 influences the amount of displacement. Without the optional things specified the type 2 behaves exactly as type 1.
warp { displace { [pigment] type 2, 0.05 range 0.05 } }
The following table shows the displace pattern on the left and the displaced pattern with increasing distance values from left to right. The first line shows type 1, the second type 2.
visibility extension of the object pattern
An optional keyword "visibility" followed by a vector changes the object pattern. It no more tests for inside/outside of the object, but checks, whether some part of the object lies in direction of the vector. Example:
pigment { object { [object] visibility [vector], [color 1], [color 2] } } |
grad pattern
The grad pattern uses the gradient of a pigment as pattern value. The code is based on Chris Huff's displace warp code and therefore works quite similar.
pigment { grad { [pigment] distance [float] range [float] direction [vector] } }
distance and range have the same meaning as in displace warps: the sampling distance for gradient calculation and a scaling factor for the values. If direction is specified, the projection (dot product) of the gradient vector on the direction vector is returned.
The following pictures shows different samples for the grad pattern. the far row uses range 0.45, the nearer one range 0.9. distance is decreased from left to right.
warp pattern
The warp_pattern uses one or several warps to specify the pattern value. Warps assign a vector to each point of space. The pattern either uses the length of this vector or the projection on a specified direction vector:
pigment { warp_pattern { warp { ... } warp { ... } ... direction [vector] } }
The first line of the samples shows a black_hole warp pattern with the same warp used for the leftmost pigment. The second line uses "direction <1, 1, 1>" in addition.
blur pattern
This pattern blurs a specified pigment by taking several samples.
pigment { blur { [pigment] distance [float] method [int] samples [int] } }
Right now only method 0 and 1 are implemented, both using no adaptive sampling.
distance specifies the maximum distance samples are taken at. Default value is 0.05. With samples the number of samples taken is influenced. Default is 1. The actual number of samples taken depends on the method. If the samples value is odd, no sample is taken at the evaluation point.
method 0 samples in a 3d grid, the number of samples taken is (n+1)^3.
method 1 samples in x, y and z direction, the number of samples taken is (n+1)*3.
the next picture shows "method 0", samples value is increased from left to right:
the same for "method 1":
object_slope pattern
Like in the slope pattern the slope of an object is calculated, but the object can be specified and therefore the pattern can also be used in media, isosurfaces, ...
pigment { object_slope { [object] direction [vector] distance [float] } }
The direction vector has the similar meaning to the slope vector of the slope pattern.
The pattern moves away in "direction" from the evaluation point and checks backwards for intersection with the object. If found, the normal of the object is returned, otherwise the value is 0.
distance is optional, if given, evaluation points more distant to the intersection point than this value return 0 too.
The following two pictures show the effect of "distance":
Some more examples for use of this pattern: