MINI TUTORIAL: Making Cloud Textures With Transparency.

Tips for creating and manipulating planet textures for Celestia.
Topic author
Spaceman Spiff
Posts: 420
Joined: 21.02.2002
With us: 22 years 4 months
Location: Darmstadt, Germany.

MINI TUTORIAL: Making Cloud Textures With Transparency.

Post #1by Spaceman Spiff » 19.07.2005, 21:24

Greetings Celestians!

This tutorial is in response to a request (How do I add transparecy?, http://www.celestiaproject.net/forum/viewtopic.php?t=7512 ) by ar81 for help on adding transparency (to cloud textures), followed by ElChristou's recommendation for it. The transparency action is in Step 13.

This tutorial will show you how to adjust cloud textures from this:

Image
(Celestia default Earth cloud map)

to this:

Image
(Earth cloud map based on NASA/GSFC Blue Marble/MODIS data, adjusted to my aesthetic tastes).

These show the North Pole of my Earth, and that using the right raw image and adjustment leads to a more realistic looking cloud pattern.

In my original post to the above topic, I was not specific to which graphics software to use, but in this, I'm using Paint Shop Pro. There are also other differences, and what I post here supersedes what I posted there.

Click on thumbnails to see full sized images.

So, let's begin.

Step 1. Open the raw image for clouds that you've created/downloaded/saved. I'm using the Blue Marble file located at http://visibleearth.nasa.gov/images/243 ... d_8192.tif . Remember kids! Check copyright before deciding whether to use someone else's raw image, especially if you are planning to include it in an Add-On distribution.

Image

Step 2. Save! the raw image as a PNG file. TIFs don't support transparency, and also this way you'll have the original TIF as a back up lest things go wrong.

Image

Step 3. In general, you probably need to adjust brightness/contrast settings of this image until the cloudless parts are absolute black (RGB=(0,0,0) - this will be 'no cloud') and the brightest clouds are absolute white (RGB=(255,255,255) - this will be 'totally opaque cloud'). There are three ways to do this:
i) Brightness/contrast.
ii) Gamma function.
iii) Histogram adjustment. This is the best if you have it, because it gives you the most control over what you do. Look for a histogram tool in your graphics software's menu. Here, you see the histogram tool being opened in Paint Shop Pro.

Image

Step 4. Now that the histogram tool is open, we see this:

Image

The histogram tool looks like a 'population count' graph (the red area in the white box). The tool has at top 'before' (left) and 'after' (right) preview windows which can be zoomed to any part of the image. The tool has (at least) four widgets to pull: dark tone, mid-tone, highlight and mid-tone compress, which start at grey levels 0, 128, 255 and compression factor 0 respectively. The way this works is that if you pull the dark tone widget above 0 to say 32, all pixels with grey levels below 32 will become absolute black, and the remaining pixel grey levels between this new dark tone and the mid tone are proportionately darkened. If the cloud map was a satellite composite like that from Blue Marble, there might be faint artefacts (usually quickly evaporating fog) that shows up as strips or seams. You can get rid of them using the histogram dark tone adjustment. I adjust the dark tone until the 'fog' disappears. Similarly with the highlight widget, you can make entire areas of cloud bright white by pulling that down from 255 to say 240. Finally, the mid-tone will behave a little like a brightness function (it's actually the gamma function), and brighten or darken the whole cloud map, while the mid-tone compress will enhance or reduce contrast by squashing or stretching the grey levels over a wider or narrower range of greys.

Let's use these to bring out and then eliminate artefacts in the raw image in Step 5 and after.

Step 5. I've adjusted the mid-tone to gamma = 2.00, but neither the dark tone or highlight. It's enough to show a strip of fog in the left and upper right of this part of the raw image (you'd have to sweep around the image to look for these, and make sure the brightness of your own monitor is high enough to see these dark grey areas!):

Image

Step 6. Now I've adjusted the dark tone to 16, and it's enough to make the fog disappear in the 'after' image, even though you can still faintly see it in the 'before' image. Even better, the clouds themselves are hardly affected.

Image

Step 7. Now, white clouds strike me as being very bright when seen from above (flying, Low Earth Orbit piccies), so I like to raise the brightness of the brightest clouds to maximum highlight. Here, I've adjusted the highlight to slightly below 255 (yes, I know it seems counter intuitive, but it's right), and this means some areas of clouds are pushed to the maximum brightness level of 255 - i.e., saturated white. Later on, it means those areas will be totally opaque, so you must think about whether you want any areas of cloud to completely cover what's below or not.

Also, I've increased the contrast of the clouds too by putting a negative mid-tone compress (i.e., an expansion) on (-16).

Image

Step 8. Mind you, if you just want a blandish fog, then adjust the mid-tone compress to restrict the range of greys, and adjust the mid-tone (gamma function) for brighter or duller fog:

Image

Step 9. Anyway, back to where I want it. Click OK to apply to final changes:

Image
[ OOPS! Cursor missing! Should be hovering over the OK button... ]

Step 10. Now you see how the histogram adjustment played out for the whole image - much more contrasty clouds, and no artefact fog strips.

Image

Step 11. Unfortunately, there are some artefacts that can't be eliminated this way. Here are duplicated clouds. There is also a 'seam' problem in this raw image at ?±180?°: the left and right edges of the raw image don't match up at latitudes near 20?°S, as discussed by one of our forum texturemeisters, Don Edwards.

Image

Step 12. ... and there are the coastal imprints. Here's the west coast of South America. Hello Chile, Peru, Ecuador! It's a natural effect, so there's no point complaining!

Image

Still, we now press on for transparency effects. Next step.

Step 13. This is how to make a transparency mask from the raw image in Paint Shop Pro.

Image

As you can see, select the menu Layers, New Mask Layer..., From Image... and...

Step 14. voila! transparency has been added. The chequered pattern is a common way of conveying degree of transparency in graphics. Now, if you look closely at the edges of the clouds, you'll see that they seem to have grey edges. This can cause the clouds in Celestia to look unreal and unconvincing.

Image

Step 15. Now, here's the clever part. Go back to (that is, select) the original layer that the mask was made from. It is the 'background' to the mask. Here's how you select that background layer in Paint Shop Pro:

Image

Step 16. Now flood fill the background with pure white (or whatever colour you want the clouds to be). Ensure foreground colour is white, or RGB=(255,255,255). Ensure tolerance is maximised (200) as this will mean the flood fill will occur with one click from anywhere in the background image. This image shows the flood fill happening:

Image

Note the 'paint bucket' cursor, and that the flood fill line has just reached it. You should be able to make out a subtle horizontal line, below which the clouds still have grey edges, but above which the clouds are lovely and nice and fluffy white.

Step 17. When the flood fill is complete, Save! the file as final.

Good! Now you are ready to use it for Celestia, you can turn it into a VT or use it as is.

Spiff.

Oh yes, and Thanks to ImageShack for Free Image Hosting.

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 4 months

Post #2by ElChristou » 19.07.2005, 21:36

For Photoshop users: to avoid grey cloud edge problems with transparency:

At step 13 we have our background filled with our black and white cloudmap.


1- Create a new layer (layer 1).

2- Select the background layer.

3- Click on the Channel Tab.

4- Command-click on the Grey Channel (if the image is in greyscale) or on one of the RGB channels to make a channel selection (black is transparent, white is opaque).

5- Select layer 1 (the selection is still active).

6- Fill the selection with pure white.

7- Delete background.

8- Save the file as a PNG.



Bye
Image

DaveMc
Posts: 79
Joined: 09.08.2003
With us: 20 years 10 months
Location: Woodinville, WA, USA

Post #3by DaveMc » 22.07.2005, 19:11

Great tutorial Spiff, thanks!

Another way in Photoshop to get the desired transparency is to use the Background Eraser tool. That's the way I've been making my cloud textures, but you do have to play with the settings a bit to avoid the grey cloud edge problem. I assume you can do the same thing in Paint Shop Pro although I haven't tried yet.

I do like the method you and ElChristou describe better. It's faster and seems to give great results with less tweaking.

Good stuff Guys!

Dave


Return to “Textures”