Transparent diffuse but still specular?

Is there a way to set a material to show only specular highlights? I’ve got it showing the highlights alright, but I can’t figure out how to make it transparent to diffuse light. Setting diffa to 0 in the egg file doesn’t seem to do anything at all, even if I call object.setTransparent(TransparencyAttrib.MAlpha) on it. SetAlphaScale works, but it scales the specular highlight as well.

Hmm… It might not be the best way to do it, depending on your desires, but you might get away with making the object entirely black, turning the diffuse component down to zero (so that it renders as flat in diffuse), and then having it render additively, something like so:

from panda3d.core import ColorBlendAttrib, TransparencyAttrib

...

obj.setTransparency(TransparencyAttrib.MAlpha)      obj.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd,
              ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne))

Thaumaturge, thanks, that works great. But does anyone know a way to do this using solely materials, so I don’t have to check every model in-code?

I don’t think there’s a way to do this solely using materials. It’s kind of an unusual thing to do.

I suppose you could set a tag on all the models that you wanted to do this on, and then search for the tag after you loaded the models, and apply the appropriate state to any node that contained that tag. That would at least be automatic in code, and you could control whether you had or did not have the appropriate state solely by changing the model file.

David