blosm icon indicating copy to clipboard operation
blosm copied to clipboard

Feature Request: Need square terrain! Ideally from center coord and Km extent

Open jgwinner opened this issue 3 years ago • 12 comments

I'm trying to mesh Blender-OSM (I paid for the Premium version) terrain and OSM data with some real world maps created via Vue and WorldMachine, and I'm having issues.

I realize when it comes to geo-coordinates, nothing is "square" really, but it seems like Blender-OSM makes it really easy to create rectangular extents that are basically impossible to make square.

It makes the tool fun to play with, but useless for matching.

Is there any way we could specify a center coordinate and square Km extent instead of non-square corners?

jgwinner avatar May 08 '21 22:05 jgwinner

Hi John!

Below is my solution.

Import the terrain with the coordinates containing the required square area. Create a box in Blender with the required dimensions. Create a boolean modifier for the terrain. Set the field Object to the cube object. Select Intersection for the boolean operation.

I hope it helps.

By the way. Why do you need the rectangular terrain?

vvoovv avatar May 09 '21 22:05 vvoovv

Unity uses square terrain nearly exclusively for it's game engine (as do most terrain modeling tools), usually based on height maps.

Vue uses a center coordinate and size (implying square) for all of it's imports (which have better hydrogical matching in that there are no tidal waves in the terrain). If I was able to import a square Blender-OSM terrain, I could figure out the center points from the corners, and then use that to line up the various terrains.

So I use a depth shader to export a bit map, essentially baking a 'texture' of the terrain which is actually the height map. I can then import into various game tools that can do weathering, erosion, create better rock textures than the satellite maps, etc.

Then I ran into the fact that the UV map doesn't go from 0-1, the texture map 'overlaps' so the UV map on the export isn't anywhere near anything that can be lined up.

I was going to load in other terrain models with the OpenStreetMap data exported from blender-OSM, but I can't get it to line up at all.

jgwinner avatar May 13 '21 02:05 jgwinner

Oh - forgot to add - the box / CSG idea was a great one! It did help a little bit, but the UV maps threw me off so the CSG really didn't work.

Researching baking UV maps to full extent ...

So great idea - trying to figure out the rest of it now ...

jgwinner avatar May 13 '21 02:05 jgwinner

hi @jgwinner, a little late on the topic, but you can use the bpyproj plugin to use an equirectangular projection. you get perfectly rectangular areas with this (use Proj4 parameter +proj=eqc). note, that only near the equator you'll get approximately squares when chosing e.g. 1° x 1°, while distortion kicks in towards the poles. you still have to deal with varying UVs too though, as they are not consistent and not mapping cleanly from UV space 0-1 to the corners (depending on how many image overlay tiles you load in, they get projected differently, too, as the aerial and satellite images seem to be tiled differently depending on zoom levels).

momentmal avatar Jan 21 '22 17:01 momentmal

@momentmal Thanks - the UV tiling has turned out to be kind of a killer.

I see why you're doing it that way, it's just hard to export to my landscape rendering program or Unity well.

The project I was on ended (no funding going forward) so I haven't been working on it. I did find a Unity plugin that does something similar, I had been looking at that just to get the data directly, when funding ended.

jgwinner avatar Jan 21 '22 18:01 jgwinner

Hi John!

Below is my solution.

Import the terrain with the coordinates containing the required square area. Create a box in Blender with the required dimensions. Create a boolean modifier for the terrain. Set the field Object to the cube object. Select Intersection for the boolean operation.

I hope it helps.

By the way. Why do you need the rectangular terrain?

Just wanted to add that this would be a great future to have the tiles come in as square. I tried the boolean approach above but the boolean modifier did not play along nicely. Not sure if I did something wrong but my approach was, 1) Create a cube of the same dimensions (width, length and height), place it over the terrain imported, create a modifier for the terrain, select the cube as object, set to intersection but no luck.

franzwessels avatar Oct 05 '23 14:10 franzwessels

@franzwessels

You can send me a Blender file with your setup (textured terrain, cube, modifiers). The email address is [email protected]. I'll take a look.

vvoovv avatar Oct 05 '23 18:10 vvoovv

Hi

Please see the file as requested that I would like to create as a square over here https://drive.google.com/file/d/184XY_8SvxwQ_dzxCKJZOxu7L3HBF8yT4/view?usp=sharing. I created the modifiers, but did not apply them. I use the add-on to create topography which I then carve on my CNC machine and would like to make one of the US.

I wanted to thank you for the wonderful add-on you created, it is one of the best I've used in Blender.

Let me know if you have any questions.

Thanks

Franz

On Thu, Oct 5, 2023 at 2:48 PM vvoovv @.***> wrote:

@franzwessels https://github.com/franzwessels

You can send me a Blender file with your setup (textured terrain, cube, modifiers). The email address is @.*** I'll take a look.

— Reply to this email directly, view it on GitHub https://github.com/vvoovv/blosm/issues/249#issuecomment-1749460185, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARGDENB2JTDXROELZ5Q4XL3X536G5AVCNFSM44OCO7VKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZUHE2DMMBRHA2Q . You are receiving this because you were mentioned.Message ID: @.***>

franzwessels avatar Oct 09 '23 00:10 franzwessels

@franzwessels

The cube boundaries must be within the ones of the terrain:

image

Also, move the top and the bottom planes of the cube far away from the terrain; image

Then it would work: image

vvoovv avatar Oct 09 '23 07:10 vvoovv

Thank you, I applied the modifier as advised and it works as expected, meaning, it will cut the shape into a square or rectangle or whatever the shape of the boolean cutter is.

What I'm looking for is to change the original downloaded topography into a rectangle (or square), not cut the topo into a rectangle. Said otherwise, I want to stretch the terrain (object) into a rectangle. I

franzwessels avatar Oct 09 '23 18:10 franzwessels

@franzwessels

If it's supposed to be the whole US, then a different geographical projection is needed.

vvoovv avatar Oct 09 '23 18:10 vvoovv

The additional problem though is still this rectangular display.

Most landscape rendering tools, as well as all game engines, expect squares. Of course, the closer north we go the less squares and the more isosceles trapezoids we get, but even in the suggested answer, above, we have rectangles, not isosceles trapezoids.

In blender it should be a square, not a rectangle.

jgwinner avatar Oct 10 '23 19:10 jgwinner