Welcome, Guest! Log In | Create Account

Making Cubic Panoramas

From pipmak

Revision as of 10:23, 14 October 2009 by Cwalther (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

As explained in the Pipmak Reference, cubic panoramas are made by rendering six square images with a field of view of slightly over 90° (one pixel larger than 90°, to be exact, to enable seamless bilinear interpolation across the cube edges).

This page details how to create such images in different rendering software. If the application you use is not covered, please contribute!

Contents

POV-Ray

This macro defines a camera that can be used to automatically render all 6 faces in the correct order and orientation:

/* Takes a cubic panorama at <Location> for use in Pipmak or QuickTime VR.
 * Render 6 square images with <FaceNumber> from 0 to 5. The one-pixel overlap
 * that's neccessary for seamless bilinear interpolation is automatically taken
 * into account.
 */
#macro CubicCam(Location, FaceNumber)
	camera {
		location 0
		right 2*image_width/(image_width-1)*x
		up 2*image_height/(image_height-1)*y
		direction z
		#switch (FaceNumber)
			#range(0, 3) //front - right - back - left
				rotate FaceNumber*90*y
			#break
			#case(4) //ceiling
				rotate -90*x
			#break
			#case(5) //floor
				rotate 90*x
			#break
		#end
		translate Location
	}
#end

You might for example use it in the following way:

#declare Nodes = array[3] {
	<-15, 17, 0>,
	<-42, 17, -48>,
	<-10, 20, -108>
}

CubicCam(Nodes[floor((frame_number-1)/6)], mod(frame_number-1, 6))

then render an animation with 18 frames to get all 3 nodes in one go.

Blender

For Blender there is a python script available from http://www.alienhelpdesk.com/python_scripts/old_scripts that automatically adjusts the camera when rendering images for cubic and cylindrical panoramas.

Vue

It is possible render suitable image for our purpose by editing the camera settings:

  • Select the camera from the objects list
  • assure that the 'Numerics' tabs of the object properties is selected
  • click on 'Orientation button'

now:

  • empty 'Yaw' field

Image1: Pitch=90; Roll=0
Image2: Pitch=90; Roll=270
Image3: Pitch=90; Roll=180
Image4: Pitch=90; Roll=90
Image5: Pitch=180;Roll=0
Image6: Pitch=0; Roll=0

Bryce

Select the camera from the "Select Options" drop-down menu at the bottom of the screen, then click on the Attributes icon.

Enter the following Settings for each image, leaving the other settings untouched before switching to camera view:

Image1: X=0; Y=0
Image2: X=0; Y=90
Image3: X=0; Y=180
Image4: X=0; Y=270
Image5: X=-90; Y=0
Image6: X=90; Y=0

Set the F.O.V. to 112.75 degrees.

Also, you will need to uncheck the "Link Sun to View" box in the Sky Lab, or the lighting will vary from face to face.

A good size for the faces would be 1024 x 1024 pixels.

The images can be rendered as one six-frame movie, or the six views stored in the "Saved Views" and rendered and exported individually.

Terragen

First, find the location that you would like. Make sure that the pitch is set to 0. Next, go to the Rendering Control window. From there, render your first image to a file. For each successive picture, just adjust change the "Head" value of the Camera Orientation by 90 degrees and render another picture. For the top and bottom pictures, adjust the pitch to -90 (bottom) and 90 (top).


3D Studio Max

This macro make a complete folder node (folder+node.lua+pictures) directly usable in Pipmak.

There is a dialog box where you can set all the parameters of the cubic generation.

You have only to place a "target camera object" at place where you want to create panorama.

It does not matter where you points the target of the camera because macro adjust them.

Also height of the camera from the floor is controlled by the macro (there is a parameter in the dialog box)


image:export3dsmax.jpg


After cubic generation you have to close "by hands" the six windows with the rendered image, because I'm not discover how close them by the macro.

-----------------------------------------------------------------------------
-- Pipmak cubic panorama export for 3DS MAX
-- 
-- Author: Andrea Viarengo
-----------------------------------------------------------------------------

