Generate displacement map


#1

Hello

Are there any tutorials on diplacement map generation from a deformed model?

Just want to add abilitiy to store deformations made by custom modifier in a displacement map.
I mean some kind of “Generate displacement map” button like in ZBrush or Mudbox packages.

Are there any open source examples or displacement map generators?

I’m in 3dsmax but any idea is greatly acceptable.


#2

Not that i’ve ever attempted it, but I couldnt imagine the math would that hard.

  1. Store the original location on P (eg pref in renderman)
  2. Minus the modified (displaced) P from the original P (pref)
  3. Save to a map.

Or something like that.


#3

Thanks for your answer

I have some kind of algorithm.

Basically it should work as follows:

  1. Create empty texture file and fill it with some default color (black or gray)
  2. Compute vertex shift and corresponding color value of that shift.
  3. Find out vertex position in uv space.
  4. Paint pixels in that place with color from 2
  5. Repeat for each vertex

But there are some questions I did not fully understand right now, that’s why I’m asking for an example :slight_smile:


#4

this really depends on what exactly you are doing

of course you can compute and store the displacement of each vertex but keep in mind that you want to store a texture which has values per pixel not per vertex. so what happens between 2 vertices? is your mesh smothed? you’d need to do the proper interpolation to get the correct displaced values

grs
Patrik


#5

If you simply want to generate a displacement map then you could export your deformed mesh and the original mesh as separate objs and use xNormal to generate the displacement map.

If you want to do it within your tool then I think xNormal provides a SDK which you could look at. Another one that I found on google: http://sourceforge.net/projects/denormgen/


#6

That’s very useful.
Thanks a lot!


#7

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.