I am currently working on recreating a city in Blender. I have two 3D versions of this city: the first one comes from my lidar data, therefore it is deformed and very "raw". The second one is a clean 3D version (a simple extrusion of the buildings from an openstreetmaps map), but the buildings do not have the good height.

I am very new to using python with 3D objects, but do you think it is possible to make a script that would make my clean 3D buildings automatically take the height of the buildings of the raw lidar version?

I would imagine, as an example, a script that would make my two objs have the same height when the x and y coordinates are equal?

I would appreciate any help, even by just telling me "where" I should look at to find answers.

Thanks in advance

Victoria H

EDIT 1: Here is an example of my buildings: on the right the "clean" one, which has wrong elevation, and on the left the one that comes from lidar data and is deformed but has good elevation Right: clean building that needs correct elevation, left: raw building

EDIT 2: I applied a shrinkwrap modifier, and the elevation infos seem to be correctly aquired by my "clean" buildings. However, they are slightly deformed on the x and y axis. Is there a way to apply this modifier only on the height of my objects (Z axis) and not on the x and y axis? We can see that the elevation is taken correctly by my building (the one that is selected), but the walls are leaning on the upper part

EDIT 3: here is a link to a blender file where I have saved 2 of these buildings:

SCREEN 4: enter image description here

EDIT 5: After using looptools to flatten the roof enter image description here

  • $\begingroup$ A picture of the "clean" buildings could help to see what is possible with shrinkwrap. $\endgroup$
    – lemon
    Nov 12, 2020 at 14:43
  • $\begingroup$ I added a picture, the selected building is the "clean" one, and the deformed shape that we see is the building from lidar data. On the picture, the shrinkwrap modifier is active, and we can see that the elevation is correct, but the walls are leaning $\endgroup$
    – Victoria H
    Nov 12, 2020 at 15:05
  • $\begingroup$ As indicated in the answer, keep only Z axis checked in the modifier (project option) $\endgroup$
    – lemon
    Nov 12, 2020 at 15:16
  • 1
    $\begingroup$ maybe uncheck "positive".My setting: i.sstatic.net/T2sgI.jpg $\endgroup$
    – lemon
    Nov 12, 2020 at 16:01
  • 1
    $\begingroup$ I checked "negative" and it works now, thanks a lot. The walls keep the good shape and the roof is aligned with the one of the lidar data. It is a bit deformed though, which I think is logical because the lidar building doesn't have a flat roof $\endgroup$
    – Victoria H
    Nov 12, 2020 at 16:05

1 Answer 1


Maybe the Shrinkwrap Modifier can help you out. (I think i unlikely but i though I'd propose the idea anyway, just in case.)

enter image description here

  1. Both cities have to be one object each though (Separate > By Loose Parts could be done later)

  2. And in this example (Mode: Project, On Surface) the blocks with the right height slightly overlap the map blocks so the map blocks vertices have a surface right above them to snap on to.


I suspected the top faced wouldn't turn out flat. But you can use LoopTools to fix that if needed.

Go to Blender Preferences > Add-ons. Search for "looptools", and check the box next to Mesh:LoopTools.

Go to the 3D Viewport and in a sideview (Numpad 1 or 3) you should be able to easily select all the top faces of the buildings (select the top vertices in Vertex Select and then switch to Face Select is best i think).

With all the top faces selected, press N to open the 3D Viewport Sidebar Panel (if it isn't op en already) and click the Edit tab. Extent the LoopTools menu. Extent the menu under the Flatten button. Choose Plane:View. Press Numpad 7 to go to topview and press the Flatten button.

All the faces should now be flattened while still being at their own respective heights.

  • $\begingroup$ I'll check that tomorrow, thanks for the answer! $\endgroup$
    – Victoria H
    Nov 9, 2020 at 18:30
  • $\begingroup$ I applied a shrinkwrap modifier to my object, and it works for the most parts: the roofs of my buildings align partly with the roofs of the lidar data. However, there is still a lot of deformations, probably due to the fact that my lidar data is so precise comparing to the buildings that I want to align with. $\endgroup$
    – Victoria H
    Nov 10, 2020 at 14:42
  • $\begingroup$ I also subdivided the blocks with the right height a couple of times, and then randomized the vertex positions slightly to see if it would also work if those blocks had a somewhat rough and/or more subdivided mesh/surface. Then I experienced some deformations, but found it was important that all the vertices (of both cities) on ground level had exactly the same height. I selected them all and scaled to 0 in Z axis. I doubt these are the same deformations you're talking about, but again, I'm sharing it just in case. In any case good luck (and maybe someone else knows a Python way to do it). $\endgroup$ Nov 10, 2020 at 19:28
  • $\begingroup$ Thanks for your comment, I also think that each object should be on ground level. When you used the shrinkwrap modifier, which wrap method did you put? I tried to use the "project" mode on the Z axis, but it doesn't work: the height are not correct and there are a lo of deformations horizontally. Only the surface point wrap method seems to work $\endgroup$
    – Victoria H
    Nov 12, 2020 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .