Tangent Space Vector Displacement Support for Displace Modifier

I have modified the source code of Blender 2.8 to add Tangent Space Vector Displacement (TSVD) support to the Displace Modifier.

Contrarily to the Cycles Vector Displacement Node, which supports Tangent Space Vector Displacements, this works both with Cycles and Eevee.

This is the result:

In order to use a Displacement Map, add a Displace Modifier to the mesh object with the following settings:

  • Direction: RGB to XYZ
  • Space: Local
  • Texture Coordinates: UV

You have to choose Local in the Space property because it is the mode I have overriden to work as Tangent Space.
I have done this in order to make a minimal modification of the existing code and not to break compatibility with the official release.

In order to generate a Tangent Space Displacement Map in Blender, I have also written a python script which will color the vertices of a target non-deformed mesh using the displacements of a deformed mesh vertices from the target mesh ones.
The script does the following operations:

  1. Given two selected objects (the active one being the non-deformed one), compute the displacements for each pair of corresponding vertices.
  2. Normalise the displacements dividing them by the length of the longest vector, so that every component is in the range [-1.0, 1.0].
  3. Assign the displacements to the target mesh as vertex colors.

Then the vertex colors can be baked in a texture using Cycles.

I hope this is useful to somebody!

Download links:

Blender 2.80 Custom Build and Script to Create Tangent Space Displace Map

Video demonstration

12 Likes

I have fixed a bug in the Blender build and updated the download link, please check the new version if interested, thank you!

3 Likes

Hi DamianoOriti,

I have test Vector Displacement Map quite a lot in Blender.

I came to your build because I was searching of any way some kind of Vector Map Brush could be implemented inside Blender.

I think having ‘‘tangent’’ inside the displace modifier is a great idea !
Below, I have show you two use case this could be use inside Blender.

The head was animated by controling the scale of the Vector Displacement Node. But there is no real way to create geometry with VDM at the moment. Having the option of your build could fill that gap.

Do you think you could create a patch to be review on blender.developer.org ?

Have a nice day !,
Francis

2 Likes

Hey there :slight_smile:
Not sure if this thread is still active but I stumbled up on your post while searching for Vector Displacement Brushes for Blender. I am planning to put some 3D-Scanned Vector Displacement Maps up on Blender-Market and would love to see this feature in Blender (Z-Brush has it as far as I know).

To get to the point. I have quite some experience in C++ and 3D-Graphics programming and worked on a research projects involving Vector displacement maps a few years ago. So maybe I can help to get this feature up an running.

@Francis Jasmin: maybe we can team up and continue your great work on VDM integration? Seems like others are interested in this feature too. I must admit though, I have not really worked with the Blender Source code yet and would appreciate someone to help me finding the ‘entry point’ for this kind of work.

2 Likes

Hi 0x0042 !

Yes that was my initial idea ! Would be cool to have VDM brush inside Blender as it would also create a market of vector map on Blender Market :slight_smile:

Did you read my post on Right Click Select ?

I have reas MANY thing about vdm in Blender, unfortunately Pablo Dobarro doesn’t seem to be thrill about it (see screenshoot below), but I suppose he could change his mind if someone sudmit a patch and there is enough “love” for it :slight_smile:

Now I have zero experience into programming, but I could support you with a even better right click select proposal.

I had made some test with “low” geometry and very low vector image resolution and the result were good if the vector map is not to complex (nose, eye, ect…).

I would propose that I update my right click select proposal with my test. Then you could write a devtalk post with your experience and my finding. Or even better subit a patch eventually !

https://developer.blender.org/D9380

Here is the test I did :

As you can see, even a super low VDM resolution & polycount can keep the original shape.

1 Like

Hi

I recently talked to Pablo on the blender Dev chat and I share you conclusion that he is not that much interested in it. However he also mentioned some technical reasons why it would make sense to implement the feature at a later point in time. Namely there are changes planned to the Texture system (unified Texture Nodes planned) that may affect a VDM implementation and he would also like to have a brush preset system in place first.
I would guess that it may be a year before those things end up in Blender Release.

I am actually not sure what to make of it. Appearently there have been VDM prototypes and Pablo also mentioned that he also played around with a VDM brush test-implementation in the past. So implementing another ‘prototype’ doesn’t seem to make sense to me. I feel its more about the decision to include it in Blender or not.

Anyway your Ear-VDM demonstration is quite cool as it showcases some really strong deformations, not possible with heightmaps. And I agree the value of VDMs, is that they are REUSABLE geometric ‘items’ that can efficiently store huge amounts of geometry while also working very well with subdivision surfaces and Multires sculpting.

bark01

4 Likes

Hi there,

