Procedural Detail Map generation - How to?
Hi;
I have a big terrain which I want to cover with two textures: First is the coarse,low frequency ground texture. I procedurally create this by mixing grass,dirt,snow and rock textures at different
ratios for different heights. This covers the whole terrain without tiling; so it gets extremely magnified
and blurred. To add fine details to this blurred ground; I use a second,grayscale "detail map" texture.
It gets tiled on the whole terrain to add high frequency information.
What I am doing is common multitexturing, I just blend these two textures in the pixel shader.
My problem here is, I just have one detail map, which I found on the internet long ago. Just like the ground
texture, I need to generate this detail map procedurally,too. Normally, I generate heightmap images
with the perlin noise algorithm. I tried to generate different detail maps with the perlin noise,
using different parameters(frequency,amplitude,octave number) every time, but I could never obtain the desired image.
Here is the detail map I am using at the moment:
http://img15.imageshack.us/img15/9169/detailqd7.png
So, my question is how can I procedurally generate similar detail maps? Which methods do you follow in your programs
to add high frequency detail to the terrain?
Thanks in advance.
You could try "Texture Bombing" (In the Orange Book its called Glyph Bombing).
With this technique you distribute a texture randomly over the surface ( and if you want you could scale and rotate the texture randomly, but this will cost some performance).
If you have not the orange book, you could find an Article with Texture-Bombing here:
http://http.developer.nvidia.com/GPUGems/gpugems_ch20.html
I hope this will help you out! :)
With this technique you distribute a texture randomly over the surface ( and if you want you could scale and rotate the texture randomly, but this will cost some performance).
If you have not the orange book, you could find an Article with Texture-Bombing here:
http://http.developer.nvidia.com/GPUGems/gpugems_ch20.html
I hope this will help you out! :)
Straight perlin noise isn't going to cut the mustard, you need to mix a couple of noise generators. The plus to implementing this is that everything looks more natural with a mixture of noise types [smile]
For the cracked mud pattern in that texture, I would recommend a voronoi cell generator. For the larger, dark cracks a ridged multi-fractal ought to do the trick, and you can fill in the high frequency details with perlin noise.
For the cracked mud pattern in that texture, I would recommend a voronoi cell generator. For the larger, dark cracks a ridged multi-fractal ought to do the trick, and you can fill in the high frequency details with perlin noise.
Well, actually I wanted to use normal mapping to add detail and lighting to my scene. Everything has worked fine until I realized that it wouldn't go along with my geomipmapped and geomorphed terrain: The TBN data bundled with the vertices just doesn't get interpolated and this results in abrupt lighting changes when the terrain LOD switches.
If I had a way to interpolate the TBN spaces between GeoMipMap levels, this would work me too and in a very good looking way.
So is there any way I can make the normal mapping and terrain geomipmapping compatible with each other?
If I had a way to interpolate the TBN spaces between GeoMipMap levels, this would work me too and in a very good looking way.
So is there any way I can make the normal mapping and terrain geomipmapping compatible with each other?
Quote:Original post by 67rtyusI generate my terrain normal maps in object space (rather than tangent space), so the a TBN basis is unneeded. This seems to reduce popping due to LOD pretty well on its own.
Well, actually I wanted to use normal mapping to add detail and lighting to my scene. Everything has worked fine until I realized that it wouldn't go along with my geomipmapped and geomorphed terrain: The TBN data bundled with the vertices just doesn't get interpolated and this results in abrupt lighting changes when the terrain LOD switches.
The best way i've found is while creating your texturemap from different height, create One Alpha (ARGB) map containing detail level for each detail mpa. , .Example:
In a BMP file.
A = % of grass
R = % of rock
G = % of sand
B = % of dirt.
Then, you load your 4 (small) detail map + your alpha + your terrain texture in DX.
In you shader you create a sampler for each texture.
you
ADDRESSU = WRAP;
ADDRESSV = WRAP;
your small detail map.
and
And in your pixel shader, you lerp each detail map by there respective alpha map.
lerp(CombiDetail, Sand, AlphaCombine.x);
you then Add-signed your detail map to your texture map. And you got a nicelly blended result. ( you can also multiply square the two texture, but you'll have a nicer result, but you'll see more tiling from distance).
you can see the result there
http://www.jpdoiron.com/map/
Let me know if that was not clear.
JP.
note: to save vertex shader processing, you can skip you detail calculation when you vertex if too far from your view.
In a BMP file.
A = % of grass
R = % of rock
G = % of sand
B = % of dirt.
Then, you load your 4 (small) detail map + your alpha + your terrain texture in DX.
In you shader you create a sampler for each texture.
you
ADDRESSU = WRAP;
ADDRESSV = WRAP;
your small detail map.
and
And in your pixel shader, you lerp each detail map by there respective alpha map.
lerp(CombiDetail, Sand, AlphaCombine.x);
you then Add-signed your detail map to your texture map. And you got a nicelly blended result. ( you can also multiply square the two texture, but you'll have a nicer result, but you'll see more tiling from distance).
you can see the result there
http://www.jpdoiron.com/map/
Let me know if that was not clear.
JP.
note: to save vertex shader processing, you can skip you detail calculation when you vertex if too far from your view.
swiftcoder:
How do you do that exactly? In my case, I have a 512x512 seamless normal map texture and I cover the whole terrain with it, tiling the texture many times. The texture itself contains normals in texture space.
Do you embed the object space normals into a texture image,too ? If you do, how do you manage to embed the whole terrain surface's normal data into it? I mean, the terrain is usually supposed to be huge and a texture to contain its surface normals in terrain object space has to be excessively large. If a normal map texture of common sizes of 512x512 or 1024x1024 should be used instead, it would get streched so badly, that our purpose of adding high frequeny data to the terrain would diminish.
jpd:
I am afraid, I didn't completely understand that. Could you explain a little bit more? Or maybe a little bit of sample code?
Quote:I generate my terrain normal maps in object space (rather than tangent space), so the a TBN basis is unneeded. This seems to reduce popping due to LOD pretty well on its own.
How do you do that exactly? In my case, I have a 512x512 seamless normal map texture and I cover the whole terrain with it, tiling the texture many times. The texture itself contains normals in texture space.
Do you embed the object space normals into a texture image,too ? If you do, how do you manage to embed the whole terrain surface's normal data into it? I mean, the terrain is usually supposed to be huge and a texture to contain its surface normals in terrain object space has to be excessively large. If a normal map texture of common sizes of 512x512 or 1024x1024 should be used instead, it would get streched so badly, that our purpose of adding high frequeny data to the terrain would diminish.
jpd:
I am afraid, I didn't completely understand that. Could you explain a little bit more? Or maybe a little bit of sample code?
I might also have misunderstood you,
You're talking about detail map , and also normal map. both are use for totally different objective.
Normal map will be used with your light to generate "shadow" detail where you dont have, It gives the impression of detail, that move with your light and view vector.
Detail map in the simplest way of adding noise to a texture map, It also give the impression of a much more detail texture, but without light, view calculation.
For what i've read in to your description, your trying to have different detail over your big texture, grass, rock.. but only have one detail map.
If this is the case, forget about the normal map, and look into texture spatting
http://www.gamedev.net/community/forums/topic.asp?topic_id=372098
http://www.gamedev.net/reference/articles/article2238.asp
And save you some time, dont generate you detail map, find them on the net.
hope this helped.
jpd
You're talking about detail map , and also normal map. both are use for totally different objective.
Normal map will be used with your light to generate "shadow" detail where you dont have, It gives the impression of detail, that move with your light and view vector.
Detail map in the simplest way of adding noise to a texture map, It also give the impression of a much more detail texture, but without light, view calculation.
For what i've read in to your description, your trying to have different detail over your big texture, grass, rock.. but only have one detail map.
If this is the case, forget about the normal map, and look into texture spatting
http://www.gamedev.net/community/forums/topic.asp?topic_id=372098
http://www.gamedev.net/reference/articles/article2238.asp
And save you some time, dont generate you detail map, find them on the net.
hope this helped.
jpd
Quote:Original post by 67rtyusNo, I don't tile the normal map - it is unique for every terrain tile.
swiftcoder:Quote:I generate my terrain normal maps in object space (rather than tangent space), so the a TBN basis is unneeded. This seems to reduce popping due to LOD pretty well on its own.How do you do that exactly? In my case, I have a 512x512 seamless normal map texture and I cover the whole terrain with it, tiling the texture many times. The texture itself contains normals in texture space.
Quote:No, I don't tile the normal map - it is unique for every terrain tile.
OK; but doesn't a unique normal map for every terrain tile cause a very high memory consumption? For example my 1025x1025 terrain consists of 256 65x65 tiles. This means 256 seperate textures for every terrain node. How do you manage the memory management of this system? Can you give more details about this?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement