WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 04-05-2013, 02:13 AM
goro goro is offline
Member
 
Join Date: May 2012
Posts: 33
We are sticking to same logic as above. We have wrote a code using the same logic which is discussed above. This program is working fine as no shader is applied. The program is as below:

Code:
import viz
viz.go()

#Adding WebCam
video = viz.add('VideoCamera.dle')
cam = video.addWebcam() 

#Adding & setting quad to Scene 1
quad1 = viz.addTexQuad(viz.WORLD,1)
quad1.setScale(2,1.5)
quad1.setPosition(0,1.8,2)

#linking quad to MainView to get Constant 3D
link = viz.link(viz.MainView,quad1)
link.preTrans([0,0,2])

#Adding piazza environment to Scene2
piazza = viz.addChild('piazza.osgb',viz.WORLD,2)

#Adding & setting quad to Scene 2
quad2 = viz.addTexQuad(viz.WORLD,2)
quad2.setScale(2,1.5)
quad2.setPosition(0,2,6)
quad2.texture(cam)

#Adding Render Texture to Scene2 & setting it as a Texture to quad1
CamScene = viz.addRenderTexture()
quad1.texture(CamScene)

#Adding Render Node in Scene2
rn = viz.addRenderNode(size=(1280,720))
rn.setScene(2)
rn.setFov(60.0,1280/720.0,0.1,1000.0)
rn.attachTexture(CamScene)
rn.setRenderLimit(viz.RENDER_LIMIT_FRAME)

viz.scene(1)
The output is as below:


The center quad is webcam image.

But when we add shader program to the above code

Code:
InvFragCode = """
		uniform sampler2D InputTex;
		void main()
		{
			vec4 color = texture2D(InputTex,gl_TexCoord[0].st);
			gl_FragColor = vec4(1.0-color.r,1.0-color.g,1.0-color.b,1);
		}"""

InvShader = viz.addShader(frag = InvFragCode)

rn.apply(InvShader)
rn.apply(viz.addUniformInt('InputTex',0))
it works well for the rest of the environment but the webcam image gets blackout as below:



We don't know why this is happening?! Please help us to solve this issue..
Thanks!
Reply With Quote
 

Tags
multi pass, multi-pass, multipass, rendering


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
Rendering order? vOliver Vizard 3 09-29-2010 02:07 PM
rendering level shahramy Vizard 1 07-26-2010 12:12 PM
how to control vizard rendering shahramy Vizard 0 07-23-2010 10:50 PM
Any way to increase rendering resolution v-Salik Vizard 3 09-12-2007 04:57 PM
Texture map rendering problem JRichizzle Vizard 4 03-04-2004 07:20 AM


All times are GMT -7. The time now is 07:25 AM.


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