开发者

Directx9 Specular Mapping

How would I implement loading a texture to be used as a specular ma开发者_JS百科p for a piece of geometry and rendering it in Directx9 using C++?

Are there any tutorials or basic examples I can refer to?


Use D3DXCreateTextureFromFile to load the file from disk. You then need to set up a shader that multiplies the specular value by the value stored in the texture. This gives you the specular colour.

So you're final pixel comes from

Final = ambient + (N.L * texture colour) + (N.H * texture specular)

You can do this easily in a shader.

Its also worth noting that it can be very useful to store the per texel specular in the alpha channel of the texture. This way you only need one texture around, though it does break per-pixel transparency.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