I’ve updated a branch with this modifier to github in case someone wants to play with it. It’s a bit hacky, right now needs to triangulate the mesh and it doesn’t auto-update when the material changes(not sure if that’s actually possible), but it works.
I’ve been thinking in how to get this functionality in a clean way into main Blender, and the best solution I can think of is a VertexBaking modifier. It would take a shader node tree and store the output as vertex colors/groups, so it could be used not only with the displace modifier, but with anything that takes a vertex group as a parameter.
It would also allow to easily pre-bake complex shader based masks (edge detection, ao…) on dense enough meshes.
And would open lots of possibilities for procedural modelling.
There are some issues that would need to be solved, though:
-
For this to be useful, vertex colors/groups should be stored at the modified mesh resolution. I skimmed the code and I think the only problem is that mesh customdata is not read back after applying a modifier, but It should be trivial to do so and store the result.
-
There’s the issue with evaluating the whole scene for baking. As a work-around I’m just creating a new scene with the only object being a copy of the mesh at the current modifier stack level. It’s ugly but works fine.
A cleaner solution could be to implement an option in the baking api to evaluate just a single mesh in isolation.
This could also be used as a replacement for the current texture nodes implementation when the internal renderer gets dropped, since material nodes are more powerful anyway. So texture node trees would be just like material node trees without shader nodes (Or just drop texture node trees and use material custom node groups instead?).
Opinions?