News:

The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software can be used with TurboCAD.

Main Menu

Using fSpy with Turbocad

Started by AussieBloke, November 17, 2023, 04:34:46 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

AussieBloke

fSpy is a camera matching, or camera calibration, is the process of estimating camera parameters
from certain features in an image. fSpy computes the approximate focal length, orientation
and position of the camera in 3D space based on user defined control points in still images.
The computed camera parameters can be used in other apps, for example 3D modeling
tools. from the source fSpy basics.pdf

Since Im venturing down a rabbit hole here, Im trying to understand in the fSpy bright image.png file what or howto interpret the Camera position relative to Turbocads Camera properties ( red circle )?

As you can see Ive got fSpy set with 1 only vanishing point along the Y axis and the fSpy Selector showing approx in the right location ( sure approx is nowhere near the right 3D space location, Im just learning here ).

Ive never ventured into the tcs camera properties before, so from the image attached whats the meaning and difference between fSpy's Camera Position & Camera Orientation and how do they relate to each other?

Im using a tc layout preset iso_se and plan to view this work.



Brandon Meyer

I found that the position data works but the rest of it doesn't integrate well. The other issue is that using a camera object doesn't seem to work good as I have not found a way to lock it in place. It seemed the best way was to create a workplane that was what the image would lie on and then going to the view by workplane Ctrl+Shft+W and then from there one can save it as a workplane to come back to or create a view. In the view you can use the camera position data to set it up as well but one must take in to consideration the axis origin identifier in fspy is in a same position (preferably center of image if it works to put it there) and the image is aligned in same spot in TC. The only way to zoom in is to use the "dynamic zoom" which I am unsure where that is in the menus but under device setup for the mouse you can have it as a shortcut. I use Ctrl+middle mouse button for dynamic zoom. If you zoom only with the wheel then it changes the perspective. I am working some things out for a simple video to start off explaining this stuff which could further be developed on. 
By the way my huge paper manual from v21 doesn't have much on these different camera settings other than the obvious which is disappointing as there seems to be some complexity to them and no idea what any of it truly means.
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

Brandon Meyer

#2
Quote from: Darryl W on 17-11-2023, 06:14:25
Okay Brandon, so lets work together on a new thread that explains how to use fSpy in TurboCAD?
Edit: I suggest we use 1 of the example files from TurboCAD.  That way we stay on the same page so to speak. Your thoughts?
End Quote


Sure, sounds good. I am still working this all out as well. Let me know what you want to do.

Continuing on from the forum post https://forums.turbocad.com/index.php?topic=30988.0.  The following was transferred from that post

So here is a video I made showing how I got things to work. One thing that isn't in the video is that when your view is established you can pan the view to get the 3d geometry to match up a little better and then in camera properties use the view angle to zoom in and out and then you can create a new view. The video will have to be redone again but I figure you guys can maybe play with it some to see how things work out for you. I will give a link to the video and also attach my 2020 TC PP file. Youtube Video Link Click here

Another way to create the initial workplane could be to use the data to create a view and then do a workplane by view and then straighten and create new workplane like in video. As I said it is a work in progress.

Session keeps timing out for my tcw file upload so I will try later.

The create initial worklplane by using view info is much faster and easier. I will have to setup another video showing that. It is 1045p here so I am going to hit the hay. The other video should get someone started on playing with this at least.

## Edit ## Text transferred from wish list thread, for continuation here ## End Edit ##
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

AussieBloke

#3
Quote from: Brandon Meyer on November 17, 2023, 08:48:38 PMI added some more info in this other posting https://forums.turbocad.com/index.php?topic=30988.0. Not sure if I should continue to post more on this here or in that other one. Let me know what you think Darrel.

Thanks for that Brandon.  ;D

Maybe continue on from here and ask the moderators to change those posts in the Wish list here.

## Edit ## some text transferred from wish list thread by mod, for continuation here ## End Edit ##

Andy H

Darryl.  I didn't want to risk losing anything, so I have just moved Brandon's text (plus link),  and your reply from the wish list forum to here.  and deleted the relevant posts in the wish list part.  For anyone else,  see Brandon's post number 2 here for text transferred from wish list.

