PDA

View Full Version : Displacement Map:



bobGL
12-04-2007, 10:21 PM
Is there any way to generate automatically a displacement map... What I want to do is this:

1. From my diffuse map I generate a normal map ( RGB already done using Valve code...)

2. 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,

Cheers!

Korval
12-05-2007, 12:07 AM
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.

Nicolas Lelong
12-05-2007, 01:00 AM
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.

HTH, cheers.

bobGL
12-05-2007, 01:12 AM
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?

bobGL
12-05-2007, 01:16 AM
Nicolas: wow, sound like exactly what I need any idea if the source is available somewhere?

zeoverlord
12-05-2007, 12:47 PM
Fair enough... so what are my other options in order to generate a displacement map without having to load 2 million polygon model?



Do it by hand, it's that or using the 2 million polygon model to sample from.

Jackis
12-06-2007, 07:19 AM
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.

bobGL
12-07-2007, 08:00 AM
Jackis: Can you elaborate on that a little... especially about the math part...

Cheers!

knackered
12-08-2007, 11:16 AM
bobgl, what do you hope to achieve?
It's all frigs and hacks if you're not referencing real geometry.

babis
12-09-2007, 10:55 AM
You can also check CrazyBump..

knackered
12-09-2007, 02:45 PM
wow! that's a seriously nice piece of free software! thanks for the reference.

zed
12-10-2007, 02:21 PM
yep cheers ild never heard of it before
http://www.crazybump.com/
gets my vote for the best tool of the year

interface is a bit kudgy though (beautified at the cost of ease of use)

knackered
12-10-2007, 02:50 PM
I like the interface, it reminds me of zbrush.

bobGL
12-10-2007, 05:58 PM
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?

babis
12-10-2007, 07:14 PM
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.

bobGL
12-10-2007, 10:01 PM
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)

Cheers,

bobGL
12-12-2007, 05:36 PM
So does anyone have an idea of the algo. behind crazy bump to generate the displacement map from texture?

Mikkel Gjoel
12-14-2007, 04:51 PM
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 ;)

Jackis
12-16-2007, 09:32 AM
bobGL

look here:

http://66.70.170.53/Ryan/heightmap/heightmap.html
http://www.cournia.com/devnull/n2h/n2h.pdf

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).