\section{Miscellaneous}\label{miscellaneous}

This chapter contains miscellaneous information like  Q\&A and Hints. Some of this information will be relocated if a new chapter is written that covers the subject.


\subsection{Q\&A . }\label{Q|&A}

\paragraph{How do you get different materials on different
	shapes?}

This is how I have been doing it, see also figure \ref{material_selection}:

\emph{Rectangle at the bottom marked A.}

This is where you~ start a new material or load an
existing.~ The active material is highlighted in blue. Meaning it is active in
the \textbf{material editor} where you create or modify the material.

\emph{Rectangle at top left marked B.}

One way to use a material is to go to Global Parameters,
click on the material preview image, and the \textbf{Material Manager} UI will
appear with the materials you have loaded or created. Click on the one you want
to use, then close that UI.\\ Similarly with primitives, click on the material
preview image. And with Boolean Mode each fractal/transform has it's own
material preview image when you scroll down.

\simpleImageWithCaption75Width{img/manual/media/material_selection.jpg}
{Material selection}
{material_selection}


\paragraph{100\% CPU even it's not rendering anything} May 2017

Q. New version freezes my machine. After launching an application, it started  to use 100\% CPU even it's not rendering anything.
I'm on Linux Mint 18 with i7 CPU and 8gb of RAM

A. Maybe the program is re-rendering  all top toolbar preset icons (with fractal previews). You may need to  wait some time for this to finish. (SOLVED)

\paragraph{Morphing between fractals} May 2017.

Q. I want to animate a fly through different fractals, smoothly merging with each other. For example, "Amazing box" fractal slowly transforming to "Beth 323" and then to other fractal. Also changing backgrounds would be awesome.

A.  See (\href{https://youtu.be/RHVCt1WXuAU}{https://youtu.be/RHVCt1WXuAU})  And, from menu bar select    File \- Load examples, and load example called  mandelbox\_menger\_morph, this is the settings file for that video, and you will be able to see how it was done.

For morphing between fractals  the "weight" parameter is used.  Weight determines the influence each formula has in the image at each frame.  Weight = 0 (0\% influence), weight = 1 (100\%).

So as  the weight is adjusted from 0 up to 1, then the influence of that formula is introduced. At the same time, the other formulas weight is being reduced from 1 down to 0.

Good practice would be to find a good setting for a "halfway: keyframe.

keyframe\#0   formula1 weight = 1 and formula 2 weight = 0\\
keyframe\#1   formula1 weight = A and formula 2 weight = B    // the halfway keyframe\\
keyframe\#2   formula1 weight = 0 and formula 2 weight = 1

The values of A and B that are chosen, control the way morphing works between keyframe\#0 and keyframe\#2.

Using weight controls has hardly been tested yet, even though it has been available in the program for a while

Some combination of formulas morph better than others

Animation/morphing takes a lot of render time, so render initial draft animations at low resolution, and choose fast formulas.

In Mandelbulber nearly all parameter can be animated, (and also animated in response to audio files), but integers can not normally be animated therefore you can not morph smoothly between iteration count numbers


\paragraph{Different Materials for Hybrids} May 2017

Q. I cannot find any information on how to assign different material on different fractals? I enabled hybrids, for morphing animation and I want two fractals to look differently. Users guide method gives me the same material on both fractals. I'm changing materials in global parameters>material manager .What am I doing wrong?

A. In hybrid mode we are making a single fractal so the color is the same at a single frame. We can only change color over time (frames)

\paragraph{Several Fractals in one image} May 2017

Q.  Is it possible to put few fractals in same scene, not as hybrids but just close to each other?

A. In  boolean mode, you can place up to nine different fractals in your image, you can assign each fractal a different material.

\paragraph{Can the priority of GPU be set} November 2017

Q. Rendering anything using OpenCL currently brings my system to a crawl, graphically speaking. Anything elsewhere only progresses once a square of fractal image has been rendered and Mandelbulber moves onto the next one. If the render is especially complex my system feels like it has frozen completely as I can't interact with anything until the next square is done.

Is there any way to reduce the priority of the GPU processing? Admittedly I don't even know if OpenCL processes work in this way but it makes GPU rendering near unusable for me for more complex images.

Using Ubuntu 16.04 and 17.10 (Unity 7 and GNOME 3) with a GeForce GTX 750 Ti (need a new one!), driver version 384.90. Current git build of Mandelbulber.

A. Graphics drivers have no capability to set priorities for tasks. In general they are not so well prepared for multitasking. It's also not possible to reduce allocation of GPU. 

Actually there is used CL\_KERNEL\_PREFERRED\_WORK\_GROUP\_SIZE\_MULTIPLE to run the program with optimal global\_work\_size. If will be used lower size, rendering will be slower, but you will not see difference in multitasking. It's because rendering of each pixel will still take the same time, but amount of simultaneously rendered pixel will be lower. For that time GPU is busy.So in general as fast the enqueued work is executed as the system is more responsive.

Calculation of 3D fractals is computation extensive, so it's not possible to get quick calculation.
This is big disadvantage of computation on GPUs.
If you want to have system well running with background GPU computation, you need to have second graphics card which will be used only for computation.


\subsection{Hints}\label{Hints}

\paragraph{Optimizing of \emph{maximum view distance}}\index{ray marching!maximum view distance} Located : Rendering
Engine - Common Rendering settings

It is important to optimize this setting to minimize render time. You can reduce
until the furthest part of the 3D object(s) starts to disappear. However with
animation an allowance should be made for changes between keyframes.

\textbf{Note!} When navigating in Relative step mode, mouse click on
spherical\_inversion, camera zooms out, and maximum view distance becomes set at a big number like maybe 280. If you do not reset this parameter then your render times will be unnecessarily increased.


\paragraph{Magic Angle} Benesi Mag Transforms
In mathematics the Magic Angle = 54.7356° .

When rendering basic mag transforms the image does not render parallel to the
standard x,y,z global axis. On the fractal dock, in ``Global parameters'' set
y-axis rotation to 35.2644° (= 90° - 54.7356°). The fractal will then render
parallel to the x-y plane.

\paragraph{Formulas containing a varying scale functions}

Some function allow the variation of a parameter over iteration time.


\textbf{aux.actualScale}

This scale varying transform is initialized by the Scale value (parameter name: mandelbox.scale) in \emph{Slot1}. It is found in the formulas listed below :

\begin{itemize}
	\item Abox - Mod 1, Mod 2 , Mod 11, 4D and  VS icen1
	\item Mandelbox Vary Scale 4D
	\item Amazing Surf  and Amazing Surf - Mod 1
\end{itemize}

The program looks  in slot1 \textbf{only}, for the initial value of  mandelbox.scale.

Because of this, when in Hybrid Mode it is best to place these formulas in slot1.

However, these formulas can be used in other slots, but the program will always look for parameter name: mandelbox.scale  in slot1 to set an initial value. If the parameter does not exist, then the program will use a default value of 2.0.


\textbf{aux.actualScaleA}

There is a newer version which can be used in any slot. Currently this function is used in  the following:

\begin{itemize}
	\item Abox - Mod 12, Fold Box - Mod 1
	\item T>Spherical Fold Parab
	\item T>Scale Vary V2.12 and T>Scale Vary Multi
	\end{itemize}
	
With both aux.scale and aux.scaleA, it is often best to use them only once in a Hybrid Mode setup.

\textbf{T>Scale VaryV1}

This is a simple linear scale variation.

\simpleImageWithCaptionFullWidth{img/manual/media/scale_varyV1.png}
{Transform Scale VaryV1}
{scale_varyV1}

\textbf{T>Scale VaryVCL}

VCL is short for vary curvi-linear. With this transform there is the options to use linear slopes(green), curvi-linear (red) or parabolic (yellow).

\simpleImageWithCaptionFullWidth{img/manual/media/scale_vary_VCL.png}
{Transform Scale Vary VCL}
{scale_vary_VCL}




\paragraph{Color functions}

There are various ways of creating the color for each point in the set. Coloring possibilities  can be just as complex as fractal formulas. Color data can be obtained from anywhere within the iteration loop. Two common methods are using the value of a color component at termination, or using the minimum value recorded while iterating. Color components can be mixed together to make more complicated colorings.

A common way to obtain a color value is by the use of orbit traps. An example is the color value equals the closest distance from the point to a cube, or a sphere, surrounding the fractal.

The examples below are some basic ways of creating color components. These examples are with a standard  mandelbox, (the results can be very different with other formulas.)


\textbf{aux.color}
aux.color is a cumulative number that is in many formulas and transforms,  where there is conditional folding, e.g. box folds and sphere folds. Note that color based on conditional functions can cause unwanted cuts in color layout.

The parameter controls are generally like this :

\simpleImageWithCaptionFullWidth{img/manual/media/aux_color_parameters.png}
{Aux.color parameters}
{aux_color_parameters_vary_VCL}

When the iteration loop is running, this number is increased each time a condition is met.  The result is dependent on how many times before termination  that the condition is met.

Currently there are two types of algorithms that use aux.color. In V2.13 Amazing Surf Mod2 has different aux.color calulations. In V2.14 Mandelbox Variable, PseudoKleinian Mod2 and some basic transforms, have aux.color mode 2 and 3 options.

Example  maths (mode 1):

Box Fold
if  (z  >  limit  OR  z  <   -limit)   aux.color +=  boxFoldComponent.

Note that the box fold component can create  speckly areas with mandelbox type fractals.

Sphere Fold. 
if (rr < minR2)    aux.color +=  minR2Component.
else if (rr < maxR2)    aux.color +=  maxR2Component.

And therefore  if(rr> maxR2 ) there is no addition of a component.

With a standard mandelbox we need to cut open the fractal to see the result of this component acting on their own. Red is the minR2 component and blue the maxR2 component.


\twoImagesWithTwoCaptionsFullWidth{img/manual/media/box_fold.png}
{Box fold coloring component}
{box_fold}
{img/manual/media/sphere_fold_minR2_maxR2.png}
{Sphere fold minR2 and maxR2 coloring component}
{sphere_fold_minR2_maxR2}


\textbf{Radius} or \textbf{radius squared} 

A  component value is added based on the distance of the point from the origin at termination.


\twoImagesWithTwoCaptionsFullWidth{img/manual/media/radius.png}
{Radius coloring component}
{radius}
{img/manual/media/radius_squared.png}
{Radius squared coloring component}
{radius_squared}

\textbf{Distance Estimation (DE)}  (sliced view)

A  component value is added based on the DE value of the point at termination.

\simpleImageWithCaptionSmallWidth{img/manual/media/DE_color.png}
{DE color component}
{DE_color}

\textbf{Axis Bias}

These functions are tools to globally manipulate/distort the color. 
Examples maths:

$XYZ_bias                component = abs(z.x) \ast biasScale.x;$
$Plane_bias              component = z.y \\ast z.z \ast biasScale.y;$

\twoImagesWithTwoCaptionsFullWidth{img/manual/media/xyz_bias.png}
{XYZ coloring component}
{xyz_bias}
{img/manual/media/plane_bias.png}
{Plane bias coloring component}
{plane_bias_squared}

\textbf{Iteration count}

The final color value, after adding up all the components, is  scaled by a function of the iteration count.

Example maths:

$colorValue =  sum_of_all_components *  ( 1.0 + iterScale / ( iter + 1.0));$

Left image below is with iterScale = 0.0, the right image has the function disabled.

\twoImagesWithTwoCaptionsFullWidth{img/manual/media/with_iter.png}
{With iterartion count coloring component}
{with_iter}
{img/manual/media/without_iter.png}
{Without iterartion count coloring componen}
{without_iter}


\paragraph{Addition of constant "c" in functions (z = fn(z) + c)}
This is just a general bit about formula structure.

A lot of standard formulas add a constant at the end of the iteration loop, i.e. "do some maths then add a constant", and repeat until termination conditions are met.

Bulbs, abox/surf, quaternion, pseudo kleinians do

Menger, prism, sierpinski and alot of other IFS do not.

Boxbulbs are often best without but they can still have a constant added.

But you can carefully add any constant to any formula anywhere in the loop.

The standard constants added at the end of the loop are either a Julia constant(coordinates) or the original-point-being-iterated often referred to as c pixel.

The standard approach is to either add c pixel OR julia constant

if (julia enabled) z += vec3(julia);
else z += vec3(c pixel) * vec3(constant multiplier);

Mandelbulber is historically set up the standard way, ( choice of c pixel OR Julia at the end of the loop).
However there are plenty of formulas in the list where you can use both or just build a formula out of transforms in hybrid mode.

Summary. How standard fractals are constructed is just a safe starting point, you can mix it all up, the aim is achieving "a quality image in a reasonable time".


Added by user (thankyou).
 Some additional info for those less familiar with Mandelbulber: These parameters are set in the Objects palette. The Fractals tab (where you select the formula(s)) has a checkbox to select whether or not to use the constant. For formulas where the constant is normally used, it will be labeled "Don't add global C constant"; for formulas where the constant is not normally used, it will be labeled "Add global C constant". Leave unchecked for the normal behavior or check for the opposite.

The Global parameters tab has a checkbox for "Julia mode" to select whether to add the Julia constant (if checked) or the current pixel (if not), as well as the Constant multiplier. The Fractals tab will have a remark at the top if Julia is checked.

Two notes:

1. Julia mode and the Constant multiplier are ignored if the global C constant is not used.

2. If you use multiple formulas (hybrid mode), the Julia mode setting applies to all of them where the global C constant is used. In Boolean Mode, additional parameters appear at the bottom of the formula UI. These include parameters for the addition of constant for each boolean mode fractal.


\paragraph{Antialiasing with photo editing software}
Added by user (thankyou).

When there are subpixel size details, image quality benefits hugely from antialiasing, which can be done in photo editing software. Default blending uses a formula post gamma correction, which makes green and red blur to brown, for example. A setting in some photo editing software (e.g. photoshop) allows calculation pre gamma, which blends to yellow as it should! This makes a difference when using bicubic smoothing for shrinking images - especially 4x shrink.

\paragraph{Some notes on using "Multiple rays with light map" for coloring.}
Added by user (thankyou).
Menno Jansen 
Mandelbulber facebook.11 May at 20:23

Note. Multiple rays with light map Ambient Occlusion (AO) is slow so it is best to be used with OpenCL.

1) Materials Editor: disable “Use colors from a palette ..” and use the default gray with the Single Color.

2) Effects/Ray-tracing: Type > choose “Multiple rays with light map” and choose which map you want to use as “Light map texture”. Also make the Intensity value higher.
Note: you can choose any photo you want as Light Map. But make sure that it is a photo/image with some dominant colors. A photo/image with all kind of colors will result in a bland render. A photo/image with a blue sky, green grass and red ball for example will result in a more defined color setting with render.
Also I disable Glow under Volumetric. But this is a personal taste I guess

3) Effects/Lights: Main light source > set the Intensity to a lower value, 0,5 for example