Andy

Alvin Gregorio

Quote from: Brandon Meyer on November 17, 2023, 05:22:52 PMI found that the position data works but the rest of it doesn't integrate well. The other issue is that using a camera object doesn't seem to work good as I have not found a way to lock it in place. It seemed the best way was to create a workplane that was what the image would lie on and then going to the view by workplane Ctrl+Shft+W and then from there one can save it as a workplane to come back to or create a view. In the view you can use the camera position data to set it up as well but one must take in to consideration the axis origin identifier in fspy is in a same position (preferably center of image if it works to put it there) and the image is aligned in same spot in TC. The only way to zoom in is to use the "dynamic zoom" which I am unsure where that is in the menus but under device setup for the mouse you can have it as a shortcut. I use Ctrl+middle mouse button for dynamic zoom. If you zoom only with the wheel then it changes the perspective. I am working some things out for a simple video to start off explaining this stuff which could further be developed on. 
By the way my huge paper manual from v21 doesn't have much on these different camera settings other than the obvious which is disappointing as there seems to be some complexity to them and no idea what any of it truly means.
That was a lot to wrap my head around, this early morning, before my coffee kicked in.

But, I wanted to offer:  In Perspective View, for Zooming in and out, my preference is the Walk Tool, within the Walkthrough group of tools.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Brandon Meyer

Quote from: Alvin Gregorio on November 18, 2023, 06:06:44 AMThat was a lot to wrap my head around, this early morning, before my coffee kicked in.

But, I wanted to offer:  In Perspective View, for Zooming in and out, my preference is the Walk Tool, within the Walkthrough group of tools.

How is it now after the coffee  ;D. I found the walk tool to not work quite as well as I hoped. I tried that first thinking it was the answer but it seemed not as controllable as far as going straight on.

Thanks Andy for moving things around and organizing them.
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

AussieBloke

Quote from: Brandon Meyer on November 18, 2023, 11:22:44 AM
Quote from: Alvin Gregorio on November 18, 2023, 06:06:44 AMThat was a lot to wrap my head around, this early morning, before my coffee kicked in.

But, I wanted to offer:  In Perspective View, for Zooming in and out, my preference is the Walk Tool, within the Walkthrough group of tools.

How is it now after the coffee  ;D. I found the walk tool to not work quite as well as I hoped. I tried that first thinking it was the answer but it seemed not as controllable as far as going straight on.


Try setting the scroll speed for the Walk thru Tools in the Camera settings, that should make it smoother to control.

Brandon, I took a look at your video late last night and it seems you may have got close with TurboCAD.

I also found this much more comprehensive video about fSpy on YT, seems the fSpy author left off/out details/information take a look.

https://youtu.be/daiMOYR8GS8?feature=shared






Alvin Gregorio

#8
Quote from: Brandon Meyer on November 18, 2023, 11:22:44 AMI found the walk tool to not work quite as well as I hoped. I tried that first thinking it was the answer but it seemed not as controllable as far as going straight on.
I wonder if we're talking about the same "Walk Tool".
The .gif below shows the one I mean.  Click on it to get the video aspect started.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

AussieBloke

Quote from: Alvin Gregorio on November 18, 2023, 01:51:01 PM
Quote from: Brandon Meyer on November 18, 2023, 11:22:44 AMI found the walk tool to not work quite as well as I hoped. I tried that first thinking it was the answer but it seemed not as controllable as far as going straight on.
I wonder if we're talking about the same "Walk Tool".
The .gif below shows the one I mean.  Click on it to get the video aspect started.


Yep thats what I was thinking also.

Heres one of the best images that Ive found on the public domain thats got enough resolution and works for me. Can we use this image in fSpy ( Ive already drawn in the X Y Z reference planes as best I could figure out ) as our test case and see what we get. Thats what Im doing now.




Brandon Meyer

