Mandelbulb 3D and Heightmaps

15 min read

Deviation Actions

HalTenny's avatar
By HalTenny
Several people lately have asked me about how to use heightmaps in MB3D. I don't use them a lot, but I can explain the basics on how to use them in the limited way that I do. As usual, I make no claim to being an expert. The way I work is the best way for me, and I would never be so arrogant as to suggest my way is a better way or the best way for everyone. It's the best way for me and my work flow. This Journal is for beginners. Note: Click on the title of this Journal to open it on a new page and it should visually look much better organized. Let's begin~

I think the reason some people have trouble with heightmaps is because of where their current camera view or position is within their fractal image. If you are building a fractal from scratch, and place your heightmap first, then you will probably not have a problem working with it. The heightmap will be visible in the center of the preview image in your main window. In the image below, I have opened MB3D, replaced the default Integer Power formula with SphereHeightMap ( located in the second column of the dIFS formulas) . It loads the default image #10 as the map. I also added the SphereHeightMap formula which also loads the default map # 10, and I zoomed out a bit. Note: When working with heightmaps, set the Max iterations in the formula window to the number of maps you are using, in this case 2. If you use more dIFS formulas, you may have to increase that number.

1 by HalTenny  2 by HalTenny

And there you have it. No problem when you start out with just a heightmap or two! Of course, if you are anything like me, you would never start with a heightmap. I should say almost never, but rarely. I almost never decide I want a heightmap until later in the creation process. Because I almost never know what I am going to be creating, or where my vision will lead me. Will the image need a floor, or wall, or sphere? I personally never go into the creative process with that limited or specific of a vision. It's wide open, pedal to the metal in the early process. The practical side of that is that part of the creation process is searching for the grand view and ultimate shapes you want, so why limit that search to an area where you can already see the heightmap. It's a simple thing to bring the heightmap into position where your vision leads you once you learn how. So, anyway, what happens when you are well into the creative process, and then decide to add a heightmap? This is where it becomes more difficult, and probably where a lot of beginners start having trouble. 

The problem is that while searching for your masterpiece, you explore in the navigation window, and have wandered off center from the default view. So while your current image may be centered on a great view for the piece you are creating, when you add the heightmap, it is placed at the original default position near the default center, which is now off your screen and current point of view. For instance if you have rotated your image 180 degrees clockwise or counter clockwise, and then add a plain HeightMapIFS formula, then the heightmap may now be upside down, like a ceiling instead of a floor as you might have intended. Also, if you have further rotated the image side to side or whatever, the HeightMapIFS may be in a position like a wall instead. All of these things can be overcome with the rotation settings in HeightMapIFS, as well as the H offset setting. 

Below is an example. (I'll include parameters at the end of this journal). Let's just say I created this image and decided after I worked on it a while that I wanted to add a floor or ground of some sort. First off, I just want to say I rarely use dIFS formulas to begin with. But when I do, it's almost always a sphere, a SphereHeightMap or a plain old HeightMapIFS formula. Because I am much more likely to add extra escape time formulas or adds from the first eight formula columns, I like to keep the majority of empty formula slots on the right side of the formula window. But most of the time I also keep one formula slot open or empty in the formula 1 position just to make adding a heightmap easier if I decide to use one at a later time. It makes perfect sense to me as I am most likely only going to add one dIFS formula, and it leaves all the other slots open for additional escape time or add formulas. It's just my personal preference for the way I work. It makes no difference where you place the dIFS formula. At the beginning, or the end of your formula list is fine, whatever works for you. And to me, neither way is better, it just depends on how you create your images, and what formulas you use the most.

3 by HalTenny  4 by HalTenny  5 by HalTenny

In the second formula window image above in the red box, you can see I added the HeightMapIFS formula in the first slot. In the blue box you can see I switched to DE combinate mode and set the second part of the hybrid to formula slot two, because that is where the escape time formulas start. You have to use DE combinate mode to mix escape time formulas with dIFS formulas. In the green box you can see DE combinate mode is set to Min. This is normally what you would want a HeightMapIFS set to. Max iterations for the HeightMapIFS  is set to 1 and max iterations for the escapetime formulas is set to 60. Now if you have the start parameters loaded (located at the end of the journal), and have made those same changes as I have and hit calculate 3d, you will notice no change in the image. There could be many reasons for this, but in the case of this image, you don't see the HeightMapIFS  because it's behind the fractal structure. And because I have isolated the fractal structure by setting the far plane setting low (2.2) the HeightMapIFS  is actually cut out of the back of the image. So let's make the HeightMapIFS  visible. The easiest way to find the HeightMapIFS  is usually to zoom out on the image. I normally select fixed zoom and steps in the navi window if I'm going to zoom out. So do that, and then click the zoom button 11 times. (Just do it!) You can also just raise the far plane setting in the navi window to 100 or higher, and this will show the fractal parts that were cut away by the low far plane setting. But do it with the zoom button instead so you can follow this tutorial. :) Now you can see the HeightMapIFS showing up behind the fractal structure, see below.

