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
- 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 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.
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
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.
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.