So after a bit of research trying to figure out how to do some things with OSL on Blender, I figured out a few things which may prove to be of use with some other apps. As much as I’d like everybody to read my entire blog, I know some of my readers probably find it a bit long and want to get the goodies. So I’ll post the goodies right here at the start. After playing with the toys a bit, maybe the rest of the post might even make more sense…
Crackle noise: A nice Voronoi F2-F1 noise.
Cratered planet 1: A first effort at using Voronoi to create craters.
Cratered planet 2: Further along with the effort. Use of fractals to increase size variation.
Cratered planet 3: Further along.
Cratered planet 4: Something completely different. Not so far along…
These all require my latest version of planetGenesis3 to run.
First, I’ve figured out how to make an effect that looks like Blender’s Crackle noise. It turns out to be something also called Voronoi F2-F1 noise, which means that it takes the distance to the nearest randomly placed point in the Voronoi noise space(F1) and subtracts it from the distance to the second nearest point in the Voronoi noise space.
To pull this off, start by right-clicking some blank space and selecting Add Noise>Worley>Biased Worley. Set the Neighbor field on that node to 2 and click Apply. Now, right-click on the node and select Copy. Set the Neighbor field on the new Node to 1 and click Apply. Now right-click on the background again and select Add Combiner>Subtract. Shift click and hold on the bottom “output” socket on the Biased Worley node with Neighbors set to 2. Drag to the top left “input” socket on the Subtract node you just made. Repeat, dragging from the output socket of the Biased Worley node with Neighbors set to 1 to the Subtract node’s right input socket.
If you now right click on the Subtract node and select Preview, you’ll get a 3d view of a jagged, angular landscape. that is a Voronoi F2-F1 Crackle texture being used as a heightfield. Congratulations! You can now click drag from the bottom socket of the Subtract node to the top and only socket on the Terrain node which is the one node on the canvas when PlanetGenesis opened. Right click on the Terrain node, set your Properties as you like. Do you want your texture to be on a spherical planet or a flat Landscape. You can click settings to set the Width and Depth of your texture. For a PNG, this will be the width and height resolution in pixels. For a Planet PNG, you can set the circumference, which will be the width of the resulting equirectangular image in pixels resolution. The height of the image will be half that… Next browse to set a location for the file generated. Next, right click on the Terrain node, select Run, and the program will generate a texture image in the location you selected. Note that the preview imagery is ony a 64×64 sample, so your texture will be much higher frequency. Here is the pG file to look at.
This next one turned into a bit more of a thing. While trying to recover my copy of Bryce after a crash, I came across a set of planet objects created by Eric A. Gehlin on ShareCG including this one. They’re striking, but I’m kind of moving away from Bryce of late.
Examining Mr. Gehlin’s texturing, I noticed that the craters were placed using a basis
noise called “Spots”. My original intention was to implement this all in Blender Cycles, but doing the previous Crackle effect required a Voronoi noise implemented in OSL, which is still quite slow on Blender. I have high hopes for OSL shaders in the future, once the developers get around to optimizing, but for now OSL is, not quite useless, but worth avoiding if possible. Anyway, a bit of googling showed that a random Spot shader could be implemented by thresholding a straight Voronoi noise. Actually, my idea for the Crackle network above was derived from this research.
I figured if I could create a Spot by setting all points with a Voronoi noise lower than some threshold to white, then I could create a ring by using the Range function that I had created for planetGenesis. Those rings worked perfectly well. To the point that I went a little overboard building up a lunar landscape.
I started with a Biased Worley noise as the basis for the craters. I set the Neighbor to 1 and the Metric to Euclidean. The other settings will mostly govern the size and number of craters produced. This will produce a grid of distances to randomly distributed points, so with neighbor set to 1, the distances will produce concentric circles. Next I set up a Range node. Set the Value below range to something like -1.0, the Value within range to something like 1.0 and the Value above range to something like 0.0. The idea is that the rim of the crater is raised and the area within the crater is somewhat below the level of the surrounding land. There will be a lot of adjustments down the line, so the exact numbers are not terribly important. I’ve experimented with the Craterize node, but its hard to adjust the size of the craters produced relative to the distance between them. The only available adjustment is the size of the input fractal which directly effects both distance between craters and the size of the craters. The f(x) node shows a lot of promise for spacing and shaping craters, but the adjustments are incredibly niggling. It will be worthy of further study. I added a Modified Multifractal Noise node, ran it through a (0,1) Rough Scale node and used a connected that output and the output of the Range together through a Multiply Combiner node. This is to give the craters a bit of individual shape. In order to make the craters a bit less degraded, I added the output from the Range node back in to the output from the Multiply node through an Add node.
I add another Modified Multifractal noise node. I set the octaves, so it is just outputting the raw noise basis function. I run this into a Musgrave Hetero Fractallize function node. This creates a simple underlying terrain. Compare the Approximate Range of the Musgrave Heteroterrain node to the crater Add node by hovering the mouse over each of the nodes in turn. Now add an Offset or Adjustments node to the craters’ Add node. Set the Scale so that the underlying terrain does not overwhelm the craters, but the terrain remains interesting. I set the Scale to 25 in the example graph which may have been a bit too much. Adjust to taste.
I want to create some central ridges for some of the larger craters so I connect another Range node back to the original crater-generating Biased Worley noise node. I set the Upper End to something very low in order to make small raised points. I set the Value within range and the Value below range to the same value. Something high enough to be visible in some craters. It might even pay to set the Value below range even higher to make the central ridges pointier and more pronounced. Use an Add Combiner node to connect the craters and terrain to this new central ridges subtree.
In later iterations of the development process, I used a lower frequency Worley noise and a Musgrave Hybrid Fractallize node to add more interest to the craters. The effect was visually spectacular, but it lost some fidelity in simulating accurate elevations of a cratered world. These experiments are ongoing, including the creation of a Special Fractalize function node that didn’t work quite the way I’d hoped. We may come to this later after much twiddling and coding…
The Cratered planet 4 graph represents a departure in the method. Rather than trying to form rings with the Range node, who’s ramp seems to be broken on the Outside of range side, I decided to make big diffuse lumps which are increased in number and variety by a Fractallize node and subtract out similarly-sized but less diffuse lumps which are also enhanced with a Fractallize node with the same settings. The effect is visually effective and appears to produce a fairly convincing heightfield. We may come back to this as well.
I also have some work I’ve done trying to replicate the Terragen Alpine fractal node with pG and Blender and I’m working to improve the fractals in pG to produce strictly scaled outputs, which should aid immensely in choosing settings. I’ll save all of this for one or more future posts as this one has gotten very long and verbose.
So, for now, thank you for your attention and I hope it was at least as enjoyable and helpful to my readers as it was to me.