BEST way to use fSpy | ALL Options explained | FULL camera matching workflow with Blender

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] [Music] hey guys welcome to part one of my course on how to turn a single photo into a 3d virtual reality application imagine being able to explore your favorite movie scene or a place you've always dreamed of in a fully immersive way so this is what we're going to talk about in this course today however we'll focus on a tool called f-spy which allows you to calibrate the camera you know it's location rotation field of view and stuff like that then we'll do some draft modeling in blender and create a paper-like model i mean i call this a paper-like model because this isn't the final scene but rather kind of stencil with proper dimensions proportion and placement now those of you who've already seen f-spy are probably like hey what are we talking about there are so many f-spy tutorials out there why do you even bother well the problem with most of those tutorials is they don't explain the whole workflow they usually focus on the vanishing points and ignore the other spot parameters and although it is tempting to believe that this simple approach is enough the truth is sooner or later you'll get into trouble unless you understand all these settings and know how to determine the proper values for them so i'm going to show you how to do it using this reference image it is called the orient apartment and i found this picture on behance it was designed by michael argus studio okay so let's get started i'm gonna drop our image onto f spy canvas now and the first thing you do here is to find the vanishing points that's exactly what these red and green lines are for they come in pairs which we aim to align with the image by placing them along mutually parallel lines of course what i mean by parallel lines is parallel in 3d space not in the image since after the perspective projection they are not parallel anymore they converge at some point called the vanishing point it's essential to understand though that some axes might not have their vanishing point it all depends on the image and its perspective so if you draw the lines and they don't converge because they are parallel not only in 3d space but still in the image you'll get this little error message and this is where some people make this first mistake they try to cheat f-spy i've even seen this in a few tutorials by tweaking the line until the error message disappears remember not to do it this way because it means you're creating a vanishing point where one doesn't exist so my piece of advice is to analyze your image even before you launch of spy and draw the lines along the coordinate axis x y and z because then you can see whether they converge at some point or if they are parallel just take a look at our image it is now clearly visible that there are no vanishing points for x nor z and there's only one along y axis okay so let's get back to f spy and begin from the scratch but this time we're going to do this properly remember the very first thing you do here is specifying how many vanishing points your image has so let me set this to 1 and select y as the vanishing point axis there is one thing that is a little bit misleading here because f spy asks me to select the second vanishing point axis despite i only have one um we'll get into that shortly but you can select whatever you want in your x or z okay so we can start the alignment now and there are a couple of things to remember if you care about accuracy first of all it's good to press shift because it opens up the zoom circle and also turns on the precision mode which slows down your mouse you also shouldn't draw the lines too short because tiny mouse movements in such a case will make huge difference so the longer lines you draw the better accuracy you get and for the very same reason i wouldn't recommend drawing the other line too close to the first one because the vanishing point becomes overreactive i usually draw the lines at the extremes of the image as long as i have the reference over there of course okay um let's get back to the second axis now this time we don't have another pair of lines there's just a single one and obviously we need to align this with the image as well so i can draw it here and it has to go along the second axis i chose i told you it's not important if it's x or z but you have to be consistent now and as you see the thing i'm doing right now is rotating my coordinate system along the first axis this is the purpose of this line to rotate the coordinate system okay um we are almost done it's still flipped though so let me change x to minus x and yeah it's okay we can validate our perspective now by dragging this origin and matching it against various areas of the image as you can see apparently we have some issues with the z-axis it doesn't align well with the underlying picture but kind of bends towards the middle of the image this problem is very common with images that have less than three vanishing points generally speaking axes without vanishing points are troublesome not always but quite often f-spy simply doesn't have sufficient information to do its job in such cases some people mistakenly try to fix this by readjusting the lines they've drawn but this approach is just another common mistake leading them nowhere the root cause of this problem lies in a badly placed principle point which is the essential part of the perspective because this is the point onto which the perspective center is projected unfortunately this point isn't something you can easily spot just by looking at the picture it's not as simple as with the vanishing point where you draw the lines and see where they meet luckily there are other techniques that can be used to find it but before i show you how to do it let me explain what this principle point is so we have a camera and the image plane this flat two-dimensional plane onto which the scene is projected as visible here in the camera perspective view i'm going to add a line from the camera center perpendicular to the image plane this line is called the principal axis and the point where it meets the image plane is called the principal point now imagine you add a tiny sticker at this position so that it's visible in our rendered image and because it's a sticker it won't change its location even if i move or rotate my camera it's like a laser pointer telling us what the camera is currently looking at sometimes it is also called the image center and by default it is indeed located at the center nonetheless it doesn't have to be there otherwise i wouldn't be talking about it because f spy could simply divide the image resolution by two and it would know its coordinates right but the thing is the final image can be manipulated someone can crop it and in such a case our sticker won't be at the center anymore and of course in real life there will be no sticker at all so you'll get a picture and we'll have to find this place yourself without knowing if the image has been manipulated or not and to make things harder there isn't a single approach to do this but rather a couple of different strategies and the one you choose depends on the number of vanishing points your image has so to show you all of them i'll use these three pictures we already know that the orion apartment has one vanishing point this other picture has three and the pool has only two which quite surprisingly is the most difficult configuration but we're gonna go through all of them so let's just start with that buildings which have three vanishing points playing with such images is the most effortless because if spy can figure out everything automatically all we have to do is to draw and align three pairs of lines okay but where is the third pair of line i can only see two well it's not visible by default you have to activate it and you would probably imagine that you do this by setting three as the number of vanishing points in this drop down over here but quite surprisingly it only lets you choose between one and two so what you do instead is you go to the principal point drop down and select the last entry called from third vanishing point and then you get this third pair of lines keep in mind though that this option isn't available if the number of vanishing points is set to one in such a case you'll only have the amateur midpoint and manual modes so remember if you don't see this item first set two vanishing points and then go back here and select the proper value alright let's start dragging i'll speed this up a little bit when we finish an orange circle will appear on the screen and this is the principal point that's been found and we don't have to do anything else if we validate the perspective we'll see that all three axes align perfectly this was easy but let's open our next image so where are the vanishing points these parallel lines at the edges of the pool converge and so do those along the other axis um okay and the vertical lines are mutually parallel it's particularly noticeable near the edges of the image because they are perfectly parallel on both sides so let's start as usual by aligning the existing pairs of lines okay what do we do then well chances are that the image hasn't been manipulated it is the desired situation because in such a case the principal point will be at the center and because this is also the default value in f spy we don't have to do anything else all three axes will have this nice alignment this is the simple case of course unfortunately our z-axis doesn't align well apparently this image has been cropped so we have to switch to manual mode and locate the principle point ourselves i know it's tempting to use this automated discovery mode from third vanishing point but although this option is visible don't choose it this is not going to work this time because we don't have the third vanishing point so we have to stick to manual and do something the rule of thumb is grab the principle point this little orange dot and drag it along the direction of the parallel lines those without the vanishing point so if the parallel lines in our image are vertical we must drag the principal point vertically up or down this will rotate our z-axis and will let us align it with the image usually as we drag the orange dot vertically we also unintentionally change its horizontal position it's because if spy doesn't have this option to constrain the movement to one axis and you know it's hard to drag your mouse that precisely and we can check it over here by reading the current position i usually prefer relative units instead of pixels because 0.5 means the middle no matter what resolution your image has and yeah as anticipated the x-coordinate is not 0.5 so it's advisable to fix this now i can grab the point and move it horizontally using the precision mode i have to be careful though not to change its vertical position what usually happens okay so far so good but i also have some bad news although all three axes align well it doesn't mean that we found the right position of the principal point frankly we have absolutely no idea what its horizontal position is and it's also very difficult to find it unlike with the z-axis moving this point left or right will not change the angles of the coordinate axes so we can only rely on the proportion between x and y vectors believe me finding this position accurately is a daunting experience a lot of guessing trying verifying and a lot of round trips between f spy and blender i'd spend another half an hour to do this so i'm not going to talk about this specific case right now let's just keep our fingers crossed that this image was only cropped on its top or bottom and not on its left or right side because if it hasn't changed its width uh then the horizontal placement of the principal point will be in the middle okay um so let's head to our last example the orient apartment and this is the strategy that you will use for all those one point perspective images it's actually pretty straightforward you just have to remember that for such images the principal point overlaps the vanishing point the only vanishing point that the image has so basically all you have to do is to switch to manual mode and drag the principal point on top of the vanishing point that's it anyways there's this nasty little thing in of spy that the vanishing point disappears as soon as you activate the precision mode you don't see those lines in the magnifying glass so it's a little hard to be accurate and to overcome this problem i usually drag the focal's length slider all way down or even type something ridiculously small like 2 to increase the distortion because this will emphasize even the tiniest offset from the right position and it will also force me to be very precise and now i can set the principal point by dragging this orange dot until the axes are properly aligned okay guys now you know how to set the principal point for all types of images although this is not the end of work that needs to be done in f spy let's go to blender for a second to see what it looks like there you'll need the f spy addon for blender to import the f spy project file and when you do this a new camera is added to the scene and it has this background image already set now to show you what the current problem is i'm going to add a circle here and as you see it has this weird proportion it is horribly stretched and this is because our field of view is way too large 167 degrees now where did blender get this value from as you can imagine it was set by f spy so if we go back there and look around we'll see that there is such a thing as field of view and it reads 167 degrees but this is a read-only field as a matter of fact it's calculated from two other fields the sensor size and focal length so although we cannot control this directly we'll do this by changing the focal length and the relation between these two is the lower focal length you provide the higher field of view you get sensor dimensions can be left with their default values i mean they are helpful in one case when you somehow know these values both sensor size and focal length i don't know maybe from the author of the image or maybe from the metadata if you know them simply type them in and you're done otherwise use the following process first guess what the value might be second match a known shape against the image and third keep doing this until it looks good yeah there's going to be a lot of eyeballing in this stage and it's best to use one of the basic shapes for this like a circle a rectangle maybe a hexagon whatever works for you we have to locate one of those shapes in the image so let's have a look um i guess the base of this pillar is a circle this lamp has also a circular shape and that table top seems to be a hexagon okay we have some references now how do we match them well f-spy only provides a simple 3d guide as a reference so my recommendation now is don't do it enough spy use blender instead because it gives you total flexibility and you can match any shape you wish it's worth noting that on lag of spy blender allows you to edit both field of view and the focal length whichever value you update the other is recalculated you can switch between these units in camera properties there are those two options field of view and millimeters which stands for the focal length and as you see it has this value of 2 millimeters that i've already typed in f spy so i'm going to increase this to some arbitrary volume let's say 7 and now i have to retry what i already did which is matching my circle against the pillar base it looks better but still not good enough so we'll need to check some other values remember that if you prefer to use field of view instead of focal length just change the unit um by the way our field of view has been recalculated and it's lower now 137 degrees instead of 167. anyways the only way to find the right value is to keep trying and although i could do this here with the pillar it is slightly better to match the shape further from the principle point and it's because the distortion near the principle point might not be that evident usually it's best to do this near the edges so let's use the lamp instead because the circle is still stretched too much i need to lower the field of view i'm going to switch the unit to focal length though it doesn't matter at all but it's just my personal preference um okay so let's type a larger value by the way every time you change it you need to reposition the reference shape don't worry it's normal tn is still not enough so let me try 15 and well now it looks like it's stretching the other direction so i think i've overshooted it let's try to decrease the value and now it looks pretty nice okay i'm gonna double check it by adding another shape here this time i will use a hexagon and to add a hexagon in blender you can select the circle and set the number of vertices to six so let's scale this down and oh yeah there's one very important thing you need to remember when you scale your reference shape do this uniformly because you don't want to change this proportion okay um right so let's rotate this along z axis by 30 degrees and yeah this looks very well which means we got the proper value now so we are almost at the finish line but because this whole thing is supposed to work in virtual reality there's still this little problem take a look at this i added the circle at the bottom of the pillar and i'm going to extrude this all the way up to the ceiling and look at the dimensions the pillar has seven centimeters it is less than three inches now i don't know how large this room is but i'll budget dollars to donuts that is not that small so let's finish our job in f-spy and match the proper dimensions of course before we measure anything we have to set the focal length to the proper value and now we know it's 14 so let me type this here by the way you're not limited to integers you can use fractions if you wish but since our value was 14 i'll get back to it now we need to find something with known size but if you have no idea what dimensions particular items have there is this great website called dimensions.com you can type whatever you want here and they have this enormous database with dimensions and also some sketches which can be used as reference images i think it's invaluable for 3d modelers okay but i think i should find something with kitchen in its name um maybe these kitchen cabinets uh let's see what their standard size is or maybe even check a dishwasher because i believe that a segment in the kitchen has the width of a dishwasher all right so it's 60.3 centimeters okay so there are those two things you need to do in order to set the dimensions in f-spy first of all you have to anchor this origin to something you can measure and then you set the reference distance and although you can put this origin anywhere on the image i highly recommend doing this somewhere on the floor this point will be the center of our blender scene and the only reference when we start modeling and if you mess it up all these measurements that we're gonna take now will be useless i mean although studying from a different point is still feasible it's going to be more error prone anyways i'm going to measure this cabinet over here so let me change the reference distance from the default value to the appropriate axis in our case this is y so i got this additional ruler with two handles and now i can grab the origin and move it here as i said it's better to have it on the floor level so let me put this a little lower and now i can grab the handles of my ruler to match the reference distance and because we know that it has 60 centimeters let's just type it in here f-spy has this little bug if you type anything you can't press tab because the value will disappear you have to confirm everything by pressing enter and yeah that's it we finished our working of spy remember though we are halfway through there are still several mistakes that you can make in blender so don't forget to watch the rest of this video and if you like it leave a comment and hit the subscribe button okay let's make a 3d sketch now this is what it's going to look like at this stage it's enough to use the basic building blocks and simple shapes because all we need is to quickly adjust the sizes and proportions we are not going to use any advanced modeling techniques today simple extrusions and transformations will suffice we'll focus on the challenges you'll face and the mistakes to avoid so one of the biggest mistakes people make is forgetting about the depth and to show you what i mean let me model this pillar over here i'm going to add a circle align it with the image and yeah it seems good but the problem is i have absolutely no idea how far from my camera the object is so i might as well have another pillar significantly smaller move it closer to the camera and align it with the first one and because this is a two dimensional image it gives us this false impression that both pillars have equal size and are located next to each other but if we switch to the 3d view and look at the scene from a different perspective it becomes clear that none of these are true so like it or not it's impossible to determine all three coordinates from a flat image you need to know at least one to get the other two this is why we need the origin it's the center of the scene and because it's attached to some objects we know that these objects have one of their coordinates set to zero in our case these are the floor and the side of the island and because we know one of their coordinates we can safely align their meshes with the image and get the correct results so i can add a plane make sure it's it has its x coordinates set to zero and now align its edges with the image and then add another plane for the floor ensuring its z position is zeroed and also do the same thing okay and now we have more reference points not just the origin we know the position of this edge so we can model the countertop we also know where these edges are so we can model the windows by the way i told you earlier that i usually put the origin on the floor this is very convenient because it lets me model anything that starts at my floor level in particular this pillar i just have to remember not to start from the top because i don't know its hide but from the floor which has its c position set to zero so i'm going to add a circle on the floor and align it with the pillar base all right now there's this crucial thing i did i press g followed by shift z to constrain my movement along the floor plane it's because pressing g and freely moving the mouse changes all three coordinates but because we're looking at the image from the same position all the time it is hardly noticeable and that's why i'm hammering the point home that in this part of the process almost every grab operation should be constrained so you press g followed by x y or z or to select the whole plane g followed by shift x shift y or shift z it's very easy to forget about it especially when you make slight adjustments so let it better become your habit all right but let's finish our pillar by adding a face and extruding it all the way up good now i got the proper height of the pillar and at the same time the height of the apartment so i can duplicate the floor press z to move it vertically and then snap it to the top of the pillar and from now we can model the new objects also from the ceiling level by the way you might have noticed that i haven't used this button to toggle snapping neither have i press shift tab to activate it and it's because blender has this neat option when you drag anything you can press and hold the ctrl key and it temporarily activates the snapping mode i use this frequently because it's less clicking and sometimes i realize i need to use snapping when i've already started dragging so without this little shortcut i would have to stop it turn the snapping on and then grab my object again but with this control key i can use it anytime and it's really convenient okay there are a couple of other tricks i'd like to share with you and i'll need this tabletop for this so let's model it i can't do this directly because none of its coordinates are known at the moment so i get to start from the bottom just like with the pillar align it precisely okay and now grab it up along z add a face and extrude it because it also has some depth okay now that i know where the table top is i can model next objects from here like this book and here's the other trick as you know blender adds new objects at the cursor position so i can click here and then drag the cursor with my mouse but the best thing is that the control snapping i've just presented works in this mode as well so if you have the snapping target set to face you can put your cursor onto any surface right away and although from this view it's not that apparent it will be well pronounced in the 3d view so let me split the viewport so by the way i usually split my screen screen this way it lets me simultaneously align the meshes with the image and still look at them from different angles when i need it okay but if i want to add this book over here i can drag the cursor hit the ctrl key and my new object appears where it should so let's scale this down fix the position a little bit and extrude it and and we're done um but i'm going to share another secret i'm too lazy to manually switch between these tools so i never use this button to move the cursor there is a better way to do it at any time you can press shift and then hold the right most button and out of sudden you're dragging the cursor and while dragging this cursor you can press the control key and you can snap it to the surface and this is absolutely brilliant because the whole operation doesn't take more than moving your mouse so you can rapidly add new objects at the desired locations but there's even more you can do to optimize your workflow because you know sometimes you want to snap the cursor to a face sometimes do a vertex so if you don't want to waste your time on switching between these snapping targets you can actually set both of them i'm not sure if you're aware of this but the snapping target window allows to select multiple items with shift so vertex plus face is my default configuration and this is an amazingly powerful time saver you have to be aware though that the order of the keys you press is vital you start with shift right mouse button and only when you start dragging the ctrl key because if you press ctrl followed by the right mouse button it will activate this lasso selection tool anyways let's move to the other side of this apartment in this dining chair to talk about another problem you may face sometimes especially when you deal with irregular shapes you may have troubles with proper alignment um let's assume you want to align this edge with the leg but again because this is a two-dimensional picture i have no idea if i should move it along the x or y-axis because both give fairly good results so here's the trick if there are more identical objects in the image like these six chairs you can leverage the fact that each gives you a slightly different perspective so you create a length duplicate of the object by pressing alt d instead of shift d and now all your modifications of the mesh are applied to both objects actually they share the same mesh you can still move and rotate the object separately to align the copy with the other chair and now the problem we had isn't relevant anymore because you have more references to look at so whatever you do has to be aligned nicely with all the references you can also switch between the objects and use their local orientations to constrain movement it really helps if you're interested in how i modeled the whole scene you can watch the rest of this video otherwise see you in part 2 where i'm going to cover the modeling techniques and create the final 3d model thanks a lot for listening i hope these advice were helpful and let me know if you have any questions or believe that something can be done better and again don't forget to subscribe good luck take care [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] [Music] you
Info
Channel: Bartosz Pampuch
Views: 39,694
Rating: undefined out of 5
Keywords: camera matching, fspy tutorial, camera matching blender, camera perspective matching in blender, principal point, vanishing points, focal length, perspective matching, fspy demystified, all options explained, fspy explained, fspy workflow, fspy troubleshooting
Id: daiMOYR8GS8
Channel Id: undefined
Length: 39min 53sec (2393 seconds)
Published: Fri Jul 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.