PDA

View Full Version : How to create illuminated objects in an otherwise dark room


performlabrit
05-09-2014, 08:37 AM
Here's how to simulate flashlight exploration of a dark room. I struggled with this for the reason that it requires use of the not-yet-documented function "vizfx.setAmbientColor(viz.BLACK)"

Many thanks to the Vizard support team for helping me figure this one out.

It's pretty straightforward, assuming you've followed their many guides to correctly create and export the *.osgb file.

First, replace the headlamp with a vizfx spotlight. Then, set the ambient color of your object to black.


headLamp = viz.MainView.getHeadLight()
headLamp.disable()
mylight = vizfx.addSpotLight()
mylight.position(0,1,0)
mylight.spread(50)
mylight.intensity(2)
mylight.spotexponent(20)

viz.link(viz.MainView, self.mylight)

# Now, create an object and set its ambient color to black using vizfx
object = vizfx.addChild('myObject.OSGB')
vizfx.setAmbientColor(viz.BLACK)