No need to use stencil function. We just have to use mask.disable(viz.COLOR_WRITE) this command will not display the object but it'll still write to depth. So the object behind this invisible object will get affected. Don't forget to set mask.drawOrder(-1).
Code:
Code:
import viz
viz.setOption('viz.display.stencil',1)
viz.go()
piazza = viz.addChild('piazza.osgb')
logo1 = viz.addChild('logo.ive')
logo1.setPosition(0.3,1,5)
logo2 = viz.addChild('logo.ive')
logo2.setPosition(-0.3,1,3)
mask = viz.addChild('logo.ive')
mask.setPosition(0,1,4)
mask.disable(viz.COLOR_WRITE)
mask.drawOrder(-1)
Now don't worry about the black mask. if you set the environment scene i.e. piazza draw order lower than mask draw order then piazza will get rendered before mask.
add this line to the previous code
Code:
piazza.drawOrder(-2)
and you'll get the desired output