Hello, I have a problem with the application of cartoon. I would apply it only to some meshes and not to others. I found this possible solution. But, in a concrete example, I can’t get it working. In this example I’ve two meshes and I would see only one cartoon-shaded.
import direct.directbase.DirectStart
from panda3d.core import NodePath, PandaNode, LightRampAttrib, RenderState
from direct.filter.CommonFilters import CommonFilters
tmpNode = NodePath( PandaNode( 'temp node' ) )
tmpNode.setAttrib( LightRampAttrib.makeSingleThreshold( .5, .4 ) )
tmpNode.setShaderAuto()
base.cam.node().setInitialState( tmpNode.getState() )
CommonFilters( base.win, base.cam ).setCartoonInk( separation = 1 )
t1 = loader.loadModel( 'teapot' )
t1.reparentTo( render )
t1.setPos( -4, 0, 0 )
t2 = loader.loadModel( 'teapot' )
t2.reparentTo( render )
t2.setPos( 4, 0, 0 )
#base.cam.node().setTagStateKey( 'Toon Shading' )
#base.cam.node().setTagState( 'True', RenderState.make( toonShadingAttrib ) )
#t2.setTag( 'Toon Shading', 'False' )
base.disableMouse()
base.camera.setPosHpr( ( 0, -22, 7 ), ( 0, -15, 0 ) )
run()
If I want to apply the commented part (that refers to multipass) I don’t know how to get the toonShadingAttrib from the shader provided by Panda.
How can I get only some meshes cartoon-shaded? Is this the right way? Very thanks!