Alvin, that is the tool I was talking about. I will play with the scroll speed like Darryl suggested. It was way too fast but I was working on a smaller scale so perhaps with larger size objects it would be better in stock form. Darryl I will check out that video also. As far as the image you posted goes, sure we can use that. Do you have a higher resolution one that you can maybe email me? If you click on my name it will bring up my email address. I see your fspy lines in the one you posted and I can match them up and see how it all works out.
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

AussieBloke


AussieBloke

Yep, that image is from either pixabay or pexel. The original image is 10+mb, even zipped its too large to post here. I can dropbox the original if you like.

AussieBloke

I just solved how to use fSpy for TurboCAD and its worked very well.  :P

This is gunna help heaps of TurboCADers down the track with rendering a perspective object and placing it in a background image.  ;)

Im a happy boy, Brandon created a video using fSpy ( thanks mate :D couldnt find your email by the way ) and I picked  up on that error that he made and was then was able to solve using fSpy for tc.  ;D

Im just doing some post processing in PSE ( Photoshop Elements 2024, by the way PSE reads older Photoshop files circa 2015/2016 etc. Thats a bonus as theres lotsa good videos out there ).


Brandon Meyer

#14
Here is a low resolution screenshot sample that was not rendered out with shadows just to show the alignment. It isn't perfect. In fspy using the new info from that video Darryl posted I was able to get it all lined up perfectly but in turbocad things are still off some. I think however it is good enough for things like this but not good enough to be able to model as a reference off of.  When the .fspy file is loaded in blender it is absolutely perfect and could definately be modeled off of so something is missing but this is probably as far as I go with it and will let you guys play with it. I will however make a new video detailing the easier way of getting the workplane setup but I will wait till after Darryl lets me know how his turned out.  My TC file is attached below if anyone wants to look at it.
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

AussieBloke

Okay so here my 1st attempt: ( Ive just dumped the PSE edited Handtruck into Storage Shed.png but not finished yet, so that we can compare the before and after results of the handtruck image inside Storage Shed.png scene )

I will create a video as soon, just post processing todo now.


AussieBloke

#16
The 1st image of the Handtruck and the Storage shed did not upload.  ???

Edit: No it doesnt have shadows atm, but it will have shadows when Im done and I will tidy up the image some more too. Oh yeah I can also see sime green from the backgound around the handtruck, must have changed my PSE settings.

EDIT2: The handtruck just looks way too photoshopped just yet.


AussieBloke

So Im posting a better image here now, but I can see that I didnt get a good TurboLux render right from the get go cos I zoomed way to far out in tc and it just lost some detail and pizazz. Okay so Ive now figured that the best method for getting perspective images onto backgrounds appears to me to be max zoom with tc to capture the TuboLux details and to crop the background of the image the renders going into.

So heres another attempt but Im still not finished yet. Im quite happy with the perspective render, still havent added shadows yet.


Dean

good job, Darryl  :)  interesting topic... :)

I didn't use that program.


I set up a workplane then placed the object on the WP along with a shadow catcher.
It was fairly simple and It's easy to tweak the camera.
see attached,
Used the image you posted and rendered with my rig that only supports CPU rendering, 300 secs.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

AussieBloke

#19
Quote from: Dean on November 19, 2023, 12:50:03 PMgood job, Darryl  :)  interesting topic... :)

I didn't use that program.


I set up a workplane then placed the object on the WP along with a shadow catcher.
It was fairly simple and It's easy to tweak the camera.
see attached,
Used the image you posted and rendered with my rig that only supports CPU rendering, 300 secs.


Thanks Dean, Im not having any success with TurboLux shadows in any render.  ???

I've tried multiple times with TurboLux and either Im missing something thats not obvious to me or my pc/nvidia driver is up the wazoo.

EDIT: Ive never worked with the Camera object before, what tweaks did you make?

Would you share that drawing you posted with me/forum thankyou?

So I can study the differences on my shadow setup versus your setup?


AussieBloke

Questions for John R

That Up Vector Chart ( read png image file ), Don Cheke mentioned that in a recent TurboLux video he created.

Is the Up Vector you made related to the  Camera properties data?


