Editing Terrain or Raw Files with Photoshop

Photoshop

Camera Raw Open

I needed to edit a terrain file for one of my regions in OpenSim. Trying to smooth the terrain with the terrain editing tools in viewers just was not working. Whether one is targeting OpenSim or Second Life it is the same process. Photoshop is where the challenge is, getting a terrain.raw  or terrain.r32 file open in Photoshop. This article shares the information I found and avoids a lot of the link rot that has set in on this subject.

Terrain and Camera

When searching Google one quickly realizes there is more than one type of RAW file. RAW files are used for images files created by many scientific applications… and especially digital cameras. When searching for terrain tutorials on Google use the negative term –camera (minus sign/dash and a word) to exclude information about camera raw files.

Photoshop Plug In

Photoshop versions earlier than CS3 do not support the new Camera Raw plug in. The information for getting the plug in is here: Camera Raw 4.4.1 update. This gives you a file dated 3/2008. But, they include no instructions for the install on the download page. This is just an average run-of-mill file format plug in, so if you have been installing plug ins, just install it with the other file format plug ins. If you need help installing, look at: Camera Raw 4.4.1 Read Me.

The plug in file location you may be looking for is: C:\ Program Files\Common Files\Adobe\Plug-Ins\CS3\File Formats.

The image shows the setting to open a terrain file using the new plug in. The settings are:

  • 256 x 256 pixels
  • 13 channels
  • Interleaved
  • 8 bit depth
  • No header

Second Life Tips

SL has a wiki page on creating ‘height maps’ or raw files. See: Tips for Creating Height fields and Details on Terrain RAW Files. It is worth a read.

For Second Life Estate owners the information for saving and loading terrain files is here: How do I backup & restore private region terrain.

OpenSim Tips

OpenSim Server Commands will allow SIM owners to save and load terrain files.

An example command: terrain save c:\opensim\bin\my_terrain.png

You can save the terrain into several file types; jpg, tif, png, and r32 or raw. L3DT will open R32 files. I have problems with PS-CS3 not opening r32 files. I can rename them RAW and then open them.

Channels

You will probably notice the large number of channels shown in the Raw File Open dialog image. Each channel does something. The ‘somethings’ are explained in the SL wiki article above, Tips for Creating

The SL description of the Green Channel is confusing. The Green Channel is a multiplier or divider to increase or decrease the height one specifies in the Red Channel. The channels allow values from 0 to 255. To allow smoother terrain each unit in the Red channel gives you about 0.25 meters of height (about 64 meters). By making the Green channel value for any corresponding pixel 128 (50% grey – multiplies by 1) you can get 0.25 meter steps. To get smaller steps and less height use darker colors. To get larger steps and higher terrain, use lighter colors.

Use a blur to smooth out the terrain.

Importing Real Life Terrain

One can use files provided by the US government to get ‘real’ terrain for your region. There is a 2008 tutorial that explains how to do that. See: Tutorial: Getting Real World Terrains into OpenSim

Terrain Editors

L3DT is a free terrain editing tool. (Windows only). There is a pay-for and a free version, so don’t over look the free one.

Drawing Terrain

There is no other way to say it, it is tedious.

Do your drawings in RGB Color 8 bit files. You can just draw the terrain as you would paint any image. But before exporting as a terrain file, copy the image. Switch to Channels and paste the image in the Red Channel. Then fix your Green and Blue Channels. Fill the Blue channel with Red=20, Blue=20, and Green = 20 to set the water level at 20 meters.

In the Channels control panel select the Red Channel and draw in it. Blue is the water layer and setting the RGB color’s Blue to 20 and coloring it a solid color sets the water height at 20 meters. You can use other water levels, but 20 is usually the default. You’ll have to experiement with the Green Channel to see how it works. The more contract you have in your Red Channel the darker your Green Channel needs to be to flatten things and lighter to heighten them.

Using white in the Red Channel sets a maximum height and black the minimum.

Remember. Blur is your friend when making terrain.

4 thoughts on “Editing Terrain or Raw Files with Photoshop

  1. Several version of PS prior to CS3 support raw files that SL can import just fine. The various “RAW” formats that cameras and some scientific applications is a bit misleading as they do in fact often have some header information in them.

    In any event, I’m not sure why the SL Wiki decided to describe the green channel the way it did. The formula I’ve used on some of my test code is something akin to this:

    H = R * (G / 128)

    Where H is the resulting height in meters, R is the red value, and G is the green value.

    • The SL wiki entry appears to be missing words… Thanks for adding the formula. It makes more since than the SL wiki does.

      Header information is allowed in raw files. Some applications and many cameras add header data to their raw files, which is why there is a field in raw file open dialog for header length.

  2. Pingback: Quantum Grids | Creating 3D objects for Open sim Making Mesh objects and Landscapes

  3. Hi I’m trying to edit a raw file exported from a 2×2 varregion in opensim on kitely.com and don’t seem to be seeing things in the red or green channels other than a sort of diagonal grainy image with no obvious differences between what I know are high areas vs low areas in the sim (yes I’ve baked the terrain there already before downloading the RAW file). Since its a 2×2 I imported it as a 512 x512 rather than 256×256.

Leave a Reply

Your email address will not be published. Required fields are marked *