Creating Textured 3D Terrains with QGIS and Blender

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this lesson we explore the process of creating textured 3d terrains using various kinds of elevation data processed with the gis software qgis this 3d data can come from lidar srtm and other similar places you can find links in the description to my other videos that explore processing these data this is useful if you want to illustrate an area such as an archaeological site in three dimensions or perhaps build the ground surface for an interactive digital product hosted via sketchfab or some other platform this tutorial will use two open source programs qgis and blender we'll begin by gathering and visualizing our data before creating a shapefile to clip our elevation data and a second image to use as a texture for instance an aerial photograph a historical map or perhaps a different way of visualizing the same elevation data next we clip and export our data for use in blender once imported into blender we'll explore a quick way of using the elevation data to create a 3d plane and assigning the second image as the plane's texture finally we'll export the data for use in other applications like the online 3d content sharing platform sketchfab ok let's get started we're going to create a 3d terrain for the site of poverty point in northeastern louisiana our data is in the louisiana statewide lidar project website which we can see here so just to quickly illustrate how we would zoom to this area here's the town of epps and we can sort of zoom into the area find it easier to use the streets layer and there is the poverty point national monument when we click on this we get these file download options over here and so we can use contours dem a digital elevation model a image that already has the elevation data in a raster data setting for the purposes of this tutorial that's not really that important now if you click on this you'll be given an option to download this file and what this file is going to have is a series of uh gis data sets in it we're only going to use the ces 3 and sus4 here those are the the southern half of this area now i went ahead and used the edited points the actual lidar points to create my own version of this and of course there is a download link below that will take you to this zip file use that to follow the rest of this tutorial this is a digital elevation model a dem with better resolution so what we're going to go ahead and do is we need to add this file to qgis and we do that just by double clicking and we can see here if we zoom in a bit we can see the familiar features of poverty point and of course if you're not familiar with poverty point i've included a video link in the description below so what we're going to do next is we need to visualize this in in different ways we're going to go ahead and leave this original visualization alone you might notice when we look at this file that there's this question mark that means its coordinate system is not defined i apologize for that but it's something you'll run into so let's go ahead and set that if you're not familiar with qgis this uses epsg codes for the coordinate reference system or the crs and we can just type in 26915 and that will give us the coordinate system for this data if we click ok this will allow us to project it and you see it's disappeared again if you're working with data like this you'll notice that all we have to do is right click and select zoom to layer and it comes back so now what we want to do is duplicate this once duplicate this twice we're going to turn off the original go down here to the bottom one turn it on and we're going to select the hill shade visualization technique and so you can see here the features have popped out and they're very very visible we want to go to the one above that and choose a different way of visualizing this if we choose single band pseudo color we can add some pretty nifty looking visualizations we're going to left click the color ramp and choose create new color ramp then we're going to choose from the drop down catalog cpt hyphen city click ok again and then click on the topography settings i really like this one that's defined at 151 colors so if you click ok we need to actually change that a bit to equal interval and then type in 151 because that's how many classes we had there's a lot of values here we don't see a lot showing up for poverty point but this visualization is something we're going to use again later let's just go ahead and change the opacity to 80 and then you can see these two layers working in tandem to produce a pretty stunning visualization of this really amazing site so with that we're now ready to go ahead and start clipping our data before we can clip the data or take a subsection of it and export it we need to create what's called a clip shape file it's actually a pretty easy and straightforward process so what we want to do is we want to choose some aspect of this area that we're going to focus on for our visualization so the way we can do this first is we can use this measure tool and just sort of get an idea right we can see these features here how long or how big of a square are we going to need to sort of capture them and we can sort of see here as we move around this measure tool a 1500 by 1500 meter square is going to do a really good job of capturing the majority of the site so let's go ahead and close that now we need to go up to the layer drop down we're going to create a new shapefile layer we're going to give it a name of clip we're going to go ahead and choose a polygon geometry type and for the coordinate reference system we're going to go ahead and use the same one you can type in 26915 and get utm zone 15 north in the nad 83 datum which is actually my favorite coordinate system so click ok go ahead and click on simple fill for the fill color let's go ahead and put transparent we can even turn the stroke width up to five that's just going to help us see what we're working on so before we start editing this you should go up to view and choose panels and advanced digitizing this is going to open up a new panel that's going to help us make sure the clip boundary that we produce is exactly fifteen hundred by fifteen hundred meters so now with clips selected let's click on the toggle editing we're going to be creating a polygon so we wanna add polygon we can sort of start right around here if you click like i do and you see that the advanced digitizing panel doesn't open go ahead and right click to stop come down here to the corner and you need to set the coordinate reference system for the entire file and so we'll just enter 269 15 so we get the same one click ok now if i click here i'll be able to enable these advanced digitizing tools i'm going to unclick or left click one more time now when i click in here i'll have the degrees and angle i want to set that angle to zero sorry the d stands for distance so let me go ahead and put 1500 and now i'm locked into creating a line that's 1500 meters long 90 and 15. so we're measuring now the 90 degree angle another 1500 meters do that one more time click and then right click to finish creating this click ok and we have our clip file there now if it's not exactly where you wanted it to be you can use this vertex tool just drag a selection rectangle click on any of them and then you can see we're moving around the selection rectangle there we go we've got pretty good selection here just click the save button stop editing let's go ahead and close out these panels that we opened or auto opened can also sort of click anywhere inside to deselect those vertices and now we're ready to clip and export our data so when we're going to clip our data we're going to use a processing tool so if you don't see this processing toolbox down here you can go to view panels processing tool box and that'll display it and this is a really nifty and quick way to just find the tools because we're looking for clip a raster by a mask layer and so let's go ahead and turn on our original layer double click to open this clip raster by mask layer you'll see it's already selected what you had selected previously the mask layer is the only possible vector shape file here the original source we can select for the crs the coordinate reference system same with the target we want it to remain the same i would encourage you to change the x and y resolution to keep this at a nice resolution for creating the 3d terrain i use 0.5 that's half a meter basically meaning each grid will will be about a foot and a half or so by north and south we want to go ahead and save this to a file and so let's just go ahead and name this height map clip click run that's done so we can click close let's go ahead and turn off all the other original poverty point files and we can see our height map here and because we're looking at a smaller area our layer styling reveals more of the terrain features we can go ahead and duplicate this a couple more times and we'll in a moment go back and visualize those but let's go ahead and with this height map clip selected right click and choose export save as because what we're going to do now is export the height map that we'll use in blender so we want to do a rendered image we can leave it as a geotiff the file name let's go ahead and call this blender height map click save everything else here is okay we can change the resolution to half just to make it match and then go ahead and click ok and you can see it's actually added that file to qgis as well and when we turn it on and off we can see that these are basically the same file they're just in different formats so now what we want to do is before we switch over to blender we want to talk about how we would for instance export that kind of visualization we created a moment ago so let's go up here turn this one to hill shade we can see that all the features pop out it's really compelling let's do the next one let's go ahead and visualize the other duplicate by changing it to single band pseudo color we're going to create a new color ramp use the catalog city okay topography we'll go with that wiki 151 value again of course then we have to change this to equal interval and enter 151 and as you can see we have this really compelling visualization let's change the opacity back to 80 and now we can see those two layers working together to produce this really stunning visualization now what we're going to have to do is export this image now if you've watched my other tutorials i show how to use the layout manager i'm going to do it really quickly here but i've also included a link to that longer tutorial video in the description let's go ahead and call this lidar viz click ok brings us up a blank document we want to right click choose those page properties the size we want to change to custom i like to keep things sort of the same so we're going to enter 1500 pixels by 1500 pixels so this is going to give us a file that's sort of the same exact dimensions we've been working with now we of course have to add that map so we just click this add map it will auto lock and we can drag out our map it'll auto lock to the other corner let's go back to the qgis and what we're going to do we just want to make sure we're centered and focused on this clip layer so right click and click zoom to layer what that does we can close out these other things what that does is it centers us and brings us right to that layer so when we're here in the layout manager we can click this button here that says set map extent to match main cabinets canvas extent and basically what that does is it gets us sort of centered we can use if we're in this move item content we can sort of use the control and mouse wheel and kind of zoom in and we just really want to get it kind of centered there's going to be these white bars that's okay because what you're going to do is once you export this you'll take it into your graphic or image manipulation program of choice i like affinity photo but you can use or photoshop and you're going to crop this to just inside that black bar that is our clip so here we'll export this as an image i'm just going to go ahead and name this lidarviz.png it automatically sets it i'll leave it at 300 dpi that's a good resolution click save okay here we have blender just click anywhere to get rid of the welcome screen press a to select the default objects d to delete then we want to save this so press ctrl s just going to name it poverty point and then we can start adding our terrain so click shift a mesh to plane we're going to press n to bring up our little menu on the left hand side we want to make sure item is selected and we want to give this dimensions of fifteen hundred by fifteen hundred press the period sign on your number pad and it disappears because we're dealing in an area that's really much beyond what most people would use blender for so we have to go to the view add another zero to end and all of a sudden we're working at a scale that's that's useful for our landscape what we now want to do is press ctrl a and scale so this if you go back to item you can see this is locked in 1 500 meters as the actual scale so to add that height map or use it to create this terrain we're going to use a modifier called displace we're going to add a new texture that we're going to call height map coordinates are going to be set to uv now we come down and work on the texture properties we have to select that texture which of course we've named blender height map press f3 and search for subdivide go ahead and subdivide by 100 press tab again and if we press 1 on the number key even though it doesn't look like it we can see that there's something happening here in our file so let's go ahead and tab again f3 subdivide again and i would encourage you to put two or three i'm going to really ramp this up and go to five press the enter key this is going to do is really subdivide this and then when we look we still don't see much going on but we can do this by pressing the scale z and say just hit 20. now we can start to see our features popping out and so here you can see right this is now shot up to 20 meters what we want to do is we want to have at least to begin the height values in this model correct so to do this we need to go back to qgis and look at the height values and we need to do this not with the blender height map right because that's just giving us 0 to 255. it's a gray scale image this height map clip which has the original in feet values and so if we bring up our calculator we can go ahead and see here 160 so we have slightly different values here i earn 64.879 minus 58.191 equals 106.68 let's go ahead and round that up to 107 feet and then we can sort of quickly use here what's 107 107 feet what's that meters 32 and a half we'll just go ahead and round that up to 33 come back to blender and in that z value enter 33 meters and so we can see here this is becoming a lot more well defined right click choose shade smooth and that will really let these features start to pop we can use a vertical exaggeration so i would say try like press the s key followed by the z key and then 1.5 that's a one and a half vertical exaggeration it's not extreme we can press ctrl z maybe do scale press the s button on the z axis press the z key let's try three that's very prominent this also looks a little unnatural so typically for me s z 1.5 is good so what we want to do now is just apply this modifier we do that by clicking this little drop down apply and so now what we have is a 3d mesh of 3d terrain that is locked in it's real it's assigned if i edit it again it stays with all of its 3d coordinates we can go ahead and one last time press ctrl a scale so we have everything scaled up here and that makes sense right we have a z value of real world coordinates or real world measurements of 33 meters we've exaggerated that a bit just to help us visualize this next i would go ahead and scale the whole thing down press the s button 0.5 maybe do it again scale 0.5 press the period on the number key and so what we have now is still a large 3d model but it's a lot more manageable and press control a and scale to lock in those values and now what we're ready to do is assign the texture as you can see i've already cropped it so we're just going to go ahead and create a new material we're going to name it just stay with the same naming convention lidar biz we're going to go ahead and drag this out and i'm going to set up a shader editor press n to get rid of that menu this is a little easier to work this way shift a to search type in image texture drag that around click to lock it in drag this out from color to color and then you're going to open the lidar viz click open image should go ahead and tweak some of these other values i'll drag down the specular i like to drag out the color and use that for roughness and bring down sheen tint i should mention at this point right cg geek video explores how to create 3d terrains with google maps in blender it's a different workflow and you're constrained to data available in google which includes like specific satellite dates and srtm data the cg geek video is really useful if you want to explore additional methods for working with the textures so once we've got this set up we're just going to do a very modest little texture i can drag this back over here get into one window press the z button choose material preview and there you go there's your 3d model so now we're ready to export this terrain now that we've completed creating our 3d terrain it's a very easy process to go ahead and export this obj the object format it's a fairly open format create a new blender and we can leave it poverty point dot obj export obj and then of course what we just want to make sure we look at here is in that blender folder we have the poverty point obj we also want to make sure that we connect that lidar viz so i'm just control c and adding another instance of it here you can see it's finally finished exporting from blender this is not a small file it's not huge 50 megs this mtl file is the material file and what it does is if you double click on this i'm on windows this should bring up the 3d viewer 3d model meaning right that this is now in a format that can be read by a lot of other programs so for instance if you wanted to upload this model to sketchfab you would select all of these files right click send them to a compressed or zip folder so as always links to location of data software and relevant tutorials are in the description if you found this tutorial useful please hit that like button and subscribe to get future updates also feel free to ask questions in the comments let me know if you have an interest in another related tutorial using open source software for digital archaeology and heritage i don't know everything but if i know how to do something i'm happy to share that in that information and share that knowledge
Info
Channel: AnthroYeti
Views: 273
Rating: undefined out of 5
Keywords: qgis, blender, lidar, 3D, open source
Id: PFKnCzMoQbc
Channel Id: undefined
Length: 23min 44sec (1424 seconds)
Published: Sun Dec 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.