WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-09-2018, 11:26 PM
saket saket is offline
Member
 
Join Date: Mar 2015
Posts: 16
post-processing effect to single object

Hi,

I need to access the currently displayed pixels on screen within a fragment shader.
For which i found the access through vizard's post-processing at http://docs.worldviz.com/vizard/postprocess_basics.htm using vizpp_InputTex. However it only refers to shader which are applied on whole screen.

How can I apply the the shader using postprocess to only specific objects?
Something like this :
effect = RedEffect()
object.apply(effect)

In which case only the object should have redeffect applied to it and rest of objects should have no effect.
Reply With Quote
  #2  
Old 05-14-2018, 10:39 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,367
All postprocess effects are applied to the entire window. You can apply shaders to individual objects using Vizard's effects framework. The custom and example effects pages have some example code.
Reply With Quote
  #3  
Old 05-15-2018, 10:45 PM
saket saket is offline
Member
 
Join Date: Mar 2015
Posts: 16
Thanks Jeff. The Effects might solve what I am looking for.
Reply With Quote
  #4  
Old 05-17-2018, 11:09 PM
saket saket is offline
Member
 
Join Date: Mar 2015
Posts: 16
Hi Jeff,

The custom effect work on pre-existing models like 'logo.osgb'

But effects do not work on on-the fly object. Do i need to set some flag for on-the fly object for enabling effects on them as well?
Reply With Quote
  #5  
Old 05-18-2018, 04:38 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,367
Yes, you will need to use the generateEffects command on that model. Here's an example:

Code:
import viz
import vizfx
import vizcam
import vizshape

viz.setMultiSample(4)
viz.go()

viz.clearcolor(viz.SLATE)
# Disable head light
viz.MainView.getHeadLight().disable()
# Add a directional light pointing down 
light = vizfx.addDirectionalLight(euler=(0,90,0), color=[0.2,0.2,0.2])

shape = vizshape.addPyramid(base=(0.4,0.4),height=0.4)
composer = vizfx.getComposer()
shape.generateEffects(composer=composer)

cam = vizcam.PivotNavigate(distance=3.5)
cam.centerNode(shape)

code = '''
Effect { 
    Type Highlight
    Shader { 
        BEGIN FinalColor 
        gl_FragColor.rgb += vec3(0.7, 0.0, 0.0);
        END 
    } 
} 
'''
effect = viz.addEffect(code)
shape.apply(effect)
Reply With Quote
Reply

Tags
object, post process, shader

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
Crosshatch Post-Processing Effect give away Vaquero Vizard 0 08-03-2016 09:48 PM
anaglyph effect at front view of cave g.vannan Vizard 1 02-03-2015 06:29 AM
retrieve Object names Geoffrey Vizard 11 12-11-2009 05:26 AM
importing a single WRL with many objects. giancamati Vizard 3 12-18-2006 02:13 PM
rotate to object jargon Vizard 1 08-08-2005 12:20 PM


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


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