View Single Post
  #5  
Old 05-18-2018, 05:38 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
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