6 by HalTenny  7 by HalTenny

I think it is easiest to be zoomed out as you start to dial in the position of the HeightMapIFS. So now that we can see the HeightMapIFS, we can place it where we want it by using the rotate and H offset settings. Now I'm not going to lie to you, the x,y,z coordinate system completely befuddles me. I can't for the life of me get it right without just playing with it. Even with the x,y,z coordinates turned on in the navi window, my tiny pinhead of a brain can not cope with it. At any rate, I see that it appears the HeightMapIFS is directly behind our fractal structure like a back wall, so I decide it has to be rotated 90 degrees. So I start with the x rotate. If you click on the 0 integer (green box in image 2 above) of rotation X, a popup appears, and you can directly input 90 degrees. But my little pin head rotated it in the wrong direction. Through trial and error, I found you need to input -90 degrees in the rotation X field. For those who are not axis challenged like me, you could probably have looked at the axis inside the red box, and determined that. Once you set the RotationX to -90 degrees, you will see the image below.

8 by HalTenny  9 by HalTenny

Bummer. Unfortunately, now you can't see the heightmap at all again, so you have to zoom out some more. This happens all the time, so you just have to keep adjusting the view. Click the zoom button 5 more times and you'll now see the heightmap. But we still want to raise it up to near where our original view was. To do this, just use the H offset slider. Slide to the right to raise, and to the left to lower the heightmap. You'll have to do this in a series of steps until you get it right where you want it. Slide the heightmap up close to where you want it, zoom in, adjust more, zoom in. Repeat until it is where you want it, and you are close to the original view. The second image above shows me zoomed out more, and the red box shows that I have already raised the heightmap some. As you go through this process, you will probably run into the problem that your heightmap horizontal scale, or H scale is higher or lower than you like. In other words the peaks and valleys are too deep or too shallow. You adjust this with the H scale. It will be more difficult to get the heightmap adjusted to where you want it if the H scale is not in a suitable scale to match the map you use, and the scale of the fractal image you are working on. So I find it very helpful if you set the H scale of the heightmap to zero BEFORE making further adjustments. So do that now and then start raising the H offset as well. See below.

11 by HalTenny  12 by HalTenny

In the first image above, you can see I raised the map by adjusting the H offset, but the peaks and valleys are too high for this image. So in the green box in the first image, set the H scale to Zero. In the second image above, you can see the heightmap is now flat. I have also zoomed in some more. This journal is getting too long so we'll speed up a bit. See below.

13 by HalTenny  14 by HalTenny

Now in the above image the heightmap is in a basic position and the original fractal structure is approximately at the scale where we started. You can't just keep zooming the same number of times to get back to the original image, because we've added the heightmap. It's a process of zooming, perhaps with fixed zoom and steps deselected as I have, and also adjusting the far plane setting while also adjusting the H offset to raise the heightmap into position. It's not as complicated as it sounds once you get used to it. I would recommend right away to raise the far plane to 500 or more, then reduce it later to your taste. And zooming in this case with fixed zoom and steps deselected will probably result in a smoother experience. As you zoom closer to the original fractal structure position, it may be necessary to select the fine setting at the top right of the navi window to fine tune the heightmap position. That's the basics of positioning the heightmap. Now all you have to do is choose a map that suits your taste for the image you're working on, and then adjusting the frequency and orientation of the map. In the second image above, I've used a brick image as the heightmap. You can use any image for a heightmap, but obviously some will work or look better than others. You can use maps to simulate water, grass, just about anything. But that goes beyond the scope of this tutorial, it's something you'll just have to experiment with. I had to change the size of the bricks by adjusting the X and Y scale settings which is the frequency at which the brick pattern repeats, or the size of the bricks. Here I set the X and Y scale to 5, so they are bigger or repeat less. A smaller number will make them repeat more or be smaller in size. On this particular brick image I used, the H scale has to be very low for it to look right. You may have to set the adjustment scale at the top right of the navi window to min to use the slider and get it just right to your taste.

