Panographies-collage workaround

Hi,

Do you know some script or easy workaround for doing a panography with renderings (and not with photographs)??

Something like this (or the attached one) http://www.flickr.com/photos/pedro\_angelini/260405805/

I guess i could do simply by moving/tilting the camera and changing exposures…then stitch in photoshop…

Another way could be starting with one unique render and cutting, rotating…etc

Go to your camera settings and turn you FOV to 360, if I understand you correctly,

Mmmm no, this is not what i am looking for, see the attached image…

Thanks,

You can get an effect like that with scripting. Here’s a quick attempt…


/*
Panography Tool V0.5
Dan Brew 2011
*/
global PTool

try (destroyDialog PTool) catch ()

rollout PTool "Panograph Tool 0.5" width:230 height:360
( --Start Rollout
	local xShots = 5
	local yShots = 4
	local oLap = 50
	local vVar = 50
	local eVar = 20
	local rVar = 2
	local whiteB1 = color 200 200 200
	local whiteB2 = color 255 255 255
	local RAm = 30
	local vpCam
	local vImg = bitmap 200 120 color:black
	local GridBmp = bitmap 200 120 color:black

	on PTool open do
		(
			callbacks.addScript #viewportChange "PTool.testView()" id:#PToolcb
			PTool.testView()
			PTool.panoGrid()
		)

	on PTool close do
		(
			callbacks.removeScripts id:#PToolcb
			PTool = undefined
			gc light:true
		)

	fn testView =
	(
		PTool.vpCam = getActiveCamera()
		if isKindof vpCam VRayPhysicalCamera 
		then PTool.activateRO ()
		else PTool.deactivateRO ()
	)

	fn activateRO =
	(
		PTool.camView.bitmap = gw.getViewportDib()
		PTool.pickVP.visible = false
		PTool.spinX.enabled = PTool.spinY.enabled = PTool.spinO.enabled = PTool.spinV.enabled = PTool.spinE.enabled = PTool.spinR.enabled = PTool.WB1.enabled = PTool.WB2.enabled = PTool.cPano.enabled = PTool.cbAR.enabled = PTool.spinRA.enabled= true
	)

	fn deactivateRO =
	(
		PTool.camView.bitmap = bitmap 200 120 color:black
		PTool.pickVP.visible = true
		PTool.spinX.enabled = PTool.spinY.enabled = PTool.spinO.enabled = PTool.spinV.enabled = PTool.spinE.enabled = PTool.spinR.enabled = PTool.WB1.enabled = PTool.WB2.enabled = PTool.cPano.enabled = PTool.cbAR.enabled = PTool.spinRA.enabled= false
	)

	fn copyCamera oldCam =
	(
		maxOps.cloneNodes oldCam expandHierarchy:false cloneType:#copy newNodes:&newCamA
		newCamA[1]
	)

	fn panoGrid =
	(
		tileImg = bricks name:"PanoGrid Tile" Brick_Type:5 Brick_Color:[0,0,0] Mortar_Color:[220,220,220] Horizontal_Count:xShots Vertical_Count:yShots Color_Variance:0 Fade_Variance:0 Horizontal_Gap:0.4
		PTool.gridView.bitmap = renderMap tileImg size:[200,120] filter:true
	)

	fn setFOV cam f = -- borrowed from Vlado's post 09-09-2010
	(
		local left=0.001
		local right=100
		local middle=(left+right)*0.5
		cam.focal_length=middle
		redrawViews()
		local curFov=getViewFOV()
		for cycle = 1 to 15 do
			(
				if (f>curFov)
					then right=middle
					else left=middle
				middle=(left+right)*0.5
				cam.focal_length=middle
				redrawViews()
				curFov=getViewFOV()
			)
	)-- end fn setFOV

	fn autoRoll xOff yOff =
	(
		xOff * yOff * PTool.RAm
	)

	fn makePano =
	(
		local panoCam = copyCamera PTool.vpCam
		local pcShutter = panoCam.shutter_speed
		local pcVignetting = panoCam.vignetting_amount
		local tm = 1
		panoCam.targeted = false
		panoCam.transform.controller = prs()
		panoCam.exposure = true
		panoCam.vignetting = true
		panoCam.horizontal_offset.controller = bezier_float()
		panoCam.vertical_offset.controller = bezier_float()
		panoCam.vignetting_amount.controller = bezier_float()
		panoCam.shutter_speed.controller = bezier_float()
		panoCam.whiteBalance.controller = bezier_color()
		panoCam.rotation.controller = euler_xyz()

		animate on
		(
			addNewKey panoCam.horizontal_offset.controller 0
			addNewKey panoCam.vertical_offset.controller 0
			addNewKey panoCam.vignetting_amount.controller 0
			addNewKey panoCam.shutter_speed.controller 0
			addNewKey panoCam.whiteBalance.controller 0
			addNewKey panoCam.rotation.controller 0
		)

		local vpFOV = getViewFOV()
		viewport.setCamera panoCam 
		local pcFOV = (vpFOV/PTool.xShots) + ((PTool.oLap/50) * (vpFOV/PTool.xShots))
		setFOV panoCam pcFOV
		Select panoCam

		for yShot = 1 to PTool.yShots do
		(
			local yOffset = (yShot * 0.5) - ((yShots * 0.25) +0.25)
			for xShot = 1 to PTool.xShots do
			(
				animate on
				(
					at time tm
					(
						local aRoll
						local xOffset = (xShot * 0.5) - ((xShots * 0.25) +0.25)
						panoCam.horizontal_offset = xOffset
						panoCam.vertical_offset = yOffset
						panoCam.vignetting_amount = random (pcVignetting - (pcVignetting * (PTool.vVar*0.01))) (pcVignetting + (pcVignetting * (PTool.vVar*0.01)))
						panoCam.shutter_speed = random (pcShutter - (pcShutter * (PTool.eVar*0.01))) (pcShutter + (pcShutter * (PTool.eVar*0.01)))
						panoCam.whiteBalance = random PTool.whiteB1 PTool.whiteB2
						local rRoll = random (0- PTool.rVar) PTool.rVar
						if PTool.cbAR.checked == true then aRoll = (xOffset * yOffset * PTool.RAm) else aRoll = 0
						local rRot = eulerangles 0 0 (rRoll + aRoll)
						in coordsys local rotate panoCam rRot
					)
					tm +=1
					at time tm
					(
						local invrRot = eulerangles 0 0 (0 - (rRoll + aRoll))
						in coordsys local rotate panoCam invrRot
					)
				)--end animate
			)--end xShot loop
		)--end yShot loop
	)--end fn makePano

	groupBox Dimensions "Dimensions:" pos:[5,3] width:220 height:190
		imgTag camView  pos:[15,20] style:#bmp_stretch bitmap:vImg
		imgTag gridView  pos:[15,20] style:#bmp_stretch bitmap:gridBmp
		edittext pickVP text:"Select Camera Viewport!" pos:[40,70] readOnly:true width:130
		spinner spinX "Columns:" pos:[60,150] width:60 height:16 range:[0,20,xShots] type:#integer
		spinner spinY "Rows:" pos:[155,150] width:60 height:16 range:[0,20,yShots] type:#integer
		spinner spinO "Overlap %:" pos:[151,172] width:63 height:16 range:[0,100,oLap] type:#integer
	groupBox Variance "Variance:" pos:[5,195] width:220 height:135
		spinner spinV "Vignetting %:" pos:[55,210] width:60 height:16 range:[0,100,vVar] type:#integer
		spinner spinE "Shutter %:" pos:[155,210] width:60 height:16 range:[0,100,eVar] type:#integer
		spinner spinR "Camera Roll + or - deg:" pos:[135,232] width:80 height:16 range:[0,90,rVar] type:#float
		checkbox cbAR "Auto Roll Camera" pos:[15,254]
		spinner spinRA "deg:" pos:[165,254] width:50 height:16 range:[0,45,RAm] type:#float
		groupBox WB "White Balance:" pos:[10,275] width:210 height:50
			colorpicker WB1 "From:" pos:[25,295] color:whiteB1 alpha:false fieldWidth:60 height:20 modal:false
			colorpicker WB2 "To:" pos:[125,295] color:whiteB2 alpha:false fieldWidth:60 height:20 modal:false
	button cPano "Create Panograph Camera" pos:[5,335] width:220

	on spinX changed xval do
	(
		xShots = xval
		panoGrid()
	)
	on spinY changed yval do 
	(
		yShots = yval
		panoGrid()
	)
	on spinO changed oval do oLap = oval
	on spinV changed vval do vVar = vval
	on spinE changed eval do eVar = eval
	on spinR changed rval do rVar = rval
	on WB1 changed newWB1 do whiteB1 = newWB1
	on WB2 changed newWB2 do whiteB2 = newWB2
	on spinRA changed raVal do RAm = raVal
	on cPano pressed do makePano()
)--end rollout

