I’ve been following along with Ben Cloward’s HLSL Shader Creation DVD. I’ve come to the point where it goes over the diffuse lighting model. When I was done, my object went fully transparent. I figured I did something wrong, so I checked my work against Ben’s example, but even his shader disappeared! I think this is a max issue, as FX Composer renders the shaders just fine. Anyone else run into this?
If brightnessClamped < 1, then you are multiplying your alpha by that value. That means that your alpha is less than 1, which may be interpreted by Max as transparent. Or if your light1Color is greater than 1, you might end up with alpha greater than 1. Which might also get interpreted badly. It depends on what the default blend mode is in max. Since you haven’t set it explicitly in your shader, Max might default to one, zero / alpha test, which will end up transparent.
In more recent versions of 3ds Max, you have to explicitly tell it to turn alpha blending off if you don’t want it. So in the technique area of the shader you need this line:
AlphaBlendEnable = false;
When I made the DVD, the version of 3ds Max I was using didn’t require that, but in the more recent versions, it does.