WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-26-2013, 07:05 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
Barrel Distortion

I'm trying to create a post process effect shader that does a barreldistortion on the created image.

A side effect of the barreldistortion is that less of the screen is filled with the actual image of the environment. To combat this I should give the post process a higher resolution image to work with and use a window resolution part of the post process output. Basically cutting away the empty area's created by the barreldistortion.

My question is, is there a way to do this with vizard?


Alternatively I could probably use a renderNode and renderTexture and apply those to a on screen quat and apply the shader to this texture. But I can't seem to find a method to only render the left or right eye to a renderTexture. So is there a way to do this?
Reply With Quote
  #2  
Old 06-29-2013, 02:12 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Take a look the Distort Effects page in the Vizard help. The first effect shown there is a pincushion/barrel distortion.
Reply With Quote
  #3  
Old 07-03-2013, 06:51 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
I've looked at the vizard lens distortion script but it scales down the effectively used screen area to much. So much even that the stereo effect suffers because of some black areas showing in one eye and not the other.

The lens distortion script does provide a scaleToFit option but this scales the width and height decreasing the quality of the image. and also distorting the ratio and stretching objects in the scene.

I've successfully implemented the two quads method

Code:
renderNode_Right = viz.addRenderNode( size = [640*dis_scale,800*dis_scale])                              
renderNode_Right.setPosition(h/2.0, 0, 0, viz.REL_PARENT)
tex_right = viz.addRenderTexture(format=viz.TEX_RGB, size = [640*dis_scale,800*dis_scale])
renderNode_Right.setRenderTexture(tex_right)
node_right = vizshape.addQuad(parent=viz.SCREEN, size=[0.5,1.0])
node_right.setPosition(0.75, 0.5, 0.0)
node_right.texture(tex_right)
And similar quad for the left eye. To both quads I've added the lens correction shader.


The only problem I've now is that the framerate of my program gets hit to hard
(it renders the MainView with the two quads in view and all object behind them and then renders the scene twice again for the renderNodes).
I wonder if there is a way to optimize this construction by adding the quad's to a different scene (scene 2) and let the MainView only render this scene.
Code:
viz.MainView.setScene(2)
I've tried this but the renderNode's will only render a black image instead of MainScene. Could this be because the only light in the scene is the HeadLight of the MainView? If so is there a way to add a new HeadLight linked to viz.HEAD or set the scene of the existing HeadLight back to scene 0 (original viz.MainScene)?

Also when setting a different scene for viz.MainView does the viz.MainScene variable change?
Reply With Quote
  #4  
Old 07-10-2013, 10:03 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The latest version of Vizard (4.09), supports setting a higher resolution input image for post-process effects. This was added to support the new Oculus Rift HMD. For example, the following code will render to a texture that is 50% larger than the window size:
Code:
vizfx.postprocess.getEffectManager().setRenderScale(1.5)
Regarding your other questions:

You can disable a window from rendering the scene while still allowing render nodes to render the scene by using the following code:
Code:
viz.MainWindow.visible(False, viz.WORLD)
This is essentially what the post-process module does.

viz.MainScene always points to the same scene, regardless of what scene is active on the main view.
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
pincushion distortion whj Vizard 2 04-19-2010 03:46 PM
Strange distortion when creating morphs Josh Vizard 0 04-16-2010 02:02 AM
software distortion for an arena flanny29 Vizard 1 08-18-2008 03:40 PM


All times are GMT -7. The time now is 02:26 PM.


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