WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   How to create illuminated objects in an otherwise dark room (https://forum.worldviz.com/showthread.php?t=5034)

performlabrit 05-09-2014 08:37 AM

How to create illuminated objects in an otherwise dark room
 
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.

Quote:

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)



All times are GMT -7. The time now is 06:49 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC