Masking entire planet surface

Started by Arandil, March 20, 2007, 08:45:53 am

Previous topic - Next topic


Howdy.  Ok, so I've got this idea to generate masks using World Machine to define where I would like various terrain to appear (continent shapes, mountain range masks, etc.) over an entire planet object.

What's the most effective way to wrap a mask around the entire planet object?  What's the most effective size/resolution for a planetary mask file?  Note, I'm primarily asking about masking terrain nodes, not surface shaders, although I'd most likely use the same masks, or variations, to apply to surface shaders as well.



You use an image map shader with spherical projection.  Your mask should be twicce as wide as it is tall. - A great Terragen resource with models, contests, galleries, and forums.


You're going to run into ugly artifacts - "bunching" at the poles in particular - unless you convert your image map into spherical projection first. Some image editors can do this, but it often results in loss of data. Ideally your actual creation tool would allow such projection, but World Machine doesn't at this time and I'm not aware of many (or any) other terrain editors that do. Lunar Cell can create such maps I believe, but the process is not very explicit or controllable as you probably want.

- Oshyan


March 20, 2007, 05:19:42 pm #3 Last Edit: March 20, 2007, 05:49:15 pm by mrwho
i'm trying this too, but I'm using a surface shader for my planet. It's set to spherical, and set at 'position center' with the planet's coordinates as the x,y, and z values. But when I render, the image isn't visible (it's like it was before I applied the image map) What should I do.....


March 20, 2007, 05:31:11 pm #4 Last Edit: March 20, 2007, 05:59:31 pm by Arandil
Thanks guys.  Actually, I do have a program that can spit out spherical projection maps, PlanetGen.  It's a bit like Lunarcell, not quite so sophisticated, but I'll see what I can do with it.  It outputs two image files, a climate map and a relief map, using custom colors.  I changed the colors to greyscale and voila, a bump map.  I think it'll probably do as well as Lunar cell at continent shapes, et. al.

Hmmmm, I have yet to find a square to spherical projection conversion program, but then, I haven't really looked yet.  If I find one I'll post on it.

I'll give this a try now.


Here's a link to PlanetGen, beta 4.  Looks like it hasn't been updated since July 2006, might have to contact the developer and see if they'll be taking this out of Beta at some point.  Could be handy.

BTW, I have Photoshop, does anyone know if PS can save spherical projection images?


March 20, 2007, 05:56:04 pm #5 Last Edit: March 20, 2007, 06:00:25 pm by Arandil
Results inconclusive, I may need to move the camera (might be looking only at an area affected by my mask), select a more restrictive image map (to more easily see the effect wherever the camera happens to be looking), change the bit depth of the mask (have to check and see if it's 8-bit grayscale, or 16-bit color that happens to be gray), or adjust where I'm applying the image mask node and/or it's parameters.

BTW, does it matter if the image map is 8-bit or 16-bit?

Ok, so what I did what create an image map shader (from the surface shader menu, is there a difference between the image map shader that appears in the surface shader list and the image map shader that appears in the colour shader list?), load my image mask, and plug the image map shader into the Blending shader input on my root (first) power fractal terrain node.  All other parameters are default, just to see what happens.

My expectation is that the image mask should limit the distribution of the mountainy power fractal terrain.  I can't see this happen yet.  Do I need to enable displacement or change one of the default parameters?  I have to bail on this test for a bit, but I'll get back to this when I can.

Thanks for the help!


A 16 bit mask would be preferable for simple accuracy and detail, but 8 bit should work ok for larger-scale features such as contintents.

The Image Map Shader is the same whether created from the Surface Shader list or the Node Network.

If you've plugged an Image Map Shader into your Power Fractal you should make sure that "Blend by shader" is enabled, of course.

In this case the Image Map Shader starts out with an image only 1x1 meters in size (most things in TG2 are measured in meters). So you're probably not seeing results just because the image map is too small. Make it a more reasonable size in meters (10,000x10,000 perhaps) and you should see results.

- Oshyan


March 20, 2007, 07:30:45 pm #7 Last Edit: March 20, 2007, 07:39:56 pm by Arandil
Check!  Thanks Oshyan, I'll twiddle and update here.

On a side note, I found a command line fractal terrain generating program that may be useful for creating landscape masks like the ones I was looking for.  It doesn't say it outputs to spherical, but it does output to mercator which may be close enough (the same?).  I don't understand the math behind the projections (yet ..  ;)), trying to wrap my head around too many things at once, but I just ran a quick test and apart from editing a custom color scale for the image output, I think it may work pretty well for generating large feature masks.

Down towards the bottom of the page are links to the source and a precompiled windows binary.  The command line options are in the readme.  Enjoy!

EDIT: With respect to the pixel dimensions of a given mask image file, are there any guidelines?  If I create two identical images, except that one is twice the pixel resolution of the other, what impact would this have on the result?  Would there be an "optimum" pixel resolution for an image file intended to mask an Earth sized planet?

Thanks again!

EDIT AGAIN: So, if I understand you correctly, I'd need to scale up the size for the image map shader so that it spanned the circumference of the planet object in meters, yes?


If you want your image to cover the entire planet, better to put it into Spherical Mapping. Then you specify the center of the planet as the position of the image and I believe you also have to specify the size as the total size (diameter, not radius) of the planet, though that latter bit may not be necessary.

As far as resolution goes, the necessary detail will depend entirely on how far away you are viewing your planet from and what resolution you render at. The closer you are the more detail you'll need and likewise with higher resolutions - it goes up rather quickly. A 2000x2000 image may be fine from orbit where you can see the entire planet in view and rendered at 800x600, but even going down to a view showing half the planet and you'll want to at least double your image size. 16,000x16,000 or larger images are not uncommon for good Earth-like detail from low orbit. Obviously as you get even remotely close to the ground (within the atmosphere) you're going to need either a ridiculously high resolution image map, or to use procedurals or local heightfields to fill in the detaill.

- Oshyan


March 20, 2007, 08:03:18 pm #9 Last Edit: March 20, 2007, 08:28:15 pm by Arandil
Gotcha.  Yep, what I'd like to do is have a handful of masks image files to define where things should _go_.  I.e. Where are the continent outlines, where is the mountainous terrain, where is the highland terrain, lowland terrain, plains, etc.; use image masks to distribute the nodes.  I'm aiming to have the image map shaders drive the distribution of different fractal terrain nodes, but not (at least at this point) necessarily displace them or (ideally) have any impact on actual terrain details apart from "put this much here".  Are you implying that pixel depth for the image maps could introduce height stepping/terracing at low viewing latitudes if the resolution isn't high enough?  It's a bit of a black box to me still, but that won't stop me...  ;)

EDIT:  Side question:

It seems like location 0, 0, 0 is somewhere on the surface of the planet object.  In one sense, having 0, 0, 0 as the center of the planet object and reference all node locations to that would be useful, at least for some things.  I'm thinking in particular of using data generated by Orbiter within TG2, and it would be simpler to assume that 0, 0, 0 is the same in both applications.  If I could set the planet object center to 0, 0, 0 in TG2, and work with everything from that reference, it'd be handy.  If that's not a valid or feasible approach, I'll have to remap the values accordingly.


Yes, you might see "stepping"/accuracy issues at lower altitudes using 8 bit masks even if you're using it just to mask procedural terrain.

Changing the planet center point to 0,0,0 is a very valid approach. As long as you do so at the start of scene modeling it should be fine. Moving the planet after you've setup terrain or textures can cause problems of course since everything is relative to absolute coordinate origin and not the planet.

- Oshyan


Awesome!  I'll give that a go.  I can see how 8-bit might introduce stepping, I was wondering if you could expound on your statements regarding image file pixel dimensions. 

I'm just diving into using image masks now and although I can see results, I'm unable to predict them.  Not sure if I need to increase the contrast in the image file to make the boundaries clearer or not.  Experimented with using the same image mask to distribute a surface shader, still diving in head first with no clue ...  :D


The sizes I gave were approximate. You'll really have to do your own experimentation to see what's acceptable to you. But it's a different story given that you're just using it to mask procedurals. TG2's image interpolation functions are fairly good and when mixing with procedurals it's possible that evidence of low resolution masks could be reasonably easy to hide.

As for messing with contrast, etc. I suggest using the Colour Adjust Shader inside TG2 rather than messing about in an external app. It won't give you everything you need, but it should give you enough to find out whether your mask just needs contrast, or is otherwise fundamentally flawed.

- Oshyan


Good idea, I'll try the color adjust shader next.   :)


Oh hey, someone linked to this thread so I'm dropping a note in it. 

I did in fact get somewhere with this, but then real life intruded hard.  To fill in the background a bit, I was toying around with Fractal Terrains, got something I liked, tweaked it a fair amount in FT, saved some grayscale images from it (land/sea mask, bump map, climate, temp map and precip map), futzed around with the bump map output in Wilbur for a bit, then successfully utilized the land sea mask to get a coastline (land/sea mask = blend shader input) and the futzed-with bump map to tease out some procedural mountain ranges (blend shader input again).   When I left off (lo, these many moons ago ..) I had something going with this, though I'm really still at the beginning.

I won't have time for this for some time (hey look, English can do tricks!), but here's nibbles of what I left off with.