For some maps with less of a repeating pattern, you may have to adjust the map position by sliding it to the left or right, or forward or backward. You do that with the X and Y offset sliders. With the brick image that adjustment is not necessary. Below is a basic, finished image. I normally don't like the edge of a heightmap to show, so I adjusted the depth slider under the ambient tab in the lighting panel to fade the background. If you have trouble doing that, just lower the far plane setting. I also turned on hard shadows to accent the bricks with some shadows.

15 by HalTenny

I honestly intended to include working with the SphereHeightMap in this journal too, but as usual, I just talk too much and ran out of time for today. But I promise to do that soon as well. The process is very similar but the usage of a SphereHeightMap is much more unique and the results can be quite interesting. I hope this journal helps. Feel free to comment, ask questions etc. And fave if it helps, that's always a nice thing on your part to do. It's somewhat of an indication of how helpful these journals are. Below are the before and after parameters, and the brick image for the heightmap. Good luck and most of all, have some fun!

Note: If you use the brick map I included below, you have to save it in your maps folder. If you already have a map with the same number, you'll have to change the map number (of the brick image) to a number that is not yet used in your map folder. Then you will have to change the map number in the parameters to match the new brick image map number.


Starting parameters:

Mandelbulb3Dv18{
g.....h....s/...w....2A...kaH0MrTGByzeI.rge/iQwDZGWmq2PRzzfD6JrQ.Wd2.NGw0fJgQUzj
................................BZ21Nn2PJ/2........B./..................y.2...wD
...Uz6/....0..../M.1/...........h3...2E3.....wVJL9.LX6kD/.koHc1E...w/xckpl1....k
z.EnAnYD12../2.QSP079m2hzS/PODsvaUxDuQzGsfajNz1..........AV0.....y1...sD...../..
.z1...sDTBrWeJ1/mvf7y6EduIFfyyMNfCepysfjonHsEhxXount4t.cADPwyGcDnPYtZrgjsV2diaQV
uu9nxXAUNHgnymQK98PsZ4jDU.....Y5..............sD.6....sD..G.....................
.............oAnAt1...sD....zw1...................................kKIi0Ec....k1.
.....Ksulz1.....6yzz.wzzz1.U..6......M2...EB....m....c3...UE....6/...w0.....SFr1
...U.W1KEyzlciszsU3YzTAe906.oc..zzSi...MarH7iXyD6oa4dabdnz1..........2k.8.kXWF1.
.sM93P58iz9.MmnWK2zwz0..........F6U0.wDjt/..zMwlGfEzzsVdHkZgHD.E.g3b33lfazH12klz
zjxh...hx7jJPS.k2W3QMZjR7.A.mRfyBU3lzK./I.kz8L7..smACOnu5.A8UbzcUmT0.1.wy5X0tNzD
/EU0.wzzz1....................................8cU0.E./2Ezz/cU08../2E.tzDU08c..2E
./IzT/8cU0.E./2EQs5cU08../2E./bTU08c..2E./2ly/8cU0.E./2EMw5cU08../2E.lqTU08c..2E
./2kz/8cU0.E./2E...cU08czz/cU08cyz1cU08cxz3cU08c................................
E...2AU2W6......zzzzz1......kVKNmJ4GZZqNcFLHV/5......................6U./2E./2E.
GMU/46E./........MNk./..........aNaNaNa0..AmAnAnAnY2.VaNaNaNC8zjBnAnAnAn0.YaNaNa
Na/wz.........zDNaNaNaN8h.2......kRI./......61/k.......UQz9........wz...........
........kz1..........6.....3....6....2IPVdLOiR46HJbQa/..........................
.Q..4MU/.6...........MnAnAnAP.zDBnAnAnAn2zXAnAnAnA3wz......Ut91k......UCM.2.....
.km0.DnAnAnAnAwD................................................................
................................/....E/...k.....T7pPo34RZ/.RcNoPgF4.............
..........U/4M.........................g..2.......Uvz0......UA.E................
...4./........zD........E.oAnAnAnAnoz...........................................
............................................}
{Titel: haltenny-heightmap-tutorial-start}

Ending Parameters:

