L3DT users' community
Large 3D terrain generator

A way to add detail map to Terrain?

Got a problem or need advice?

A way to add detail map to Terrain?

Postby ShadowIce » Tue May 03, 2016 2:44 pm

Hi Aaron. I would like to know if there's a way to define a detail map & to bake it into the Terrain for Export? I would like my Terrains coming out similar to that of Skyrim.

Thanks again for your help! =)

ShadowIce*~
ShadowIce
Luminary
 
Posts: 76
Joined: Fri Aug 05, 2011 6:11 pm

Re: A way to add detail map to Terrain?

Postby Aaron » Wed May 04, 2016 9:33 am

Hi ShadowIce,

What file format are you using for the terrain, and what rendering environment / game engine are you using? Not all file formats support detail maps, and not all renderers/engines will understand how to load detail maps from all terrain files.

Regards,
Aaron.

PS: I'm assuming you don't want L3DT to actually bake the detail map onto the texture, correct?
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: A way to add detail map to Terrain?

Postby ShadowIce » Wed May 04, 2016 7:53 pm

Actually, yes. that's what I meant. So I can have the option of MUCH higher detail exporting. =)

Thanks again Aaron! =)

~ShadowIce
ShadowIce
Luminary
 
Posts: 76
Joined: Fri Aug 05, 2011 6:11 pm

Re: A way to add detail map to Terrain?

Postby Aaron » Thu May 05, 2016 12:57 pm

Hi ShadowIce,

Okay, sure. What you want is already automatically supported by L3DT, but are you really sure that's what you want? The numbers are a somewhat challenging. If you want the same level of detail as a rendertime detail map, but with the detail map baked into the texture, please consider the detail map in Sapphire:

Image

[left without rendertime detail map, right with rendertime detail map]

In Sapphire, there are 64x64 detail map pixels for every heightfield pixel, whereas typically there might only be 4x4 texture pixels per heightmap pixel, which means the detail map is 16x more detailed than the texture map (the numbers change with texture resolution, of course). To have the same quality with the detail map actually baked onto the texture, the size of the texture pixel would have to be the same as a pixel in the rendertime detail map. This means the texture resolution would need to be 64x also. Thus, for a typical 2048x2048 pixel heightfield, the texture map would need to be 131072x131072 pixels. Is your engine/renderer set up for that much texture data?

If so, then it's pretty easy to bake the detail map onto the texture in L3DT. In fact, a detail map is automatically baked onto the texture when it is generated at a sufficiently high resolution (at least 8x for most materials, but this is configurable in the material editor). The baking is done in the texture generator, not the exporter, but the operations are exactly equivalent and the results are exactly the same, except that it's faster to do it all in the texture generator. Here's an example, using a 32x texture with the detail map baked in, and no rendertime detail map in Sapphire:

Image

Image

[FYI the heightfield was 256x256px, and the texture was 8192x8192px]

Just in case you're wondering whether you can get equivalent quality by baking a detail map onto a lower resolution textures; you can’t. The maximum possible detail of the texture is determined by the resolution of the texture; low-res textures can only ever give low detail, unless you use rendertime detail maps over the top. When it comes to detail, there is no substitute for pixel density.

So, your option for Skyrim-quality terrain are basically two. Either you:
  1. Apply the detail map at rendertime. This keeps the texture size manageable, but you have to work out how to set up your rendering environment to do rendertime blending of the detail map, or;
  2. You bake the detail map onto the texture. This saves you from having to blend in a detail map at rendertime, but also means you've now got to work out how you're going to render multi-gigabyte megatextures in your game engine/renderer, which may be much harder. You'll have to think about implementing level of detail paging for the texture data, because it probably won't all fit on the GPU at once, and certainly not as a single texture plane.
In OpenGL/DirectX (and presumably most game engines), the first option is really easy, which is why we all use rendertime detail maps. The latter option is the more courageous choice, which is occasionally, but very rarely, used in games. If your chosen renderer/engine doesn't support megatextures out of the box (few, if any, do), you may be up for some moderately clever programming. It's not impossible, but it is non-trivial. Sapphire does it, after all.

Best of luck either way.

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: A way to add detail map to Terrain?

Postby joehot200 » Thu May 05, 2016 3:58 pm

Apologies if I'm butting in here. As I said in another thread of mine, here is before a detail map:

Image

And here is after one:

Image

I'm just posting these here to show you the "power" of detail maps on low-resolution textures. They can be really effective. A high-resolution texture is a lot of RAM that most PCs cannot afford.

These detail maps are applied at runtime, in the fragment shader, using the same detail map as L3DT uses.
joehot200
Member
 
Posts: 15
Joined: Mon Nov 23, 2015 10:48 pm

Re: A way to add detail map to Terrain?

Postby ShadowIce » Thu May 05, 2016 8:48 pm

Thanks alot, both of you! :) You're not butting in, mate! You've shown me some REALLY lovely maps. Might I know the parameters of what you guys use to achieve this in L3DT?

Thanks again!

Regards,

~ShadowIce
ShadowIce
Luminary
 
Posts: 76
Joined: Fri Aug 05, 2011 6:11 pm


Return to Help and support

Who is online

Users browsing this forum: No registered users and 9 guests

cron