literature

Custom Height Maps For Mandelbulb3D

Deviation Actions

LightBulbMoon's avatar
Published:
18K Views

Literature Text

Mandelbulb3d has several ways to render 3d fractals.  One of them, dIFS, has the ability to make use of height maps.
This tutorial focuses on creating custom height maps.

This is not news worthy - MB3D artists have long made use of this technique.  Recently my friend Jorge - batjorge - has posted a tutorial on using dIFS with a height map - the HeightMapIFS and the amazingIFS formula.  The tutorial is meant to easily generate the classic bulb shape and it achieves this admirably. The height map in Jorge's guide is a uniform, gray image.  This results in a clean and texture-free bulb form.  But what happens if a more complex height map is used?

This tutorial will walk you through creating a quality custom height map and applying it in a MB3D dIFS render.

150901-07-400 by LightBulbMoon  This image - New Heights - uses a custom height map.

PureGray 400 by LightBulbMoon This is what the render would look like without the custom height map. 

What's a height map?

A height map is any .jpeg, .bmp or .png image that is stored in the map directory of your Mandelbulb3D software installation.  Maps are typically used in MB3D to add color or texture.  This is controlled in the lighting window.  Make sure the option to 'use a map for the diffuse color' is checked.

The height map is an image in which the color value of the image is used by MB3D to determine what parts of the fractal is higher or lower visually.
This sounds complicated at first but here's a visual explanation:

HeightEx-1 by LightBulbMoon

If our height map image is a series of darker and darker squares, the result is lower and lower areas in the render.
So, dark = low and light = high.

Any image can be a height map - literally - images with faces or text or anything will work.  Jorge's tutorial intentionally uses a solid gray map to avoid introducing shapes into the render.  The image  - the height map - was featureless.  Here is how to create a height map with crisp, distinct shapes.  Yes, you can use random colors with blurry, indistinct edges and shapes but the results will also be fairly random too.

Here is what the height map used in New Heights looks like:

313 by LightBulbMoon  There are very distinct shapes with a precise range of gray values in the image.

Here are the steps to create a similar, quality height map.

Step 1
Start in an image creation program such as Adobe Illustrator or Corel Draw. These programs create vector art.  Programs such as Adobe Photoshop or GIMP create bitmap images.  Yes, the final height map image will be a bitmap file however, to create shapes with crisp edges, I have found it is best to start the process in a vector design environment.  If you do not have Illustrator or Draw, don't let that stop you.

You can still get fine results.  It is just easier if you can use vector.

Photoshop and GIMP have Bézier pen tools (the path tool in GIMP) that are vector-like.  Remember to work large - say, 2000 pixels wide.  Save the final file at 1000 pixels wide.  This will eliminate the jagged edges we are trying to avoid.

As an example, below is a render I did using a height map created in Photoshop.  Notice how the edges are rounded. There are other minor imperfections that creep into the render from the less precise height map.

HeightMapRenderEx2 450 by LightBulbMoon As with so many things fractal, it is a matter of scale.  Yes, at the smaller scales, the imperfections are not visible but look at the largest scale of the hexagon forms. At the bigger scales, every imperfection is apparent.

And don't forget, you can always use an existing file as a height map.  If you already have art you want to use, skip ahead to step #3.

Step 2
For the tutorial, we will create a '60s theme, flower-power map.  This step is the creation of the shapes.  Here are some of the elements we want the design to have:
  1. Distinct shapes evenly spaced
  2. The shapes should evenly cover the area with no overlaps
  3. Each shape should have a single gray scale value applied to it
  4. Ideally, the pattern should tile seamlessly.  This means it repeats without cutting off sharply when multiple copies are next to each other - in all directions.

Here is the start of the basic flower shape - a petal.
Petal-1 by LightBulbMoon  The version on the right is good because I removed the black outline from the shape.  The version on the left would create a low spot all along the edge where the black is - remember, black equals the low points on a height map.

Rotate the petal and add a round center.

Petal-2 by LightBulbMoon

Duplicate the shape and change the scale - like this:
Petal-3 by LightBulbMoon While this version would work, remember that the white portion will be the highest parts in the render so we want to turn the white, negative space around the shapes into a darker - lower - color.

Petal-4-400 by LightBulbMoon Notice I also made the centers whiter - this will make these areas the highest parts.  I took care to remove any full-black outline along the outer edge of the map.  Save the image as a jpeg in your map directory.  Use the INI tab to locate it if you don't know exactly where it is.
The file's name must be a number like 1234.jpg.  Make a note of it - you will need to remember it later.

I'd like to remind you to save the file with the approximate width of 2000 pixels. This size ensures that you'll have smooth, crisp edges in your shapes.

Tip: If you find, when you render the image that the finer edges look ragged, try lowering the raystep multiplier value. Try a value between 0.05 and 0.01  This would ordinarily increase your total render time. Since IFS renders require a low max iteration value - approximately 5 - this doesn't add to the total render time as much as it would for a non-IFS render.

INI Screen by LightBulbMoon The actual location shown may be different on your computer.

Step 3
Lets apply the map in our fractal.  Open Mandelbulb3D.

In the first formula slot choose HeightMapIFS.  It's in the first or left most dIFS formula menu.  For the map nr value, enter the name of the map you created.  In the second formula slot choose amazingIFS.  It's in the last or right most dIFS formula menu.