Mandelbulb3Dv18{
g.....h....s/.../....2A....I6IiFvNaxz48y8chJv9xjmJA016jszzf8fBM5VYZ2.JWP92HXFCzj
................................q70JrfTjp.2........B./..................y.2...wD
...Uz6/...E0..../Q.1/...........g0...2E4.....E/rLUzBT5mD/QkoHc1E...w/xckpl1....k
z.EnAnYD12../2.QSP079m2hzS/PODsvaUxDuQzGsfajNz1..........AV0.....y1...sD...../..
.z1...sDYtwVaN6kVw9CuCVbsT8ryiwjGzcBBrijod01pkdEYvH0eS4g93L6zCxOZ83ZppjjpufZzLW6
ev9pk1Sy/3ZzyW93.kEZX3mDU.....IA....E.........sD.6....sD..G.....................
.............oAnAt1...sD....z.Xcp...............p.................kKIi0Eb....k1.
.....Ksulz1.....6yzz.wzzz1.U..6.4/...Q2...EB....m....c3...UE....6/...w0.....SFL2
...U.W1KEyzlciszsU3YzTAe906.2c..zzSi..k.Tci/2Uyj6.Dbqxm4Iz1..........2k.8.kXWF1.
.sM93P58iz9.MmnWK2zwz0..........F6U0.wDjt/..zMwlGfEzzsVdHkZgHD.E.g3b33lfazH12klz
zjxh...hx7jJPS.k2W3QMZjR7.A.mRfyBU3lzK./I.kz8L7..smACOnu5.A8UbzcUmT0.1.wy5X0tNzD
/EU0.wzzz1....................................8cU0.E./2Ezz/cU08../2E.tzDU08c..2E
./IzT/8cU0.E./2EQs5cU08../2E./bTU08c..2E./2ly/8cU0.E./2EMw5cU08../2E.lqTU08c..2E
./2kz/8cU0.E./2E...cU08czz/cU08cyz1cU08cxz3cU08c................................
E6...A..V2E.....I....s.....GZZqNcFLHV/LG4B3.V/5......................6E./2E./2U/
4MU.02E./.........SP./............................V2./.......E/E........I.Izzzzz
zzzHz........O3k........................................kz1...................zD
........kz1..........6.....3....6....2IPVdLOiR46HJbQa/..........................
.Q..4MU/.6...........MnAnAnAP.zDBnAnAnAn2zXAnAnAnA3wz......Ut91k......UCM.2.....
.km0.DnAnAnAnAwD................................................................
................................/....E/...k.....T7pPo34RZ/.RcNoPgF4.............
..........U/4M.........................g..2.......Uvz0......UA.E................
...4./........zD........E.oAnAnAnAnoz...........................................
............................................}
{Titel: haltenny-heightmap-tutorial-end}

Brick image:


239 by HalTenny

Published:
© 2017 - 2021 HalTenny
Comments33
Join the community to add your comment. Already a deviant? Log In

Hello, noob here. In what map / folder do you put the weight-maps and how do you load one of these into MB3D? Why are the height images numbered ?

HalTenny's avatar

All height maps, images for backgrounds, light maps and images for diffuse colors go in the maps folder. They are numbered to make things more simple. If you right click next to where it says 'Map number', the maps folder will open so you can pick a map visually.

But WHAT maps folder ?

HalTenny's avatar

It's in the Mandelbulb 3d folder, and is called M3Maps.Sorry for the late response~

ATORRELLA's avatar

Thanks a lot! Very useful.

Ahab-kaba's avatar
Thankyou for the info Hal.Appreciated.
HalTenny's avatar
You're welcome~
flameout82's avatar
Great help Hal. Much appreciated . 
viperv6's avatar
great tut Hal , thanx very much for  spending your time to do this here :clap:
HalTenny's avatar
Thanks, and  you're welcome!
GBLXVIII's avatar
HalTenny's avatar
quasihedron's avatar
Great tutorial. It helps me a great deal! Thanks for sharing! :D
HalTenny's avatar
Thanks! I'm glad it did~
quasihedron's avatar
You are most welcome, Hal! :D
DsyneGrafix's avatar
Got It! Added to The Mandelbulb 3D Master Training Resource Guide! 
docs.google.com/document/d/1Hb…
HalTenny's avatar
Thanks Ricky! I'm doing two more tutorials in the next week or so too :)
DsyneGrafix's avatar
Awesome! I'll look for them to add to my collection!
Undead-Academy's avatar
That is awesome Hal , thanks for sharing :) I know this will help many people who are not familiar with the heightmaps :)
HalTenny's avatar
I appreciate it Patty. I hope it does~
Undead-Academy's avatar
with pleasure , I am sure it will . I always enjoy tutorials because no matter how long you may have been playing with MB3D there is always something new :)
Join the community to add your comment. Already a deviant? Log In