WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-28-2013, 04:55 AM
goro goro is offline
Member
 
Join Date: May 2012
Posts: 33
To elaborate my question, I am explaining this with code:

Code:
import viz
viz.go()

viz.add('piazza.osgb')

# Add render texture using depth pixel format
img = viz.addRenderTexture()

# Use render node to render the scene to the depth texture
rn1 = viz.addRenderNode()
rn1.setRenderTexture(img)
rn1.setEuler(180,0,0)
rn2 = viz.addRenderNode()
rn2.setRenderTexture(img)
rn2.setEuler(180,0,0)

# Display depth texture on the screen
quad1 = viz.addTexQuad()
quad1.setScale(3,2)
quad1.setPosition(-2,2,6)

quad2 = viz.addTexQuad()
quad2.setScale(3,2)
quad2.setPosition(2,2,6)

# Use shader to display depth texture in linear range
fragSepia = """
uniform sampler2D InputTex;
		void main()
		{
			vec4 color = texture2D(InputTex,gl_TexCoord[0].st);
			gl_FragColor.r = dot(color.rgb, vec3(.393, .769, .189));
			gl_FragColor.g = dot(color.rgb, vec3(.349, .686, .168));
			gl_FragColor.b = dot(color.rgb, vec3(.272, .534, .131));
			gl_FragColor.a = color.a;
		}
"""

fragGray = """
uniform sampler2D InputTex;
		void main()
		{
			vec4 color = texture2D(InputTex,gl_TexCoord[0].st);
			float lum = 0.222*color.r + 0.707*color.g + 0.071*color.b;
			gl_FragColor = vec4(lum,lum,lum,color.a);
		}

"""

shader = viz.addShader(frag=fragSepia)
quad1.apply(viz.addUniformInt('InputTex',0))
quad1.apply(shader)
quad1.texture(img)

shader2 = viz.addShader(frag=fragGray)
quad2.apply(viz.addUniformInt('InputTex',0))
quad2.apply(shader2)
quad2.texture(img)

# Need to specify clip plane here and in shader
viz.clip(0.1,200)
This code gives me output as follow:



Left Side is Sepia Effect & Right Side is Gray Effect. I want to produce third effect i.e. 70% Sepia & 30% Gray. I am willing to use Multi-Passing & everything should be behind the screen & main window should have the final output.
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 11:21 AM.


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