I do a fair amount of work with people in urban planning. Realism in those virtual environments is the starting point for the imagined plans they have in mind. The very first thing they want is the realistic terrain of the area. It has proven difficult to get the elevation data of specific areas, but we always end up finding it in some obscure place or other. Unfortunately, the terrain by itself doesn’t quite give the feel of the area as it exists today. Instead, it gives the feel of the area as it might have existed 10,000 years ago! — no signs of human civilization. Which, as nice as that may be, doesn’t quite do the job for urban planning. This weekend I was finally able to generate realistic terrains in OpenSim overlayed with a realistic image. Here is the story.
Terrains in OpenSim/Second Life have always been a source of frustration for me. The problem is that the standard terrain in OpenSim/SL is textured with an inflexible combination of 4 textures, the details of such combination being completely hidden from us. We cannot do the simplest and most natural thing, which is to overlay one existing image on top of it. I have no idea why Linden Lab made this decision, as it seems like the single texture approach would be easier to handle than the complicated generative algorithm they have. But that’s what we have to deal with.
So far, my urban planning colleagues have managed to stay away from areas with interesting terrain, so we’ve simplified by flattening the areas and using mega-prims overlayed with the aerial images. However, recently we had to deal with an area with a non-flat terrain, and I could not escape the issue. Luckily the stars were aligned to my advantage.
My attraction to terrains is nothing compared to Nebadon‘s obsession with them. From all I can tell, he has spent hundreds (thousands?) of hours working on producing the most amazing sculpt-prim terrains. Here is an example, and here is another one. So I turned to him. We were talking about terrains last week, when he casually mentioned that Adam Frisby had given him a program that takes a heightmap and a texture and generates sculpt-ed terrain overlayed with the texture. That’s how he had been producing those amazing terrains. The tool was very rough, and he still had to do a huge amount of work manually. But at least the core of the algorithm for generating sculpties from heightmaps was there! I was excited, and quickly dived into the code — Nebadon was kind to share.
It took me about a day (yesterday) to clean that code up, and to understand the math, but I finally have the tool I wanted for the past three years! The result can be seen in the picture above, as well as many more pictures if you follow the link to Flickr. The tool now is completely parametrized, and, additionally to the textures, it also generates the prims themselves. Everything is automatic. I have a feeling I’m going to spend a lot more time on this amazing tool… at least until some viewer does the right thing and let us place our own images on the terrains.