Thx a lot for communicating with Pablo on Blender Chat, maybe I could have ask him directly before. I didn’t think about it. So thx for doing so.

It’s nice to heard it could end up in Blender. And I understand there are design limitation right now (brush & texture system).

Yes Vector Map have the advantage of permitting overhang of the geometry. As displacement (while easier to create) can only go from ‘‘big’’ to '‘small’ with no overhang.

Anyway.

What is the nice demo you just post ? Is that a VDM you render with the vector mapping node of the shader editor ?

Here are some others test I did :slight_smile:

Finally, do you know if Pablo had a look at this post or my Right Click Select ?

Thx a lot,
Have a nice day

White is just a plane with a VDM map. Color is the sculpt I have bake to get the map :slight_smile:

4 Likes

Hi Francis,

No he didn’t mention anything but we also haven’t spoken for too long. So I don’t know if he has actually read your post.

However I did read your post and I think its a great compilation of examples that really show the cool things you could do when having this in sculp mode. I think reusability is a big deal - for assets there are very good libraries and its easy to share 3d-models, for sculpting everything has to be done from scratch and VDMs could really help here.

The demo from my earlier post is a 1024x1024 VDM applied to a plane using the displacement modifier. The VDM was created from a 3D-Scanned mesh of a tree bark using a converter I am working on (outside of blender).
In Blender using the modifier works only on a plane though. I have tried it with a cylinder but the displacement modifier doesn’t support tangent space displacement (as this Threads title already states).
Maybe I try to tackle this problem first. Those changes will probably be less intrusive and easier than adding an VDM-Brush. Do you know which module the displacement mod. is in so I can contact the respective module manager ?

While waiting for blender to become ready for a real VDM brush integration we could also continue to compile cool examples to get more people hooked. If the demand for such a feature is high it would surely speed up the process of bringing it to blender.
I read that Eugenio Pignataro is also a big supporter of VDMs and a good artist, maybe he could help too.
I was even thinking about getting the Z-Brush or mudbox trial version to make some demonstrations.

What do you think?

Hi 0x0042,

Yea I don’t know who exactly is in charge on the displace modifier…

Seem modifiers ‘‘at large’’ belong to the Modeling module… See Wiki :
https://wiki.blender.org/wiki/Modules

Yea I had use the build mentioned in the threat (Tangent Space Vector Displacement Support for Displace Modifier) to make my demo. That build support ‘‘tangent’’ in the droplist of the modifier. But it’s an old almost pre 2.8 build. Not sure if you could take that old code and just submit it ?

I think we should start another thread with a better more descriptive name. Something in the line of :

-Vector Displacement Mapping for Blender
or
-Let’s make it happen - Vector Displacement Mapping (VDM) for Blender !

I wonder it you could make a really simple integration of a VDM for the sculpting tool. So that people could play with that build and post picture inside the thread. Note that I have ZERO knowledge of C++ so that I don’t know if that would be time consuming/possible for you.

Then, if you or another person happen to submit a patch, he/she could link that thread to the commit, or use a few example if needed.

So, what you think about making another more descriptive thread ?

Francis

ps : I didn’t know you could turn a 3D scan inside a VDM… That is pretty cool

1 Like

I have an idea to obtain an optimization of scrolling brushes.

To obtain the displacement map, you need two models and a UV coordinate map.
Thinking about optimizing the process to create sculpture brushes, I think it could be automated with a single click from a mask or a Face set.
“Sculpt mode / Edit face set / Fair tangency” allows to obtain a smooth base mesh without relief from any relief, to compare it with the original. A flat UV projection on the flattened mesh would allow the UV map to be obtained automatically.
Once the displacement is obtained, the sculpture brush preset could be assigned directly.
I think this flow would be very quick and practical, and would simplify the process of creating displacement brushes.

Thanks.

1 Like

Ahh that seem like an interesting idea :slight_smile:

A bit like automating this process ?

Maybe if you (or someone) has python skills you could make an addon…
Even sell it on Blender Market with a few Vector Map libraries and if it sell well it would show Blender dev there is demand for such feature :slight_smile:

1 Like

First of all hi, yesterday I posted a link to this thread because the script to bake the displacement to vertex colors, I think it would be the way to go to make vdm brushes and Pablo seems to be working in the asset manager workshop this week, so maybe this could be moved to master and we could have vdm brushes maybe too, the script is working in the 2.83 but in the 2.9+ you need to assign object.tsvd_to_color to a hotkey or to create a button instead of use the search menu, it would be nice to find somebody to update it to the new versions, and it would be nice to have some updates in the Pablo Dobarro’s master plan for sculpting and painting, development news too.

Install it as addon, it creates a button in the object data tab in properties.
Vector_Displacement_To_Color.py (4.8 KB)

1 Like