Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scaling Terrain Files

Front Dawes
Registered User
Join date: 28 Oct 2007
Posts: 76
09-08-2008 05:30
Hi,

When designing terrain in Photoshop, for example, you need to paint in shades of grey. The problem I have, when creating low-lying tropical islands, where the maximum height is just 25.5 metres, the grey level that this corresponds to means that the shades from black to the grey level corresponding to 25.5m are virtually indistinguishable.

So, what I would like to do is to paint in all shades from black to white, with all grey shades in between, then when done have the resultant greyscale image rescaled so that the white now corresponds to my maximum height of 25.5m, in other words scale 0-255 to 0-25.5 (ie divide all values by 10).

Does anyone know how to rescale in this way, using Photoshop or any other application?

Regards

Front
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
09-08-2008 05:50
Hi, Front.

You can use Photoshop's Level Adjustments for this.

Ideally, you'll have a version of PS that supports "Adjustment Layers". I believe CS2 and CS3 do, but I don't know about previous versions. See if you have "New Adjustment Layer" on your "Layer" menu.

If you do, create a new level adjust layer on top of all your other levels (Layer | New Adjustment Layer | Levels). Change the layer's name if you want to, and click OK.
In the "Levels" dialog that appears, change the second output levels box (bottom right) from 255 to 25. Click OK.

Just hide this layer while you work, so that you can see the full range of black to white, and show the layer whenever you want to save-as-copy the file.

If you have an older Photoshop you can still do this using (Image | Adjustments | Levels), but then you image must consist of only one layer, and that layer will be changed by the Levels command. You will have to undo the change after saving the file so that you don't lose your original greyscale.
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
09-08-2008 06:42
The previous poster gave you the easiest answer. But there is another approach you may want to consider.

When making terrain that you are certain will remain low-lying, it is often an advantage to use the "height multiplier" layer (Channel 2 in the .raw file) to improve your vertical resolution, at the cost of reducing the max possible height.

By default, a .raw file translates the greyscale values in your heightmap as being 1 meter for each level of grey - or a range of zero to 255 meters, with a vertical resolution of 1 meter.

But if you change the grey value in the height multiplier layer to a flood-fill of greyscale value 32, it divides pixel values by 4. The resultant elevations will be 1/4 of the original heightmap greyscale values, with a resolition of 1/4 meter verticaly. This gives you a height range of zero to 63 meters, and you use greyscale values that are exactly 4 times what you want. So for example a grey value of 200 on the heightmap, with a height multiplier grey value of 32, will result in a terrain height of 50 in-world. (I often use a grey value of 64 in the height adjust layer, which gives me a 1/2 meter vertical resolution.)

This also means that you can get MUCH smoother hills, since they don't have to use 1-meter vertical stairsteps to map out the terrain mesh.

There is one down side to this trick. SL does not do well at saving a terrain mesh that includes a height multiplier layer. You can upload one that you created in Photoshop, and it will exactly nail the desired heights. In the previous example, a plateau shaded as greyscale 200 with a height multiply greyscale of 32 will be exactly 50 terrain height, and a grey value of 199 would be 40.75 terrain height. BUT... if you export that .raw file back to your hard drive to edit it again... the height multiply layer isn't 32 any more. It's some other value, with the terrain greyscale levels adjusted so it works anyway, more or less. you would need to use the adjustment layer trick the first reply mentioned, to fix the layer, using a known height in the map to determine which way to tweak it.

What I have seen happen before is I would upload a terrain, and get perfectly smooth hills. The sim owner would save that, tweak it, and re-upload, and this time the hills looked terraced with stairsteps, because the intended vertical resolution, that used to be 1/2 meter or 1/4 meter, was now some other increment. So if you use this trick, always work from your Photoshop masters, and don't export and re-import.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.