WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-26-2010, 01:37 PM
whj whj is offline
Member
 
Join Date: Apr 2008
Posts: 60
<node3d:renderNode>.attachTexture and <node3d>.texture

Hello,

I'm confused by commands attachTexture() and texture(). Anybody could explain the difference between them? Here is sample code:

Code:
for eye in [viz.RENDER_LEFT,viz.RENDER_RIGHT]:
			
	#Render textures for ping-ponging
	tex1 = viz.addRenderTexture()
	tex2 = viz.addRenderTexture()
			
	"""
	Pass 1 renders the normal scene to a texture
	"""
	pass1 = viz.addRenderNode(size=[size,size])
	pass1.attachTexture(tex1)
	pass1.setOrder(viz.PRE_RENDER,-5)
	pass1.disable(eye)
			
	"""
	Pass 2 renders the texture from pass 1 onto a quad.
	The quad has a shader attached which blurs the texture horizontally.
	"""
	pass2 = viz.addRenderNode()
	pass2.setHUD(0,200,0,200,renderQuad=True)
	pass2.setSize(size,size)
	pass2.setBuffer(viz.RENDER_FBO)
	pass2.setOrder(viz.PRE_RENDER,-4)
	pass2.attachTexture(tex2)
	pass2.texture(tex1)
	pass2.apply(horzBlurShader)
	pass2.apply(srcImageUniform)
	pass2.apply(blurScaleUniform)
	pass2.disable(eye)
			
	"""
	Pass 3 renders the texture from pass 2 onto a quad.
	The quad has a shader attached which blurs the texture vertically.
	"""
	pass3 = viz.addRenderNode()
	pass3.setHUD(0,200,0,200,renderQuad=True)
	pass3.setSize(size,size)
	pass3.setBuffer(viz.RENDER_FBO)
	pass3.setOrder(viz.PRE_RENDER,-3)
	pass3.attachTexture(tex1)
	pass3.texture(tex2)
	pass3.apply(vertBlurShader)
	pass3.apply(srcImageUniform)
	pass3.apply(blurScaleUniform)
	pass3.disable(eye)
			
	"""
	Pass 4 renders the final blurred texture to the screen
	"""
	pass4 = viz.addRenderNode()
	pass4.setHUD(0,200,0,200,renderQuad=True)
	pass4.setOrder(viz.POST_RENDER,-1)
	pass4.texture(tex1)
	pass4.disable(eye)
			
	#Save render nodes and blur uniform
	d.passes += [pass1,pass2,pass3,pass4]
Thanks a lot.
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


All times are GMT -7. The time now is 08:24 AM.


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