开发者

Directx9 Specular Mapping

开发者 https://www.devze.com 2022-12-21 11:35 出处:网络
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++?

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

精彩评论

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