Reconstruct a displacement mapping texture by difference 2 geometries

Given 2 breps/surfaces I need to reconstruct the displacement image that was used. One is the non-displace geometry and the other the displaced geometry.

I have no idea how to approach this, so any advice would be appreciated.
As example i added a gh with a clean sphere and one with displaced texture of Einstein. The question is: how to reconstruct the original image by the local vertex difference between the 2 objects


I attach also a version of the highres mesh

einstein_mesh.gh (18.8 MB)
einstein_brep.gh (10.5 MB)

Making a good mesh was first step. Not refined.
I pulled the vertices to main sphere and remapped distance to color gradient. It looks good, although not sure how pixels and vertices are actually mapped (color pixel = mesh face + 1)

Now question is how to get from vertex color to flat mesh and then image. I think BitmapPlus has some component. I will try tomorrow

test_einstein_2.gh (19.0 MB)

this might be a way to start, it just overlaps coloured simbols on the initial brep sphere and a planar surface:

there are a lot of assumptions, like:

  1. aspect ratio of the image, we’ll never know for sure :slight_smile:
  2. color range: we’ll never know for sure :slight_smile: here I just assumed the closest Vertexes to the Brep are pure black and the farthest Vertexes from the Brep are pure white

one thing I would for sure leverage is the incredible power of UV + Reparametrize, by which you can easily translate from the surface of the sphere to a planar surface: with Pull Points you lose that possibility

in order to get a non-invalid mesh, I guess a solution might be to have a non fully-closed mesh… that would allow to deconstruct + construct using vertex colors and not have faces that would connect top+bottom and left+right the Pac-man way?

Eins_Re.gh (18.8 MB)