createDialog Ptool

This is very cool!! could you explain a bit how to use it? I tried without luck, when i run the script the Camera’s target is Detached from the camera (marked with green circle) and the view is changed.

Thanks!!

Sorry I didn’t have much time yesterday when I replied but I’ll try to go through a few points now. The script I posted isn’t a finished tool, it’s little more than a proof of concept really. However you should be able to get it to work with a bit of help.

I have updated the script in my earlier post because it didn’t work with targeted cameras (as you found) and it now makes a copy of the camera you select so you don’t lose your original camera settings. It works by animating the horizontal and vertical offset and roll of the camera over the next 20 frames. It also randomly varies the white balance, shutter speed and vignetting slightly.

So the steps the use the script are:
1. Pick a VRay camera.
2. Run the script.
3. Change the camera viewport to the new camera.
4. Render frames 1 to 20 from the new camera. (400 x 300 px should be ok.)
5. Open the rendered frames in photoshop (or similar).
6. In photoshop create a new image (Something like 2000 x 1500 px) and copy and paste the frames as new layers into the new image. The frames are rotated slightly so you need to rotate them back so they line up correctly. The amount you need to rotate them is the camera Y rotation for that frame. If you select the camera and move the time slider you can see this in the transform type-in box in Max.

Don’t be put off by what appears in viewport, there is a bug in VRay that means what you see in the viewport isn’t what is rendered when you change the H & V offsets. See here:
http://www.chaosgroup.com/forums/vbulletin/showthread.php?53288-VrayPhyiscalCamera-Vertical-Offset&highlight=horizontal+offset