4) Image Adjustment: Picture > Lower the Gamma value and set the Saturation value higher (how much depends on the light map you used at step 2.

5) Rendering Engine: - Shape Control > Enable “Stop at maximum iteration (at maxiter)”. Then set a very low value (4 for example) to start with at “Maximum number of fractal iterations (maxiter)”. Playing around with this value really makes the difference together with step 6!!

6) Rendering Engine: play around with the “Raymarching step mult. (controls quality)” and “Detail level” values.

Also, you could try to add Extra Light source in dark areas. When your dominant color of the Light Map is for example red, try to add extra Light Source(s) that is blue at a not too high intensity. This can give a very cool result.


\paragraph{Monte Carlo MC Global Illumination.}
Global Illumination is a part of the Monte Carlo (MC) DOF algorithm, located in the Depth of Field (DOF)combobox. It cannot be rendered without MC DOF. If the DOF blurred image is not required, then reduce the DOF radius to produce only the Global Illumination effect.

About estimated rendering time: at the beginning it can be very long, because there is an initial assumption that is needed to calculate the maximum number of MC samples. But during rendering there is an estimated "actual noise level" for each image tile. If the noise level for a given tile is satisfactory, then it is no longer rendered. More samples are only calculated on tiles where the noise level is still too high. When many tiles get low noise level, then rendering progress is faster. Statistical noise estimation optimizes the MC effects a lot.

What this means is that initial "estimated to end" time shown on the progress bar can be very conservative. The actual render time can be much smaller (e.g maybe 3 to 8 times faster).
