PDA

View Full Version : Generate displacement map


_sarge
03-03-2011, 03:22 PM
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.

ndeboar
03-03-2011, 11:14 PM
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.

_sarge
03-04-2011, 06:54 AM
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 :)

Gravedigger
03-04-2011, 09:51 AM
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

noizFACTORY
03-05-2011, 05:45 AM
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 (http://www.xnormal.net/Downloads.aspx) to generate the displacement map.

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

_sarge
03-05-2011, 08:06 AM
That's very useful.
Thanks a lot!

CGTalk Moderation
03-05-2011, 08:06 AM
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.