Is there any way to generate automatically a displacement map… What I want to do is this:
From my diffuse map I generate a normal map ( RGB already done using Valve code…)
From this normal map I want to automatically generate a displacement map ( grayscale ~ A ).
So I can use the combination of both for parallax or relief mapping using GLSL. Does anyone know how to generate automatically a displacement map?
Tks in advance,
From this normal map I want to automatically generate a displacement map
Not really. The accuracy of your normal map is already suspect given the fact that it was generated from an image, not actual geometry. Any technique you might use to generate a displacement map would only increase the inaccuracy.
You could look at ‘normal2depth.exe’, which was written by Fabio Policarpo to generate the height maps he used in his first tests/demos of parallax mapping.
Any technique you might use to generate a displacement map would only increase the inaccuracy.
Fair enough… so what are my other options in order to generate a displacement map without having to load 2 million polygon model?
Nicolas: wow, sound like exactly what I need any idea if the source is available somewhere?
Do it by hand, it’s that or using the 2 million polygon model to sample from.
The math is rather simple, you could write this tool by your own.
Given bump-map is a heightfield, representing dh/dx and dh/dy.
Simply integrating it and centering the result will give you what you need.
Jackis: Can you elaborate on that a little… especially about the math part…
bobgl, what do you hope to achieve?
It’s all frigs and hacks if you’re not referencing real geometry.
You can also check CrazyBump…
wow! that’s a seriously nice piece of free software! thanks for the reference.
yep cheers ild never heard of it before
gets my vote for the best tool of the year
interface is a bit kudgy though (beautified at the cost of ease of use)
I like the interface, it reminds me of zbrush.
Well that’s like exactly the result Im looking for… but I need to do it in code…
Any ideas where I can get some reference?
I already nailed the normal map part, but have no clue how to generate the displacement map as showed on their website?
You could ask ryan in crazybump’s forums I guess for some references… the displacement map is actually the occlusion map with probably different settings.
Well this druid won’t reveal the secret of the magic potion, he’s too much david copperfield, I need an open source minded druid I guess
Anyone have any idea how he do it? Any help would be greatly appreciated here… (since him stuck for a while and still don’t have an answer)
So does anyone have an idea of the algo. behind crazy bump to generate the displacement map from texture?
As jackis wrote previously - you would do integration across the normal-map, and approximate each pixel with a slope according to the normal. If you find it difficult, think about converting a single line of pixels at a time.
And be warned - korval and knackered will not approve of your actions
Ah, sorry, your question was about how the author of CrazyBump wrote his algo. I have only general thoughts, and they may be not correct. I’ve never tried to do this because I just never had to do this ))
If you want to wrote smth like this, first of all I’d recommend you to get more familiar with vector math and analytic geometry (how normal maps are got, what they are and so on).