|
#1
|
|||
|
|||
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. |
#3
|
|||
|
|||
Thanks Jeff. The Effects might solve what I am looking for.
|
#4
|
|||
|
|||
Quote:
Because all the examples work specifically with pixel in question and not include any effect using neighboring pixel value which would be needed for implementing functions like blur. |
#5
|
|||
|
|||
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? |
#6
|
|||
|
|||
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) |
#7
|
|||
|
|||
Thanks Jeff.
It worked with on-the-fly object. With models creating using external application like :http://www.openscenegraph.org/index....planet-builder . Do I need to run any other command to enable effects on such models? |
#8
|
|||
|
|||
Additional Info :
If I create a separate copy of root node and apply effects only on it then the effects work. However if I apply the effects on the entire directory structure where root node load the child nodes itself then the effects do not work. I tried using different argument values for flags and op in generateEffects but still no success |
#9
|
|||
|
|||
Can you provide a sample file and code that reproduces the issue?
|
#10
|
|||
|
|||
Jeff,
I am using the following code to test the effect on my model. A subset of model with the code file is in attachment. Execute the shader_test.py to see that no effect is applied on the model. However if I remove "Earth/main_root_L0_X0_Y0" folder then the effect start working. Code:
import viz,vizfx viz.go() model=vizfx.addChild('./Earth/main.osgb') viz.MainView.setPosition(2270347.75*2, 3137376.25*2, 7425973.0*2) viz.MainView.lookAt([0,0,0]) composer=vizfx.getComposer() model.generateEffects(composer=composer) code=""" Effect { Float rmin{value 0} Float rmax{value 255} Float gmin{value 0} Float gmax{value 255} Float bmin{value 0} Float bmax{value 255} Shader{ BEGIN FinalColor float r=(vizfx_VertexColor.r-rmin)*255/(rmax-rmin); float g=(vizfx_VertexColor.g-gmin)*255/(gmax-gmin); float b=(vizfx_VertexColor.b-bmin)*255/(bmax-bmin); gl_FragColor.rgb=vec3(r,g,b); END } } """ effect=viz.addEffect(code) model.apply(effect) model.setUniformFloat('bmin',50) |
Tags |
effects, object, post process, shader |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Crosshatch Post-Processing Effect give away | Vaquero | Vizard | 0 | 08-03-2016 10: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 01:20 PM |