View Single Post
  #2  
Old 03-15-2012, 01:07 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It's possible that the original emissive color of the object is white, so changing it to black is causing the blackout you are seeing.

There is an option in the max exporter to set self-illumination on baked materials. I believe older versions of the exporter would implement this option by setting the emissive color to the same as the diffuse color. So this could be why you see this happening with baked textured objects.

Newer versions of the exporter implement this option by simply disabling lighting on the object. In this case, changing the emissive color will have no effect.

You might need to use a different technique for highlighting objects. Here is one option. You can apply some grayscale texture to the object and use additive blending, so it effectively brightens the entire object. To unhighlight the object, you simply remove the texture. Here is some sample code:
Code:
import viz
import vizact
viz.go()

model = viz.add('plant.osgb',pos=(0,0,5))

highlight = viz.add('highlight.bmp')

def Highlight(mode):
	if mode:
		model.texture(highlight,unit=2)
		tc = viz.TextureCombine()
		tc.combine_rgb = viz.GL_ADD
		model.texCombine(tc,unit=2)
	else:
		model.texture(None,unit=2)

vizact.onkeydown(' ',Highlight,vizact.choice([True,False]))
This technique should work regardless of the lighting mode of the object. Just make sure the texture unit you are using for the highlight texture is not being used by the object.

I've attached a sample highlight image as well.
Attached Images
File Type: bmp highlight.bmp (2.1 KB, 1173 views)
Reply With Quote