Well what can i say, thank you very very much for your help!! is working really cool now…this is a quick test without using all the frames. What i like of using this technique is the ability to focus in the subject you consider important (rather than giving a “generic impersonal rectangle frame”), judiciously, like this shot.

Will play with this tool a lot, thanks again!!

EDITED: Second one using Photomerge from photoshop, he did not like frames from 16-20 :slight_smile: (were ignored from the comp.)


Glad you got it working and there’s no need to thank me I didn’t write it just for you :).

It really needs a GUI, if I have time will add one next week. In the mean time, there are some variables in the script that you could try changing. At the moment it makes 20 images in a 5 x 4 array. This is controlled be the lines:

local [FONT=monospace]xShots = 5
local yShots = 4[/FONT]

So if you want more images you just need to change these.
You could also change the focal length (and therefore the field of view) with
[FONT=monospace]UserCam.focal_length = 80[/FONT]
Increasing this will make the rendered frames zoom in more.

You probably worked all that out for yourself anyway…

Btw, thanks for the tip using photomerge, it took me about 20 minutes to put my image together.

A GUI woul be really nice!! thanks for pointing the variables, will play with these… :roll_eyes:

Yep, the Photomerge is a great “discovery”…

Will look forward into the thread,

Regards,

I’ve added a GUI if anyone is still interested in this.


I haven’t tested it thoroughly so if you have any problems let me know and I’ll try to fix them.

Thanks Daniel, it’s looking really nice!!

very cool indeed… I didnt see the gui download or script… I would love to play with that as well.

Photomerge!!! Yes… I cant believe I was scanning hand drawn site plans and then PIECING them together without Photomerge…

Thanks, I’m a bit snowed under at work at the moment so I didn’t have time to post any instructions for using the new version. It should be quite straightforward though. The main changes are:
1. The preview - but only meant to be a rough guide to the what the final output will be.
2. Added Auto Roll Camera - rolls the camera more in the corner images.

Anyway give it a try and if you find any bugs let me know.

I am having force closes every time i try to use the script :(, after creating the frames no matter what i do (click “X” icon to exit script…etc) Max is freezed.

Could you please post the previous 0.1 and/or 0.2 versions? will test these for a real arch. school project

Thanks!!

Here’s the 0.2 version.

What version of Max are you using? I’ve tested it here on 2010, 2011 and 2012 and can’t reproduce the problem.
PanographyTool.zip (777 Bytes)

I’m using 2011 Design 64bits. After “create panog…” anything i do max frozen.

0.2 working fine here :wink:

Thank you very much again!!

peprgb, I’ve changed GUI version slightly. Would you mind trying it again please.

No luck, i did a quick video showing the problem, no matter what i do (close script nor change view…etc) after the “create pano…” button.

Ok, definitely working now…
PanographyTool GUI.zip (2.29 KB)

cool script Dan will definitely use this later down the track