NodePath = ""
MyCamera = "Cinepresa01"
h = 0
sH= "69"
sDimx="256"
sDimy="256"
Dimw=256
Dimh=256
mlistCamera=#()
t=$
fileName=""

listCamera=cameras as array
for i=1 to listCamera.count/2 do
   (
   mListCamera[i]="camera"+(i as string) 
   )

if listCamera.count==0 then enableExport=false else enableExport=true

rollout PipmakExport "Pipmak Export" 
(
    group "Camera Setting"
	(
	dropdownlist cameraDDL "Camera" items:mListCamera
        edittext MyHeightID "View Height" width:120 type:#integer text:sH
	)

    group "Render Setting"
	(
	edittext MyDimxID "Bitmap width " width:120 type:#integer text:sDimx
	edittext MyDimyID "Bitmap height" width:120 type:#integer text:sDimy
	)
	
    group "Project Setting"
	(
	edittext MyPathID "Path" width:150 type:#string text:"C:\\"
	--edittext MyNodeID "Node" width:100 type:#string text:"1"
	spinner MyNodeID "Node" type:#integer range:[1,1000,1] align:#left 
	checkbox incID "Increment node after export" checked:true
	)
	
    group "Export"
        (
	button run "Create cubic node" width:120 enabled:enableExport
	)
			
    fn export =
        (
        makeDir NodePath

        fileName=NodePath+"\\node.lua"
        out_file = createfile fileName
        format "cubic {\"front.jpg\",\"right.jpg\",\"back.jpg\",\"left.jpg\",\"top.jpg\",\"bottom.jpg\"}" to:out_file
        close out_file

        t.fov=90
        t.pos.z=h
	
        tx=t.pos.x
	ty=t.pos.y
	tz=t.pos.z

	ttx=t.target.pos.x
	tty=t.target.pos.y
	ttz=t.target.pos.z

        target_back   = [tx-50, ty    ,h   ]
        target_front  = [tx+50, ty    ,h   ]
        target_right  = [tx,    ty-50 ,h   ]
        target_left   = [tx,    ty+50 ,h   ]
        target_top    = [tx,    ty    ,h+50]
        target_bottom = [tx,    ty    ,h-50]

        t.target.pos = target_front
	fileName=NodePath+"\\front.jpg"
        render camera:t outputfile:fileName    outputwidth:Dimw outputheight:Dimh
        renderSceneDialog.Close()

        t.target.pos = target_left
	fileName=NodePath+"\\left.jpg"
        render camera:t outputfile:fileName    outputwidth:Dimw outputheight:Dimh
	
        t.target.pos = target_back
	fileName=NodePath+"\\back.jpg"
        render camera:t outputfile:fileName    outputwidth:Dimw outputheight:Dimh
	
        t.target.pos = target_right
        fileName=NodePath+"\\right.jpg"
        render camera:t outputfile:fileName    outputwidth:Dimw outputheight:Dimh
	
        t.target.pos = target_top
	rotate t (angleaxis 90 [0,0,1])
        fileName=NodePath+"\\top.jpg"
        render camera:t outputfile:fileName    outputwidth:Dimw outputheight:Dimh
	
        t.target.pos = target_bottom
	rotate t (angleaxis 180 [0,0,1])
	fileName=NodePath+"\\bottom.jpg"
        render camera:t outputfile:fileName    outputwidth:dimw outputheight:dimh
	
	rotate t (angleaxis -90 [0,0,1])	
	t.target.pos=[ttx,tty,ttz]
	)

    on run pressed do
        (
        MyPath   = MyPathID.text   as string
        MyNode   = MyNodeID.value  as integer
	Dimw     = MyDimxID.text   as integer
	Dimh     = MyDimyID.text   as integer
	h        = MyHeightID.text as integer
	j        = cameraDDL.selection*2-1
	t        = listCamera[j]
	
        NodePath=MyPath+"\\"+(MyNode as string)
        export()
	if incID.checked==true then MyNodeID.value = MyNode+1
        )
)

CreateDialog PipmakExport width:200 height:360