John R

#21
Quote from: Darryl W on November 19, 2023, 02:35:50 PMQuestions for John R

That Up Vector Chart ( read png image file ), Don Cheke mentioned that in a recent TurboLux video he created.

Is the Up Vector you made related to the  Camera properties data?



Yes, the "UP Vector" column in the Camera Properties dialog.

Here's the "UP" arrow from the picture. View it from a World Plan view. Go to Camera Properties and enter something like "-1, -1, 0" and the arrow (View) will point to the lower left corner. It just changes your "View" in 5 degree increments.
John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit

AussieBloke

Quote from: John R on November 19, 2023, 03:31:35 PM
Quote from: Darryl W on November 19, 2023, 02:35:50 PMQuestions for John R

That Up Vector Chart ( read png image file ), Don Cheke mentioned that in a recent TurboLux video he created.

Is the Up Vector you made related to the  Camera properties data?



Yes, the "UP Vector" column in the Camera Properties dialog.

Here's the "UP" arrow from the picture. View it from a World Plan view. Go to Camera Properties and enter something like "-1, -1, 0" and the arrow (View) will point to the lower left corner. It just changes your "View" in 5 degree increments.

Thanks mate that will help with the current & future projects. 👍

 

AussieBloke

So heres another image with the ht and background, this time Ive added a shadow that helps to legitamize the view. Still not overly happy with the results. PSE/Photoshop is a cool tool to use but its a big learning curve and its a whole new ball game again. Im not done yet...


Dean

Darryl, you figured out the shadows  :)
I tested the workplane using animations... see attached videos.
These were rendered on my other computer that supports Open CL 3.0, each frame rendered at 40 sec.
So, the WP is aligned with the background image.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

AussieBloke

Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)


Thats a PSE shadow not a TurboLux shadow.  :o

Dean still having issues with TL shadows.  :(


Dean

Quote from: Darryl W on November 20, 2023, 12:06:03 PM
Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)


Thats a PSE shadow not a TurboLux shadow.  :o

Dean still having issues with TL shadows.  :(


Don't cheat mate because sooner or later.... :)  :)
Darryl, for shadows >
create a profile to be used as a ground plane
create surface from profile
create a Turbolux material RGB diffuse color is 1,1,1 matte
check the "shadow catcher enable" in the material common properties.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

AussieBloke

Quote from: Dean on November 20, 2023, 01:35:52 PM
Quote from: Darryl W on November 20, 2023, 12:06:03 PM
Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)


Thats a PSE shadow not a TurboLux shadow.  :o

Dean still having issues with TL shadows.  :(


Don't cheat mate because sooner or later.... :)  :)
Darryl, for shadows >
create a profile to be used as a ground plane
create surface from profile
create a Turbolux material RGB diffuse color is 1,1,1 matte
check the "shadow catcher enable" in the material common properties.


TurboLux shadows solved.  ;D  ::)

AussieBloke

Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)
I tested the workplane using animations... see attached videos.
These were rendered on my other computer that supports Open CL 3.0, each frame rendered at 40 sec.
So, the WP is aligned with the background image.

Yep, got the shadows figured out ( my fault here ). Dean those attached Car perspective_Anilab.mp4
& Car perspective_Anilab 2.mp4 videos did you do them with TurboLux rendering?



Dean

Quote from: Darryl W on November 28, 2023, 06:06:06 PM
Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)
I tested the workplane using animations... see attached videos.
These were rendered on my other computer that supports Open CL 3.0, each frame rendered at 40 sec.
So, the WP is aligned with the background image.

Yep, got the shadows figured out ( my fault here ). Dean those attached Car perspective_Anilab.mp4
& Car perspective_Anilab 2.mp4 videos did you do them with TurboLux rendering?




Yes, OCL with Nvidia Optix denoiser.
Each frame rendered for 40 secs.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

AussieBloke

