This project has moved and is read-only. For the latest updates, please go here.


Aug 31, 2014 at 6:23 PM
Hey guys. I really appreciate the opportunity to use DirectXTK. I am working with the IEffectLights interface and I noticed that SetSpecularPower is not in the interface but it is found on both BasicEffect and DGSLEffect. I am wondering if this is for a reason -- are the values expected different across these two effects?

Aug 31, 2014 at 7:34 PM
Edited Aug 31, 2014 at 7:44 PM
IEffectLights is intended to set up the light's parameters. SpecularPower is actually a property of the material, not the lights themselves. So you can set the light specular color via SetLightSpecularColor, but you'd control the specular power as part of setting up the effect's material settings.

What you want here seems to be an IEffectMaterial interface which would implement the following methods
void SetDiffuseColor(FXMVECTOR value);
void SetEmissiveColor(FXMVECTOR value);
void SetSpecularColor(FXMVECTOR value);
void SetSpecularPower(float value);
void DisableSpecular();
void SetAlpha(float value);
It would really only make sense to use the interface for BasicEffect, SkinnedEffect, and DGSLEffect.

It's not in the original design due the assumption you would be setting material properties at the point you created the effect and you know the effect type, but in practice you may have to deal with some scenarios where you have either a BasicEffect or a SkinnedEffect (or DGSLEffect if you are mixing DGSLEffectFactory and EffectFactory in the same app) such as fixing up a loaded model.

This is a little divergent from the original intent of the interfaces. You usually define the material at effect creation time, and then you have to provide the view matrices, the lights setup, fog settings, and skinning matrices when you go to render each object. That's why we have these four interfaces in the first place to avoid the need to write special-path rendering code for every effect type.

If that's what you want, please up-vote the work item.
Aug 31, 2014 at 7:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.