Send the values to the main program and see what appears in the preview.  You may have to adjust the values.  This can depend on a number of factors.  To adjust the size of how large the map appears in the render, try this first: In the HeightMapIFS values, look for X scale & Y scale.  A lower value - such as 0.3 for example makes the details in the map appear larger.  A higher value, such as 1 or 2, makes the details appear smaller.
Remember to keep both X & Y scale values the same or else you will introduce distortion into the features of your height map.  Of course, this can be an intentional effect.

Another adjustment is to change the Z scale value of the height map formula.  This will increase or decrease the actual height of the details in your map.

There are other parameters within the HeightMapIFS formula:
Rotation X, Rotation Y, and Rotation Z.  These will adjust how the planes of your height map are imposed over the render.  Think of these as the ability to tilt the height map within your render.  X, Y or Z are just a different axis of rotation in the render.  Once you try it, it will make sense.

Map Channel.  Part of what makes for a good map is that it is in gray scale.  If you use a full color image as a height map, you will not get results you can control. However, the map channel parameter attempts to give you the control of which color channel within a RGB image, the software uses as the gray scale.  If you are using a gray scale image to start - and you should be - changing this parameter will have no effect.

OTrap Channel, OTrap offset, and OTrap multiplier.  These are additional ways to control which colors of the chosen map channel are used - when you use a color image as a height map. Again, I strongly recommend that you convert your image to gray scale before using it in MB3D.  Why?  Because, when you look at the color version, you really can't see it as the software will.  When it is gray scale, you are able to better interpret the highs and lows as the computer will.

If you find that your render is making the areas you wanted to appear high, look low, or areas you wanted low seem high, you can easily reverse it all by inverting your height map image.  All the image editing software - Photoshop or GIMP - have an invert function.  This will make a negative version of the height map and MB3D will interpret it accordingly.  What was depressions before are elevations now.

If you are not seeing your height map's effect in the render, you can also try tweaking the Fold Z value of the amazingIFS formula.  After this point, I'm not quite expert enough to guide you with complete certainty. Fiddle with everything!

Below are the parameters for the original New Heights fractal with the height map from this tutorial applied.  Here's what it should look like:

New New Heights 500 by LightBulbMoon  Here's a link to a larger version: New New Heights.  Below are the parameters to try it for yourself.
Don't forget to download the height map too - here's the link for that: 1234 by LightBulbMoon

Mandelbulb3Dv18{
g.....x/..EB3...w.....U...kVo5YXa7ewzWuO.t0Yzy8EpmExKDB5ryfEQEF1aX1jzkITN5MxZ/yj
................................feNIIvGaL.2........A./.................UF/2...wD
...Uz6.....R.....Mk1/.....UHC...1/....E3.....2f2KMl2qSmD/.......aeed0dkpXm1.lJJp
z.EnAnID12../..........wz.................................U0.....y1...sD...../..
.z1...kDNvf7Ppo4Vw1cJPvaAW46z6Hc2Quqe9hDydK6IZNK1wP3i96u87C.zYqGiFFJHPmD/6CmoOKM
Tw1sEcyoLO76zK/9RLTGGakDU.....2ZS.............sD.6....sD..G.....................
.............oAnAt1...sD....z.Xcp9......................................w....k1.
.....Ksulz1.......kz.wzzz1.U..6.P....61...EB....m....c3....F....6/...I1.....SF52
...U.ydelyjeYFnzTeOgzf8No.6.nc..zzzz..EizccZWGyD6EdGkxmWcz1...........k.8.kXWF1.
.sM93P58iz9.MmnWK2zwz0........../EU0.wzzz1...........23...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................gPhi0U7EgU7a9FoTu2.oQm2ooR7nueM.YXB
bYHkss6Ul/k6Ukl6SeIX2W5.a.l0a./JvKff.M029MmORFcEs/U7EgU7cNaAXB3.a.l0acvPv8Or.M02
9MG9tJpPl/U7EgU7...crIGJzzFoTuIdyzngi8qdxzZX.4rU................................
E....AU.V2E.....I....s.....GZZqNcFLHV/LG4B3..........................6E./2E./2U/
4MU.02E..........UoY./.......EzDMaNaNaNatyXaNaNaNaNazAnAnAnAnAxDnAnAnAnAHz1.....
...kz0..................................................kz1...................zD
.....................2.....3....8....2KPVdLOiRKG4B3.............................
....4MU/...........................................kz...........................
..............zD........kzXNaNaNaN4xz........w1E................................
................................/....E/....0....FBISgZYFH/..4B3.................
............Cs....U.............nAnAnAnAHzXNaNaNaN4wzYNaNaNaNaxj................
.....cNaNaNaNawD........kz1........0.BnAnAnAnAxD................................
............................................}

Experiment!
I hope you use this tutorial as a starting point to try new and different things.  For example, notice how the central dots look like cylinders?  One way to soften them is to use a gray scale gradient so the edges of the circle in the height maps are darker.  This would have given the rendered centers a dome-like look.

Leave me the links to your results in the comments of this post - I am looking forward to seeing what you have created!
© 2015 - 2024 LightBulbMoon
Comments61
Join the community to add your comment. Already a deviant? Log In
IAmThatStrange's avatar

The Mandelbulb3Dv199sr32 and the Mandelbulb3Dv199sr34 now no longer saves the png or the jpg even though I use the png or the jpg and it does not say "No" or any news.  It looks like it is saving as one of  those but it does not save them.  It only saves as bmp.  It's not horrible as the Photoshop will work with the bmp.  But really I would like it to be able to save as the png or the jpg.