Quote from: Dean on November 29, 2023, 04:55:38 AM
Quote from: Darryl W on November 28, 2023, 06:06:06 PM
Quote from: Dean on November 20, 2023, 07:53:02 AMDarryl, you figured out the shadows  :)
I tested the workplane using animations... see attached videos.
These were rendered on my other computer that supports Open CL 3.0, each frame rendered at 40 sec.
So, the WP is aligned with the background image.

Yep, got the shadows figured out ( my fault here ). Dean those attached Car perspective_Anilab.mp4
& Car perspective_Anilab 2.mp4 videos did you do them with TurboLux rendering?




Yes, OCL with Nvidia Optix denoiser.
Each frame rendered for 40 secs.

Good stuff Dean, Im gunna jump into Animationlab with the ht now.  :o

Colin Edgar

Thank you to Darryl W for suggesting that I try using fSpy for matching a perspective view of a 3D model to a background image. It took me a while to figure out (I think) how to translate fSpy's field of view, camera location, and camera orientation values into TurboCAD's camera properties (using some math involving Euler angles, vectors, matrices.... my brain hurts) but I created an Excel spreadsheet to do the calculations.

Just as an example, the first attachment shows a segment of an airport runway (in red) drawn in TC on a workplane having a UCS that is positioned at a random location and orientation relative to the WCS. I measured the width of the runway as 200 feet on Google maps and used this as the reference distance in fSpy. After inputting the calculated values into the viewport camera properties, the runway lines up very closely with the background image. This image has lots of straight lines which made it easy to establish two vanishing points in fSpy fairly accurately.

The second attachment is another example, this one using a single vanishing point. In this case the Meccano model is about 1:24 scale so I divided the fSpy reference distance (160 feet = width of the hangar) by 24 and entered it as 80 inches (to match the modeling units used in TC). This makes the model appear life-size relative to the hangar. I've tried the spreadsheet on a number of other images, so far with similar positive results.

I tried uploading the spreadsheet to the forum but it won't accept .xlsm files. Is there another way that I can make it available to other TC users to try out?
TurboCAD Deluxe 2021 (64-bit, ver. 28, build 50); Windows 11 Home; Lenovo Legion 7, Intel Core Ultra 9 275HX, 2.70GHz, 24 cores, 32GB RAM, NVIDIA GeForce RTX 5070

AussieBloke

Good to see Colin that youve mastered using the fSpy app and tc's rendering together.  ;D


See my reply #7 for a video.

See my reply #15 for how I used fSpy, I notice that you calced data to use fSpy for your render well done.

Dean, one of our senior beta testers is a gun TC user, he didnt use fSpy at all to get great renders in perspective. I think I asked how he did this but I wasnt sure if I understood his reply.

Other tc user and forum regulars have said over the years "how in the heck does Dean know all this stuff", Im referring to his tc knowledge that knows nows no end. :o



Alvin Gregorio

Quote from: Colin Edgar on May 07, 2024, 04:40:16 PMI tried uploading the spreadsheet to the forum but it won't accept .xlsm files. Is there another way that I can make it available to other TC users to try out?
Add .txt to the end of your file name.  And attach that.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Colin Edgar

Thanks Darryl. I don't know that I've mastered using fSpy with TC but I'm definitely happier with my renders :) . Re: the video, yes, I did watch that one; it provides a very good explanation of how to use fSpy. And I agree, I've read many of Dean's posts and found them very helpful in unraveling TC's many mysteries!

Thanks Alvin, adding .txt to the filename seemed to work. I'm guessing that potential viruses are the concern with .xlsm files but I've scanned the file with Norton Antivirus before uploading.

My goal with the spreadsheet is to take some of the guess work out of the TC camera settings when using a background image. Can't promise it'll work in every situation and there's probably a more efficient way of doing the calculations. Feel free to modify and improve it to your liking. The notes on first tab are mainly to remind me how to use the spreadsheet but they might be helpful to others learning to use fSpy with TC.
TurboCAD Deluxe 2021 (64-bit, ver. 28, build 50); Windows 11 Home; Lenovo Legion 7, Intel Core Ultra 9 275HX, 2.70GHz, 24 cores, 32GB RAM, NVIDIA GeForce RTX 5070