Fix Holes in Photogrammetry With Blender: How To Repair Bad Photo-Scans

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
got a bad scan don't throw it away during this blender tutorial I will be taking this photogrammetry model which is full of holes and turning it into this perfectly respectable model [Music] so I'm going to make a start by importing my photogrammetry model by going to file import down to here it is obj wavefront obj and I need to go to wherever I've saved my photogrammetry project mushroom cache and then texturing and then this folder here and textured mesh dot obj import wavefront obj here we are as you can see it's kind of upside down and tilted but we can soon Rectify that very quick way of getting started with this is I normally select the model and then go to object set origin to Geometry so that when I do rotate it it will rotate around the central point in the geometry which is here make sure that you've set your rotation pivot to median point so now when I rotate it's going to rotate around that like this okay I'm going to hit 3 on my keyboard all one depends on how it looks in your viewport and I'm going to hit R and then just rotate until it looks about right so we can see the shape there maybe rotate it a little more this way and then seven on the keyboard to look at the overhead view and rotate again until that squares up nicely maybe a little more this way yeah I think that will do that looks pretty good as you can see this model is quite impressive so if I go over to the material View give it a couple of seconds there we are there's my model and I feel quite pleased by that that's good I'll just save this before we go any further there's a lot in this model which needs to be removed so the surround as you can see there's a lot there I probably want to just cut it so that it's close to the tree stump as possible and I'm going to do that by hitting seven on the numerical pad and then making sure I've got my object selected hit tab to go into edit mode put on toggle x-ray and then hit C and then increase the radius of this selector with your Mouse wheel and then just click making sure of course that you've got face select on and then right click to come out of that and then inverse your selection control I so everything else other than the selected area or previously selected area becomes selected and then hit X and delete faces good there we go tabbing back out of edit mode I think we can work with that that looks good I'll just save it now as you may have noticed up here we have several holes in our mesh so it's not a perfect scan there are holes there are deformations and if you actually look inside some of these holes there's actually geometry false geometry inside the holes and there are bits that are just hanging around which aren't connected to anything so it's not a perfect scan there are lots of good areas but a couple of bad and I wouldn't want to throw this scan away I think that there's plenty more that we could do with this so in this tutorial we are going to look at repairing these various holes removing erroneous bits around the edges and preparing it for optimization now I could work directly on this very high resolution scan as you can see the geometry it's absolutely crazy uh if I just bring down the stats here you can see that we're dealing with well basically nearly 1.3 million faces that is a lot of geometry by the time I finish with this I'm hoping to have something like I don't know 10 or 20 000 not 1.3 million so what I will do is I'm going to actually work on the optimized version of this mesh I'm going to keep this mesh and I'm going to do as I did in many of my other tutorials I'm going to create a mesh with a lower resolution and for that I'm going to use a program called instant meshes and then going to import the low resolution mesh and bake all of the detail from the high resolution mesh onto the low resolution mesh but it's the low resolution mesh that I'm going to repair after all working with a high resolution mesh can be a bit of a strain on your computer's resources so without further Ado I'm going to export this mesh here file export and I'll export it again as a wavefront obj I will put it there that's good export over in instant meshes I'll click on open choose object obj go to where my seat file is my wooden carved seat.obj open that and there it is it's loading up nicely preparation is key with this sort of thing we want to make sure that our mesh is as optimized as possible and clean as possible so first of all I'm going to reduce the target vertex count I like to bring it round to a I think a model like this around about 10K will do perfectly making sure that our mesh runs from top to bottom left to right I think is quite important so I'm going to use the comb here and I'm going to paint a line very very carefully like that and that will cause and you'll see a representation of that there you can see a lot of vertical lines now coming through if I do this on the horizontal you'll see that they kind of straighten out as well it's looking a little better perhaps I will do something similar here as well I'll just comb a line there also I'll have one going across there as well see if I can straighten these out now if I switch the comb off for a second just so I can rotate I'll have a look at the rest of the model see how that looks I think that is okay can you see the way the lines are going vertically and horizontally if you like top to bottom left to right so I'm trying to get that to look uniform I think that will do now if I just click on solve so I get to see the mesh there as well that's fairly tidy okay export mesh I always click on pure quad mesh I like to put this on one extract mesh and there is oh finished article now there's a lot of detail gone from this but don't worry we're going to bake that detail back in Via normal Maps now I'm going to click on Save I'll save it over the model that I exported and now in blender if I go to file import ant obj and then look for my model that I've just exported from instant meshes there it is okay so that's sitting exactly where my high resolution mesh so if we look over here if I just switch off the original textured mesh that came through from mesh room you can see there is my low resolution model and if I go the other way around switch off the one that I've just imported there's my high resolution model they both sit in the same space which is great I'm going to call this one high res and this one low res just so we know where we are so with the high res I think I'll switch that off and the low res let's just quickly inspect it everything's okay if you see lots of blue lines everywhere if you just click on the edge select up here select everything right click and just make sure that you remove sharp so if you just clear sharp it will get rid of any blue lines this used to be the case in older versions of blender with the way that it used to import objs doesn't tend to be a problem now but if it's there right click remove sharp I'm going to come out of edit and shade smooth now okay not much detail in there it's not looking great but we will bake that detail back in as we have done in previous tutorials but anyway the big problem with this model of course can be seen up here with all of these large holes so this is where I'm going to start my editing I'm going to remove all of the bad information the information that you can see inside the mesh I'm going to clean up the edges and I'm going to fill those holes tapping into edit mode this is going to be a little messy so I think what I might do I'll make sure I'm on face select mode first I'll go into x-ray I'll just click away just so everything's deselected and this is where all the problem is up here so if I hit C on my keyboard and just select all of these faces in x-ray mode remember has to be an x-ray mode you can see I've selected that entire area there so we should have covered if I come out of x-ray mode we should have covered all of the bad areas but we've also included a lot of good area as well but now that I've done it that way because there's a lot going on in the inside which we can't easily get to I'm going to hit C and then I'm just going to right click on the mouse wheel and select the external bits that you can see being very careful when I go around all of these little holes not leaving any important faces out now I could have done this with a high resolution model but I think I would have been here all day doing that so I'm glad that I've done it this way around okay now I've done that I'm just going to double check to make sure I haven't selected anything that I don't want to remove as you can see I've selected loads of internal bits and maybe this is a good opportunity just to check elsewhere see there's a few faces there which needs selecting I'll just uh go over to x-ray mode select those very carefully uh that might do for now can't see anything else which needs selecting coming out of x-ray mode all I will need to do now is of course hit X and then faces so now we're ready to start repairing our mesh but I'm not going to do a huge amount I'm not going to sort of level things out as such it will just be a question of filling all of the gaps for now we will later remodel certain areas using sculpting tools I've noticed a few bits I don't like the looks of this bit here maybe I could dese like that maybe just select a couple of these here it's worth just going over just having a look see if there's any bits that you'd like to remove from the mesh there we are that's something to work with now the main method I use for filling holes like this it's quite a simple one there are many ways of doing this but this is the method I like to use because of its Simplicity I will look for an area like this for instance just with the edge select select around the edge and then just press F and it will fill that Gap I know I've left these ones out because I didn't really like the looks of those two faces so I'll select those also delete and then again select select these and then just press f now as you notice there's not much geometry going on in here so what I will do is using the knife tool that's K on the keyboard I'll just link these to here and again here now I'm just going to have to work this one out I think maybe I will cut from here down to perhaps over here and then where am I going to take this one maybe something like that it's not ideal it's not clean geometry but you can see that it's not clean because of course it's a bit messy here to begin with anyway so I've just tidied that up a little I think that's okay that will do and then I just follow that same procedure throughout the mesh don't worry too much about the way the mesh looks once we've worked on this with the sculpting tool we've smoothed things down it'll just naturally form into a tidier mesh I'm aiming for triangles and squares squares are better but if I if it requires a triangle then that's fine so three points or four points for each face I'm quite sure what's going on now get rid of that and just tidy it up there good I think that is all of the holes filled let's come out of edit mode and have a look to see what we've got yes there are some holes some of it looks terrible but we're just going to go with that again we're going to re-sculpt this afterward once we've applied all the textures there are going to be holes in the textures which we're then going to clone out using texture paint but for the time being that is now a model without any holes in it so that's looking pretty good now before we can bake the high resolution onto the low resolution we need to first of all unwrap this current low resolution model so if I tab over into edit making sure that I've got Edge select on and I'm going to add seams to help the unwrapping process so usually you look for corners and around edges to put your seams a quick way of creating a seam is to click at one end of your mesh you want a line going down to say here hold down the control key and click where you want your line to finish and it will create a straight line from those two points or straight ish at least and I'll do the same here as well it can get a bit Jagged at times depending on the complexity of your mesh and how clean the geometry is so now I'll select all the way around the bottom of the tree stump so it really is just a question of splitting up your mesh into regions I think that looks well divided I don't know if there's any other areas I could chop into but I think that I've broken this down into a few nice pieces maybe because there's a bit of a step here where there's an additional geometry I might just split this one as well it hasn't quite gone according to plan let's try that again give it a bit of guidance that's better now right click and Mark as seams so now you can see quite clearly the orange marks for the seams if I go over to face select mode and select all just press a on your keypad I just expand this out a little UV editor and then coming over here you unwrap we'll find there we go there are all the pieces I usually like to just change the settings here for the margin to zero point zero one or point zero one just to push them out a little further with a gap now you can at this point rearrange things a little this doesn't always come out to the most optimized degree so sometimes it's worth choosing this mode up here which selects the islands in other words the isolated bits and then you could start shifting them around at this point also it's worth having a look at your mesh just to see whether it's healthy you don't want any mesh crossing over itself like this if you see this then there's something not right perhaps one of your seams is not quite completed it has a gap in it somewhere so it's worth just checking the quality of this see here we've got these little bits here now I'm not quite sure where they are it could be just a few Rogue faces inside perhaps I don't know there is one way of actually finding it out finding out what it is and that's you just select a number of um regions troll L and it will select those regions and you can just go for a process of elimination control L it's none of those it's going to be none of these because these are all huge regions whereas that was just a couple of squares okay so ah there it is see what I could have done is now I've selected all the regions if I've done a control I to invert I can then find that erroneous area and there it is it's some faces underneath the model so X delete get rid of them may as well in fact I may as well do a fresh unwrap this point so now I'm just going to shift things around a little more trying to get as much as I can out of this if I can get all of these shapes into a smaller area closing all of the gaps and then just expand it scale it up a little I'll end up with more information within this image itself so um let's have a look now this may take some time so once you're done just zoom in making sure nothing's overlapping or touching there's a bit of a gap in between that's probably a little too close for my liking and over there as well let's have a look there that's good down a little yeah just use grab and rotate that's G and R to shift things around don't scale just leave the scale as it is yeah I'll do so now if I select all a you can see if I bring this to the middle here and then I'm going to scale on the X first find it much easier to do the X and the Y separately and then scale the Y okay let's change this back to Shader so I've already created a diffuse and a normal image and if you're not sure how that's done shift a s for search type in image image texture and then just click on new uh give it a name like diffuse or normal uh 2048 is good 2048 by 2048 click on OK and you've got yourself an image anyway so I've got my image up here um what I'm going to do now is I'm going to bring back my hi-res making sure I Tab out of edit mode that is bring up my hi-res select it hold down the control key on my keyboard and hit low res so that both of them are selected and make sure that you've selected diffuse because we're going to bake the photographic texture first the diffused texture now here are the settings I use for baking firstly Cycles GPU compute if you've got it uh let's have a look now what we got okay render I always put maximum samples on Eight coming down Max bounces I select all of those all the way from Total to transparent hit two so everything's two I switch off reflective and refractive and then moving all the way down here under bake I choose diffuse from the drop down list here switch off direct and indirect contributions select selected to active and Extrusion to 0.1 now that's all in place a quick save control s and bake now why that's baking I'm going to bring down another window here and go for the image editor so I can see the result of my baked image texture there we are hey that looks good you can actually see this ones there image save first thing to do of course I'm going to create a little folder here because I'm super organized with certain things textures and there we go diffuse PNG that will do save now I'm going to repeat the same process but this time with normal just make sure that your high res and your low res are selected hi-res first Ctrl low res if for whatever reason you've deselected and over here big type I'm going to move to normal and all the same settings just click on B and there's our normal uh we can see quite a few green and pink and blue bits here which are standing out a little there little errors image save and normal PNG that's great save as now we're going to try these out I think I might just get rid of that little window there right so we've got our two images up here this is our diffuse and this is our normal we've already baked our diffuse I think I'll turn off high res that's Now hidden you can actually delete it if you want in fact just to prove that you can do that I am going to delete hi-res we're done with it now we don't need it so diffuse maybe if I click over to the material view over here and color plug that into base color looks impressive already isn't it strange things happening up here but we kind of expected they were holes to begin with now we've lost a lot of detail as you can see so the detail has been saved in the normal map now I'm going to add oops I'm not going to add that I'm going to add a normal map over here I'll grab normal put it into normal push that down to there and color into color you've got loads of detail there now you may not have seen that so what I'll do just for now just for your sake if I just disconnect color and I'll bring this down to something quite sharp maybe like a black for instance there we go can you see the detail that's come through now in that normal map maybe if I just hover over there and I just remove this you'll see the difference it makes normal maps are really incredible so there we go all that detail preserved on a low resolution mesh via normal um I'll plug that back in here so now we have a very optimized mesh but it has problems those holes now that we've baked everything in I'm going to go to sculpting and repair uh any rubbishy meshes that I created earlier uh I like to use the smooth tool being very careful not to take out too much natural shape in our model I'm going to tap away at all of the areas that I've repaired they're quite obvious you can see there's little anomalies going on in the mesh like that I've wanted to build that area up so that it's more of an edge if I go over to the draw tool making sure plus is selected up here I can just paint that in as well and then perhaps go over again with the smooth same here I took a bit of a depression there which I don't think should be there so with the draw tool let's paint that in maybe add a bit of detail there I think this entire area gone there we go built that up quite nicely and with the smooth tool just clean it up a little bit that looks good another one here perhaps just a few little Taps of the draw tour just to bring that out and then smooth it looks a bit funny doesn't it I'll give that a tap as well oh yeah you can see there's a clear Dent there so let's take that dent out and then smooth it back a little Let's Wiggle your model around a little so you get a good idea of what is actually going on um again just tap away and smooth you know I think that's looking pretty good yeah I think we're maybe done here I feel that's a bit sharp there yeah that looks good save go back to layout all we need to do now is repair the holes in the actual texture itself for this I'm going to go over to texture paint I normally get rid of this bit here so we're in one Pane and I'm going to be using the stamp tool now get yourself nice in position here the stamp tool works by taking from an area where there is good texture and then painting that texture onto an area where it's not so good so let me just show you how that looks first uh it's not very obvious though maybe if I go for a bad area just to exaggerate it there we go you can see that it's copied from there over to where I was painting let me show you how to do this hold down the control key look for a good area an area that you want the same texture here for instance onto here click and you can see that it's placed the cursor here and I start painting I can copy that information you can just about make it out can't you where you can see near the curse there you've got a few strokes and that has come over to here also don't go mad with it do this bit by bit keep on moving around and doing small areas at a time for the best effect you might want to zoom in now incidentally if you can't see the texture that I'm currently working on it's because if you come over here to the active tool workspace settings you can actually go between the normal map that we created and the diffuse so just make sure that you've checked diffuse all right once you've done just double check to make sure you've covered everything go over to save all images just click on save all images to save your current diffuse so that file which we saved in textures is now up to date oh if I missed a bit I have let's just quickly cover that like that and save images I think we're done don't know if there's anything else and he's doing now I'm going to flip over to normals same thing again getting rid of any erroneous colors like this and you can actually look at the texture this time rather than it being the the photographic side of things it's going to be the textural side of things and try and mimic the textures if you see a seam let's see if I can find an example of a seam there's one there don't mess with it leave that as it is because that's just the way normal Maps work same again save all images I think though I'll just have a double check on the diffuse because I'm sure there are some areas on the floor here which might need a bit of work that's not too bad I think that will do looks really good that is fine that's how you repair a model um I'm sure you're wondering how I always get a smooth edge around the outer parts of my photo scans let me just show you that very quickly if I go to top down view number seven on the keyboard tab into edit I think for this I'll I'll dip over to the solid view here using the vertex select I will select any vertex that's hanging out like this can you see you've got one two three in the same square there's one there another one there or actually there's more going on there I need to come back to that uh once I've selected a number of them I will control X and it will just put that on instead but I think if I just select those two merge at Center and then I'll just continue to select any of those edges like this good we're done and just make sure you dissolve all of those control X so you don't have any of those little in between points you'll find that during the method that we're going to use which is going to sculpting and smoothing those little additional points kind of still remain Jagged and they make a bit of a mess but now that I've removed them if I go over to sculpting and again top down view is good zoom in use the smooth tool and just smooth it out like that don't go too far in you don't want to start smoothing out good detail now there are various things I like to do to finish my model up um one thing is to flatten the terrain that it sits on I think at this point I'm going to rotate it a little and you see it's rotating around this Pivot Point um maybe what I'll do for now is tab into edit select all a and just grab and drop it in the middle of that pivot point there I can't quite see it there there it is something like that just for now yeah I'm going to side view three I'm going to rotate it just get it absolutely spot on like that tapping to edit slightly move it over that way like that I will come back to that and do that more precisely in a little while but now that's in place uh tab into edit go to the edge select just select one Edge just to make sure nothing else is selected shift alt and just click somewhere on the outside and it should if you've got rid of all those little points that I was removing earlier it should select the entire outer edge of my model now I'm going to choose this over here proportional editing if I click on that and let's say if I grab Z and pull down you can see it's it's pulling more than just the line down so if I just drag that down a little and then reduce this radius using the mouse wheel something like that and maybe pull that up a little more soften it a little more there we go that looks good and we can even go s Z scale on the Z zero just to flatten it out like that maybe drag it down slightly again reducing the radius as I do so that is totally flat that is perfect now while that's selected I'm going to s cursor to selected so that's now in the center of the selection itself and now coming out of edit mode object set origin origin to cursor so now the origin point for this model is dead on in the center of this selected ring there we are we have a decent clean model once it was full of holes and bad geometry but now it's optimized and everything's looking good all of the holes are filled and the texture looks amazing now if you'd like to own this model yourself you can download it from my CG Trader page take a look in the description and don't forget to like And subscribe and I'll see you next time
Info
Channel: Blender Bones
Views: 39,775
Rating: undefined out of 5
Keywords: photogrammetry, photo-scan, repair, fix, damage, blender, tutorial, holes, bad meshes, repair mesh, fix holes, Repair, repairing
Id: _pzTK-LBm3o
Channel Id: undefined
Length: 36min 46sec (2206 seconds)
Published: Fri Feb 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.