#1
|
|||
|
|||
Wide-angle view
Is there a smooth way in Vizard to generate a wide view FOV (say, greater than 180 degrees?)
I'm trying to "unwrap" a spherical panoramic view into a quad, but I can't get it right: if I set FOV greater than 90, it messes everything up. I've tried to get around this by compositing four 90-degree views, but there is significant distortion at the boundaries. What I'd like is a wide, short view (say 4:1, across the top of the window), rendering the a 360 panorama of same scene as the normal main view. |
#2
|
|||
|
|||
Have you gotten any further with this? I'll check with our dev team to see if they have some suggestions.
|
#3
|
|||
|
|||
Haven't gotten it to work yet: trying to make a bunch of very narrow views stuck close together, but this isn't that great a solution, because I want to be able to get coordinates.
|
#4
|
|||
|
|||
You need to render multiple views to a texture and then render the textures to the screen using either an undistortion mesh or shader. There should be examples on the forum for rendering views to a texture.
|
#5
|
|||
|
|||
I hacked my way around and came up with this: draws 40 windows across the top of the window. I could render to texture, and make one window, but would that be a lot better?
Code:
import viz import math class PanoWindowGroup: def __init__(self, SubWins=40, windowHeight=0.3, vertFOV=90): self.numSubWins = SubWins self.winHeight = windowHeight self.winFOV = 360.0/self.numSubWins self.vFOV=vertFOV self.sizeRat = 1.0/self.numSubWins self.size = (self.sizeRat, self.winHeight) self.subWinArr = [] #experimentally derived sub-window FOV ratio: # self.subWinFOVrat = 4.3015/(pow(self.numSubWins,1.113)) for i in range(self.numSubWins): scrPos = ((i*self.sizeRat),1.0) direction = i*self.winFOV-60.0 print "Direction= ", direction subWin = PanoSubWindow(scrPos, self.size, direction, self.winFOV, self.vFOV, self.subWinFOVrat ) self.subWinArr.append(subWin) class PanoSubWindow: def __init__(self, scrPos, sizer, direction, winFOV, vFOV, sWFR, viewPos=[0,0,0]): print "Inputs: ", "scrPos= ", scrPos, " sizer= ", sizer, "direction= ",direction, "winFOV= ", winFOV, "vFOV= ", vFOV self.vFOV = vFOV self.size = sizer self.subwindow = viz.addWindow(pos=scrPos, size=sizer) self.subwindow.visible(0, viz.SCREEN) self.subWinFOVrat = sWFR self.subview = viz.addView() self.subview.setPosition(viewPos) self.subview.setEuler([direction,0,0]) self.subwindow.setView(self.subview) # self.subwindow.fov(self.vFOV, self.subWinFOVrat) self.subwindow.fov(self.vFOV, 0.075) |
#6
|
|||
|
|||
Take 3: how do I render multiple views to one texture?
There's only one example on the forums: http://forum.worldviz.com/showthread.php?t=2003, but that's only for one view. |
#7
|
|||
|
|||
For each view, you would create a separate render node and render texture. You would then apply all the render textures from each view to a separate texture unit of a quad. Finally, you would apply a fragment shader on the quad that performs the undistortion using the different textures. I can provide some sample code that sets this up if you like, but you would still need to come up with your own shader code that performs the undistortion.
|
#8
|
|||
|
|||
A sample to get started would be great: the shader stuff should be doable.
|
#9
|
|||
|
|||
Here is a sample script. The shader simply averages the image from each pass, you will need to replace that with your own shader code.
Code:
import viz viz.go() FRAG = """ uniform sampler2D Pass1; uniform sampler2D Pass2; uniform sampler2D Pass3; uniform sampler2D Pass4; void main() { vec4 p1 = texture2D(Pass1, gl_TexCoord[0].xy); vec4 p2 = texture2D(Pass2, gl_TexCoord[0].xy); vec4 p3 = texture2D(Pass3, gl_TexCoord[0].xy); vec4 p4 = texture2D(Pass4, gl_TexCoord[0].xy); //TODO: Combine texture from each pass gl_FragColor = (p1+p2+p3+p4) * 0.25; } """ def CreateRenderPasses(): renderPass = [] uniforms = [] #Create post render pass that combines all passes postRenderPass = viz.addRenderNode() postRenderPass.setHUD(-1,1,-1,1,renderQuad=True) postRenderPass.setOrder(viz.POST_RENDER,-1) #Create each pass for x in range(4): #Create render texture renderTexture = viz.addRenderTexture() #Apply to post render pass postRenderPass.texture(renderTexture,unit=x) #Create uniform for texture unit uniforms.append(viz.addUniformInt('Pass'+str(x+1),x)) #Create render node to render texture renderNode = viz.addRenderNode() renderNode.attachTexture(renderTexture) renderPass.append(renderNode) #Apply shader shader = viz.addShader(frag=FRAG,uniforms=uniforms) postRenderPass.apply(shader) #Set rotation offset of each render pass renderPass[0].setEuler(-30,0,0) renderPass[1].setEuler(-10,0,0) renderPass[2].setEuler(10,0,0) renderPass[3].setEuler(30,0,0) viz.add('gallery.ive') CreateRenderPasses() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
View | nlfrnassimi | Vizard | 0 | 03-17-2009 03:01 AM |
View | nlfrnassimi | Vizard | 4 | 03-12-2009 06:25 AM |
problem with stereo mode | shivanangel | Vizard | 3 | 10-17-2006 10:58 AM |
keeping a 3d object in front of the view | tavaksai | Vizard | 1 | 07-07-2004 10:33 AM |
SEOS HMD 120/67 compatability | John | Vizard | 18 | 05-28-2004 12:13 PM |