![]() |
|
|
|
#1
|
|||
|
|||
|
Alright, one more question: Is there a way to size the quad so that is fits the exact dimensions of the window? I've tried, but I'm not sure how the 'size' parameter in viz.addTexQuad method translates into window coordinates.
I have tried inserting the following code into what you have written: # Get window size winsize = viz.MainWindow.getSize(viz.WINDOW_PIXELS) # Display depth texture on the screen quad = viz.addTexQuad(viz.SCREEN, size=1 ,align=viz.TEXT_CENTER_CENTER) quad.setPosition(.5,.5,0) quad.scale(winsize[0],winsize[1]) |
|
#2
|
|||
|
|||
|
If you want to view it fullscreen, then you're better off implementing the shader as a post-process effect:
Code:
import viz
viz.go()
viz.add('piazza.osgb')
NEAR = 0.1
FAR = 200.0
from vizfx.postprocess.effect import BaseShaderEffect
class DepthEffect(BaseShaderEffect):
def _getFragmentCode(self):
return """
uniform sampler2D vizpp_InputDepthTex;
uniform float near;
uniform float far;
void main()
{
float d = texture2D(vizpp_InputDepthTex,gl_TexCoord[0].st).r;
float z = (2 * near) / (far + near - d * (far - near));
gl_FragColor = vec4(z,z,z,1.0);
}
"""
def _createUniforms(self):
self.uniforms.addFloat('near',NEAR)
self.uniforms.addFloat('far',FAR)
viz.clip(NEAR,FAR)
import vizfx.postprocess
effect = DepthEffect()
vizfx.postprocess.addEffect(effect)
|
![]() |
| Tags |
| depth buffer |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| eMagin HMD Quad buffer problem | Shay | Vizard | 1 | 11-30-2012 01:00 PM |
| Issue Getting Quad Buffer Working | nabrahamson | Vizard | 2 | 08-30-2012 10:43 AM |
| Does the vrpn7.dle tracker plug-in clear the udp buffer? | michaelrepucci | Vizard | 2 | 09-19-2008 11:22 AM |
| depth perception for a DTI 3D monitor | timbo | Vizard | 5 | 07-16-2008 01:23 PM |
| accessing screen buffer | hotspur1 | Vizard | 3 | 08-22-2003 04:31 PM |