Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to create straight edges for imported DEMs #42

Closed
ansonl opened this issue Apr 4, 2021 · 10 comments
Closed

Option to create straight edges for imported DEMs #42

ansonl opened this issue Apr 4, 2021 · 10 comments

Comments

@ansonl
Copy link
Contributor

ansonl commented Apr 4, 2021

Is it possible to add an option to have higher resolution for side edges of the final model than specified for the rest of the model surface?
I am importing DEMs of individual US states (USGS GMTED2010) and would like to fit multiple printed pieces together.
I've set the print resolution and scale to match my nozzle and get an acceptable level of detail on the surface of the model. However, downscaling the resolution leads to edges of the models becoming jagged. As seen below, the Virginia, North Carolina border which is slightly curved in the base DEMs becomes a jagged approximation.

Thanks.

image

@ChHarding
Copy link
Owner

ChHarding commented Apr 4, 2021 via email

@ansonl
Copy link
Contributor Author

ansonl commented Apr 4, 2021

TouchTerrain doesn't rely on Google if I import my own DEM right? I'm actually processing GMTED2010 in QGIS and outputting the DEM (sea level set to NODATA) in the Lambert Conformal Conic projection that you mentioned so the DEMs already processed with coordinates matching the desired print.

I haven't looked at the TouchTerrain code in depth, it would be appreciated if you would be able to add in an option to turn off the edge optimization.

I suppose the ultimate solution for my use case without understanding the entire TouchTerrain code base would be to:

  1. Make a gigantic DEM for the entire US
  2. Import it into TouchTerrain and make a gigantic STL
  3. Somehow cut the STL along state borders from a shapefile.

But I'm pretty satisfied with the efficient 80% solution of importing each state DEM into TouchTerrain with the exception of the edges at the moment.

@ChHarding
Copy link
Owner

ChHarding commented Apr 5, 2021 via email

@ansonl
Copy link
Contributor Author

ansonl commented Apr 6, 2021

Awesome, that option would be really helpful! The pre-3.1 version of Touch Terrain retains all jagged edges as the no_border_opt or will the new option retain more of the jagged edges?
Retaining matching jaggies should be sufficient for my print but I'll find out once I actually 3d print two jaggy states ;)

I looked back at my script and I actually meant that I'm generating geotiffs in Lambert Conformal Conic and importing those into TouchTerrain standalone.

I'm using Anaconda on Windows 10 to create a python3 environment and installed TouchTerrain in the virtual environment. I haven't used Docker.

  • I'm using Spyder as the python IDE.
  • I created a python script to generate the json configs and CLI commands to run TouchTerrain_standalone.py with the created GeoTIFFs.
  • Then I've made a smaller python file to launch multiple TouchTerrain instances to process states GeoTIFFs into STLs. 12 instances for my i5-10400.
from functools import partial
from multiprocessing.dummy import Pool
from subprocess import call

import datetime
first_time = datetime.datetime.now()

commands = []

with open('./touch-terrain-batch.sh', 'r') as fp:
    for line in fp:
        commands.append(line)

pool = Pool(12) # 12 concurrent commands at a time
for i, returncode in enumerate(pool.imap(partial(call, shell=True), commands)):
    if returncode != 0:
       print("%d command failed: %d" % (i, returncode))
       
later_time = datetime.datetime.now()
difference = later_time - first_time
seconds_in_day = 24 * 60 * 60
elapsed = divmod(difference.days * seconds_in_day + difference.seconds, 60)
print(str(elapsed[0]) + 'm ' + str(elapsed[1]) + 's elapsed')

I'm trying to print PLA terrain models of all US states and fit them together on a 8ft wide map on a wall. Then I would place circular pins at the places in the US that I've been.

@ChHarding
Copy link
Owner

ChHarding commented Apr 9, 2021 via email

@ansonl
Copy link
Contributor Author

ansonl commented Apr 11, 2021

Chris,

Can confirm the smooth_borders option works. Weirdly enough, smooth_borders produces almost similar borders as before at print_res: 0.8 as seen in the below screenshots. The smoothing is noticeable once I use a finer print_res: 0.4 which makes some sense. I haven't experienced any crashing.

Unfortunately, some complicated states borders still don't fit together well with the jagged edges.
May I take you up on the offer to talk to the Blender guy who may have more expertise regarding exporting border polygons and cutting the mega-STL? Thank you.

Pre smooth_borders update
pre update

smooth_borders on
smooth_borders on

smooth_borders off
smooth_borders off

@ChHarding
Copy link
Owner

ChHarding commented Apr 11, 2021 via email

@ChHarding
Copy link
Owner

ChHarding commented Apr 11, 2021 via email

@ansonl
Copy link
Contributor Author

ansonl commented Apr 18, 2021

Chris,

I sent a message to your iastate.edu email with the details. Let me know if you didn't get anything and I'll drop my email below. Thanks.

@ansonl
Copy link
Contributor Author

ansonl commented Aug 6, 2021

Following up to let any readers know that setting a configuration of smooth_borders: False resolves this issue of retaining straight edges for imported DEMs. Below is a 3D fit test of Maryland and Virginia borders printed in PLA.
MD and VA fit test

printres: -1 is required to retain fitting edges between multiple object.s

@ansonl ansonl closed this as completed Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants