Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

convert existing "old" camera to Physical Camera...

jens.diemer
Collaborator Collaborator
12,871 Views
18 Replies
Message 1 of 19

convert existing "old" camera to Physical Camera...

jens.diemer
Collaborator
Collaborator

It seems there is no way in max to convert a old camera in a new Physical Camera...

 

I have made a script for this:

 

 

old_cameras = $Camera* as array
old_cameras = (for o in old_cameras where o.baseObject.category == #standard collect o)

for old_cam in old_cameras do
(	
	new_camera = Physical_Camera()
	new_camera.transform = old_cam.transform
	new_camera.specify_fov = true
	
	if old_cam.type == #free then (
		new_camera.targeted = false
	) else (
		new_camera.targeted = true
		new_camera.target_distance = old_cam.targetDistance
	)
	
	for prop_name in getPropNames old_cam do
	(
		if hasProperty new_camera prop_name then (
			prop_value = getProperty old_cam prop_name
			setProperty new_camera prop_name prop_value
		)
	)
)

 

Jens

------------------------------------------------------------------------------------------------------------------
https://github.com/jedie/3dsmax_bugs | https://github.com/jedie/3dsmax_patches
Accepted solutions (2)
12,872 Views
18 Replies
Replies (18)
Message 2 of 19

office
Collaborator
Collaborator

Thanks for taking the time to create this script and sharing it! I may try it soon. Do you know if it works with Vray cameras?


3ds Max subscription customer since 2010
| Max 2022.1 | AMD Threadripper 3970X 32-core | 64GB RAM | Nvidia GeForce GTX 1080 Ti FE 11GB | NVMe SSD Samsung 960 Pro | Win10 Pro x64 | Nvidia Driver 466.47
0 Likes
Message 3 of 19

Anonymous
Not applicable

I would need to convert the new Physical Camera from max2016 into the old Free Standard Max camera.

 

Do you think it's possible to convert that with your script ?

Or some adjustments ?

 

That would be amazing ! 

Thank you so much for every little help,

appreciate it !

 

 

0 Likes
Message 4 of 19

ddesmarais
Participant
Participant

This script doesnt seem to work...

0 Likes
Message 5 of 19

Anonymous
Not applicable

Hi jens.diemer

 

Very thanks for your script !

 

I'm do some little upgrade:

-ability to convert selected cam only.

-name the new cam with the original name

 

old_cameras = $Camera* as array --No Vray convertion neded
old_cameras = (for o in old_cameras where  classof o == Targetcamera or classof o == Freecamera collect o)
if selection.count==1 then
(
	if classof (selection[1]) == Targetcamera do
	(
		old_cameras = #((selection[1]))
	)
)else()

for old_cam in old_cameras do
(	
	new_camera = Physical_Camera()
	new_camera.transform = old_cam.transform
	new_camera.specify_fov = true
	new_camera.name = "(phy)" + old_cam.name
	
	if old_cam.type == #free then (
		new_camera.targeted = false
	) else (
		new_camera.targeted = true
		new_camera.target_distance = old_cam.targetDistance
	)
	
	for prop_name in getPropNames old_cam do
	(
		if hasProperty new_camera prop_name then (
			prop_value = getProperty old_cam prop_name
			setProperty new_camera prop_name prop_value
		)
	)
)

JBB

 

Message 6 of 19

troyhome
Explorer
Explorer

This is amazing! Thanks so much...

One thing I notice is that the new physical camera ends up facing in the opposite direction to the original target camera

0 Likes
Message 7 of 19

Anonymous
Not applicable

Hi TroyHome,

 

Wat is your 3ds max release ?

 

Thx.

 

JB

 

0 Likes
Message 8 of 19

Anonymous
Not applicable

Hi TroyHome,

 

What is your 3ds max release ?

 

Thx.

 

JB

 

0 Likes
Message 9 of 19

troyhome
Explorer
Explorer
I'm using 2017.
TH
0 Likes
Message 10 of 19

Anonymous
Not applicable

Hi TroyHome,

I haven't test the script on 2017...

but normally it working.

 

The position of target of original Cam it not so nearest from cam point ?

 

TH,

0 Likes
Message 11 of 19

Anonymous
Not applicable

I found that the float default value of the target distance is different between standard camera and physical camera.

MAX Help / MAX Script / Camera Common Properties, Operators, and Methods

... more info 


Therefore, when I use this script, and I found that the new target could not match the old target's position.

However, I do not have any idea of how to convert the difference between the float default values to the same.

And then, I did something different.

I did a little changes based on the upgraded version which written by jbaptiste.
I did not use "target.distance", I changed it to "target.transform".

It seems that it works.

I paste the script here...

old_cameras = $Camera* as array --No Vray convertion neded
old_cameras = (for o in old_cameras where  classof o == Targetcamera or classof o == Freecamera collect o)
if selection.count==1 then
(
	if classof (selection[1]) == Targetcamera do
	(
		old_cameras = #((selection[1]))
	)
)else()

for old_cam in old_cameras do
(	
	new_camera = Physical_Camera()
	new_camera.transform = old_cam.transform
	new_camera.specify_fov = true
	new_camera.name = "(phy)" + old_cam.name
		
	if old_cam.type == #free then (
		new_camera.targeted = false
	) else (
		new_camera.targeted = true
		new_camera.target.transform = old_cam.target.transform
		
	)
	
	for prop_name in getPropNames old_cam do
	(
		if hasProperty new_camera prop_name then (
			prop_value = getProperty old_cam prop_name
			setProperty new_camera prop_name prop_value
		)
	)
)


By the way, I test it in 3ds max 2017.

Thanks for the effort jens.diemer and jbaptiste made. Nice script.


 

Message 12 of 19

Anonymous
Not applicable

It worked for me when working on our latest animation.
Check out the trailer here:

http://stillinmotion.com/smart-shoe/

 

Smart_Shoe_002.jpg

 

cheers,

Bernhard

 

 

Message 13 of 19

Anonymous
Not applicable

Nice animation!! Congratulation!!

And I just wrote a new script. Similar, but for the different purpose.

It is converting a physical camera to a standard one. 

Paste this script...

old_cameras = $Camera* as array
old_cameras = (for o in old_cameras where  classof o == Physical_Camera collect o)
if selection.count==1 then
(
	if classof (selection[1]) == Physical_Camera do
	(
		old_cameras = #((selection[1]))
	)
)else()

for old_cam in old_cameras do
(	
	new_camera = FreeCamera()
	new_camera.transform = old_cam.transform
	new_camera.name = "(standard)" + old_cam.name
		
	if old_cam.targeted == false then (
		new_camera.type = #free
	) else (
		new_camera.type = #target
		new_camera.target.pos = old_cam.target.pos
				
	)
	
	for prop_name in getPropNames old_cam do
	(
		if hasProperty new_camera prop_name then (
			prop_value = getProperty old_cam prop_name
			setProperty new_camera prop_name prop_value
		)
	)
)

In this case, I do not use "target.transform", I use "target.pos".
Something weird, "transform" would not bring the right result.

However, if the camera has simple animation, it could add the setting of the parent constrain to camera and camera target.

For the new one following the old one's animation.

 

For example...

 

new_camera.parent = old_cam


Test it in 3ds max 2017.

 

Message 14 of 19

Anonymous
Not applicable

Doesn't work on my end when using max2019.

  • I save the script as .ms file and also tried .mcr
  • Loading and running that script doesn't work ... 

 

What am I missing here?

0 Likes
Message 15 of 19

Anonymous
Not applicable
Accepted solution

https://i.imgur.com/NFErag3.gif 

I recorded a simple gif for demo it. Save .ms, and drag it to your 3dsMax. 

0 Likes
Message 16 of 19

mattCQ993
Explorer
Explorer
Accepted solution

If you are not versed in ms script, like myself, another workaround is to create a physical camera in the scene, align it on all axis in the align tool, then link it to the existing old camera. Then type in the same FOV angle from the the old camera into the physical camera's FOV and sect that as camera view. It's a perfect lens match,  and is perfectly linked to any animation settings the old camera has. You can then use the DOF and motion blur settings as desired in the physical camera. I have done this in MX 2020 with Arnold. 

Message 17 of 19

mattCQ993
Explorer
Explorer

To clarify a little more : Create a Physical camera in the scene where you want to replace an old camera. Un-check the targeted box. Select the align tool with the new camera selected, then click on the old camera. When the align tool dialogue opens, check all the X,Y,Z axis to align orientation and do the same with scale. Then again select the Physical camera, enter the same FOV number as is in the old camera. When you change the selected camera in the camera viewport to select your physical camera, the view will not alter at all - showing you the lens is a perfect match in angle and orientation. Final steps are to link the Physical camera to the old camera body to apply all transforms and animations previously applied. Adjust exposures / DOF and motion blur as desired in the Physical camera. Hope that is more clear!

Message 18 of 19

mmccforensic
Explorer
Explorer

Even easier (works in 3ds Max 2023, anyway):

  1. Make sure that the Standard Camera from which you wish to duplicate a Physical Camera is currently displayed in a Camera Viewport.
  2. From that Camera Viewport’s header, click on its name and select “Perspective” to turn it into a Perspective Viewport showing what that Camera Viewport had showed.
  3. Create” ⇒ “Cameras” ⇒ “Create Physical Camera From View”

♫ Ta-daaa!! ♪ No MaxScript or even Align Tool required.

Message 19 of 19

teamSP26J
Advocate
Advocate
This deserves a big thank you, it worked for my case.
0 Likes

Type a product name