WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-29-2008, 08:46 AM
Andy Andy is offline
Member
 
Join Date: Mar 2008
Location: Germany
Posts: 36
stereo-projection

Hello, I have question regarding stereo-projection.
I would like to produce the image for the right and left eye separately on one client, with the aid of an nvidia-quadro-card. Furthermore I would like to use a curved-screen so I need a distortion-correction and edge-blending for a multi-channel projection.
Is there a chance to do this with Viziard directly?

If not, I will have to use an aditional Software-tool from another vendor, which archives this based on OpenGL- and DirectX-commands directly on the render-engine. This tool seems to have a very high-performance but there is a problem. The tool takes the openGL-output of a window and warps this into the configured projection.
If I want to transform the image for the right and left eye on one Client I have to calculate the images each within separate windows. If I use the command “viz.STEREO” I get one big image with the information for the left and right eye. Is there a possibility to get two separate images in stead of one?

Also I’m open to other solutions regarding this problem.
Reply With Quote
  #2  
Old 04-29-2008, 07:54 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I've attached a sample script that renders the scene in stereo to a texture and displays it onto a tessellated quad. You can implement the _distortTexCoord function to return distorted texture coordinates, right now it simply returns undistorted coordinates.
Code:
import viz
viz.go(viz.STEREO)

#Initialize environment
viz.clearcolor(viz.GRAY)
viz.add('gallery.ive')

#Hide scene so it is not rendered to frame buffer
viz.MainScene.visible(0,viz.WORLD)

#Distortion grid constants
GRID_WIDTH = 100
GRID_HEIGHT = 100
GRID_STEP = 5

def CreateLensDistortion(eye):
	
	#Create render texture
	tex = viz.addRenderTexture()

	#Determine size of window
	width,height = viz.window.getSize()
	width /= 2

	#Create node to render scene to a texture
	lens = viz.addRenderNode(size=[width,height])
	lens.attachTexture(tex)
	lens.disable(eye)
	
	#Create node to displayed rendered texture to screen
	overlay = viz.addRenderNode()
	overlay.setOrder(viz.POST_RENDER)
	overlay.setHUD(0,GRID_WIDTH,0,GRID_HEIGHT)
	overlay.disable(eye)
	overlay.disable(viz.LIGHTING)

	def _distortTexCoord(x,y):
		#TODO: Distort texture coordinates given (x,y) vertex coordinates
		return x / float(GRID_WIDTH) , y / float(GRID_HEIGHT)
	
	#Create quad with distorted texture coordinates to display render texture
	viz.startlayer(viz.QUADS)
	for i in range(0,GRID_WIDTH,GRID_STEP):
		for j in range(0,GRID_HEIGHT,GRID_STEP):
	
			viz.texcoord(_distortTexCoord(i,j))
			viz.vertex(i,j,0)
			
			viz.texcoord(_distortTexCoord(i+GRID_STEP,j))
			viz.vertex(i+GRID_STEP,j,0)
			
			viz.texcoord(_distortTexCoord(i+GRID_STEP,j+GRID_STEP))
			viz.vertex(i+GRID_STEP,j+GRID_STEP,0)
			
			viz.texcoord(_distortTexCoord(i,j+GRID_STEP))
			viz.vertex(i,j+GRID_STEP,0)
			
	quad = viz.endlayer(parent=overlay)
	quad.texture(tex)

#Create lens distortion for left/right eyes
CreateLensDistortion(viz.RENDER_LEFT)
CreateLensDistortion(viz.RENDER_RIGHT)
Reply With Quote
  #3  
Old 05-02-2008, 03:23 AM
Andy Andy is offline
Member
 
Join Date: Mar 2008
Location: Germany
Posts: 36
Thank you farshizoo for your reply. It seems to work very well but I had a Problem. Can you tell my why I get a complete white Screen if I use “viz.addRenderNode(size=[width,height])”? By using (size=1024,1024) it works also by viz.addRenderNode(scene = viz.MainScene). Is it ok if I use (scene = viz.MainScene)?

For my fist test I use static data’s for the texture coordinates. Have anybody a code for realtime-moving texture coordinates based on an x*x-Grid?
Reply With Quote
  #4  
Old 05-02-2008, 04:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
By default the render node is added to the main scene, so specifying that in your code is redundant. Your graphics card might not support render textures of size [1024,1024]. Try adding the following line after you create the render node to see if it helps:
Code:
lens.setBuffer(viz.RENDER_FRAME_BUFFER)
This will use the standard frame buffer to copy to the render texture, instead of FBOs. Also, make sure your graphics card driver is up to date.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
8800 ultra stereo driver Dave Vizard 21 10-25-2009 10:25 AM
anaglyphic stereo, backprojection & screendistance malte Vizard 4 02-23-2008 06:48 AM
stereo projection issue asimbh Vizard 3 10-05-2007 10:22 AM
quad buffered stereo? halley Vizard 2 10-19-2005 12:28 PM
SeeReal stereo with separate scenes Jerry Vizard 2 10-18-2005 12:02 PM


All times are GMT -7. The time now is 04:03 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC